diff --git a/.htaccess b/.htaccess index 7ea7e5501ef72eced62ef4f1d701cb7c4ea3d035..891fbd1f18163c779d7145290bdc9782cea255e3 100644 --- a/.htaccess +++ b/.htaccess @@ -181,4 +181,4 @@ ## If running in cluster environment, uncomment this ## http://developer.yahoo.com/performance/rules.html#etags - #FileETag none \ No newline at end of file + #FileETag none diff --git a/CHANGELOG.md b/CHANGELOG.md index 32477535ddc08ccf4ba7cc9c12f804e2816e1620..b00766c9f50f1d4cb4f80b22a3e4ecd30424749f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,69 @@ +2.0.0.0-dev51 +============= +* Application areas rework: + * Single point of access to the current area code + * Declare Application Areas +* Various improvements: + * Breakdown of the Adminhtml module: + * Moved the Customer-related logic to the Customer module + * Moved the System-related logic to the Backend module + * Moved the Checkout-related logic to the Checkout module + * Moved the Cms-related logic to the Cms module + * Moved the Promotions-related logic to the CatalogRule and SalesRule modules + * Eliminated the setNode/getNode methods from Magento\Core\Model\Config and adopted all client code + * Moved all application bootstrapping behavior to library + * Moved application-specific behavior from the entry points to the Magento\AppInterface implementations + * Removed the obsolete behavior from routing and front-controller + * Refactored the route configuration loading + * Extracted the modularity support behavior to the Magento\Module component + * Refactored the Resource configuration loading + * Removed the obsolete configuration loaders + * Removed the obsolete configuration from config.xml + * Refactored the code-generation mechanism + * Added constructor integrity verification to the Compiler tool + * Added strict naming rules for the auto-generated Factory and Proxy classes + * Global functions are now called from app\functions.php + * Removed functions.php from the Magento\Core module + * Methods related to mageCoreErrorHandler, string and date were moved from functions.php to the Library components + * Moved the following methods from Core Helpers to the appropriate libraries: + * Moved the Abstract Helper to the Magento\Escaper and Magento\Filter libraries + * Moved the String Helper to the Magento\Filter, Magento\Stdlib\String, Magento\Stdlib\ArrayUtils libraries + * Moved the Data Helper to the Magento\Math, Magento\Filter, Magento\Convert, Magento\Encryption, Magento\Filesystem libraries and to Magento\Customer\Helper\Data libraries + * Moved the Http Magento Helper to the Magento\HTTP library + * The Hint Magento Helper, Http Magento Helper helpers were removed from the Magento\Core module + * Implemented SOAP faults declaration in WSDL + * Web API config reader was refactored to use Magento\Config\Reader\Filesystem + * Created integrations module. Added 'Integrations Grid' and 'New/Edit' Integration pages in the admin + * Removed obsolete page fragment code +* Fixed bugs: + * Fixed inability to create an Invoice/Shipment/Credit Memo if the Sales Archive functionality is enabled + * Fixed the Minimum Advertised Price link on the Product view + * Fixed the View Files Population Tool + * Fixed the error on saving the Google AdWords configuration + * Fixed the error with the 'Invalid website code requested:' message appearing when enabling payment methods + * Fixed inability to insert spaces in credit card numbers + * Fixed inability to print orders from the frontend + * Fixed the fatal error on removal of reviews that have ratings + * Fixed JS error with the browser not responding when Virtual/Downloadable product are added to cart + * Fixed inability to delete a row from the 'Order By SKU' form in Internet Explorer + * Fixed inability to enable the Use Flat Catalog Product option + * Fixed inability to configure Grouped and Configurable products during order creation in the backend + * Fixed inability to insert a widget and/or a banner in CMS pages + * Fixed inability to set the Quantity value for Gift Cards + * Fixed the fatal error on the Customer Account > Gift Registry tab in the backend + * Fixed inability to import with the "Customers Main File" entity type selected + * Fixed the "Recently Viewed/Compared products" option missing on the New Frontend App Instance page + * Fixed the fatal error on managing Shopping Cart for a customer with a placed order in the backend + * Fixed the fatal error on an attempt to create an RMA request for Configurable products + * Fixed error on the backend dashboard if any value except "Last 24 Hours" is chosen in the "Select Range" dropdown + * Fixed duplicate values of options in the drop-downs on the RMA pages in the backend + 2.0.0.0-dev50 ============= * Modularity improvements: - * Cleavage of Adminhtml module - * Moved Sales, Catalog, Tax-related logic to respective modules - * Moved Action, Cache, Ajax, Dashboard, Index, Json, Rating, Sitemap, Survey, UrlRewrite from root of Adminhtml Controller folder + * Breakdown of the Adminhtml module: + * Moved Sales, Catalog, Tax-related logic to respective modules + * Moved Action, Cache, Ajax, Dashboard, Index, Json, Rating, Sitemap, Survey, UrlRewrite from root of Adminhtml Controller folder * View abstraction was moved into library * Eliminated dependency in Magento\Data\Form from Magento\Core module * Eliminated Magento\Media module diff --git a/app/bootstrap.php b/app/bootstrap.php index 3afb200c5e18a534a7ab189860454ee4b3c9c9e2..ddb065617c087c99d394ec18d706f32a78c13846 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -61,7 +61,7 @@ define('BP', dirname(__DIR__)); /** * Require necessary files */ -require_once BP . '/app/code/Magento/Core/functions.php'; +require_once BP . '/app/functions.php'; require_once __DIR__ . '/autoload.php'; \Magento\Autoload\IncludePath::addIncludePath(array( @@ -90,5 +90,4 @@ if (!defined('BARE_BOOTSTRAP')) { \Magento\Profiler::applyConfig($_SERVER['MAGE_PROFILER'], dirname(__DIR__), !empty($_REQUEST['isAjax'])); } } -set_error_handler('mageCoreErrorHandler'); date_default_timezone_set(\Magento\Core\Model\LocaleInterface::DEFAULT_TIMEZONE); diff --git a/app/code/Magento/AdminNotification/Block/System/Messages.php b/app/code/Magento/AdminNotification/Block/System/Messages.php index 7824cf712d23555947d6967f4eb22aa676311a89..af0ab84636270aceab4e2e1aab5a09294541b1a2 100644 --- a/app/code/Magento/AdminNotification/Block/System/Messages.php +++ b/app/code/Magento/AdminNotification/Block/System/Messages.php @@ -33,7 +33,7 @@ class Messages extends \Magento\Backend\Block\Template protected $_messages; /** - * @param Magento\Core\Helper\Data $coreData + * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\AdminNotification\Model\Resource\System\Message\Collection\Synchronized $messages * @param array $data diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index f193aba100c486a960f1ec470ebaee2805be7018..a0f94bf5ec8d55c694b555881220896286c27e3d 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -59,7 +59,7 @@ class Feed extends \Magento\Core\Model\AbstractModel protected $_inboxFactory; /** - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; @@ -68,7 +68,7 @@ class Feed extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -78,7 +78,7 @@ class Feed extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Registry $registry, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() diff --git a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php index dc167a99ea84d06c94595add80ed282c6e85b61c..6ca88914496f46f94c7fa267ca743d85d5a4479b 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php +++ b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php @@ -43,7 +43,7 @@ class Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\AdminNotification\Model\System\MessageList $messageList @@ -51,7 +51,7 @@ class Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\AdminNotification\Model\System\MessageList $messageList, diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Security.php b/app/code/Magento/AdminNotification/Model/System/Message/Security.php index 70d77037eed821856027332475be8d68d0bf83ba..ed4045d5c38e17687398a51aabf3257d48082081 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Security.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Security.php @@ -45,7 +45,7 @@ class Security private $_verificationTimeOut = 2; /** - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; @@ -65,13 +65,13 @@ class Security protected $_curlFactory; /** - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\Core\Model\Config $config * @param \Magento\HTTP\Adapter\CurlFactory $curlFactory */ public function __construct( - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Core\Model\Store\Config $storeConfig, \Magento\Core\Model\Config $config, \Magento\HTTP\Adapter\CurlFactory $curlFactory diff --git a/app/code/Magento/Adminhtml/Block/Media/Uploader.php b/app/code/Magento/Adminhtml/Block/Media/Uploader.php index edf4b2951f1910259d3a839dc5e230379e30d2ec..4bb0f7e83267ddc22eb7bc819e14e7996678f17c 100644 --- a/app/code/Magento/Adminhtml/Block/Media/Uploader.php +++ b/app/code/Magento/Adminhtml/Block/Media/Uploader.php @@ -39,7 +39,7 @@ class Uploader extends \Magento\Adminhtml\Block\Widget /** * @var string */ - protected $_template = 'media/uploader.phtml'; + protected $_template = 'Magento_Adminhtml::media/uploader.phtml'; /** * @var \Magento\Core\Model\View\Url diff --git a/app/code/Magento/Adminhtml/Block/Newsletter/Queue/Edit/Form.php b/app/code/Magento/Adminhtml/Block/Newsletter/Queue/Edit/Form.php index f99d9d89a724727e45914ee8fce481bb14cf52b4..40ce922592ad148ec4a2e7cb7e68ed6160dc5881 100644 --- a/app/code/Magento/Adminhtml/Block/Newsletter/Queue/Edit/Form.php +++ b/app/code/Magento/Adminhtml/Block/Newsletter/Queue/Edit/Form.php @@ -56,7 +56,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -66,7 +66,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Core\Model\System\Store $systemStore, \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -154,7 +154,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic if ($queue->getQueueStartAt()) { $form->getElement('date')->setValue( - $this->_locale->date($queue->getQueueStartAt(), \Magento\Date::DATETIME_INTERNAL_FORMAT) + $this->_locale->date($queue->getQueueStartAt(), \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT) ); } diff --git a/app/code/Magento/Adminhtml/Block/Newsletter/Template/Edit/Form.php b/app/code/Magento/Adminhtml/Block/Newsletter/Template/Edit/Form.php index 3fc43a3f26732d0728953c1c0ca8beb4edf5fecc..e4739860bab80a3aaf0bf7bc8f1d429ffe624231 100644 --- a/app/code/Magento/Adminhtml/Block/Newsletter/Template/Edit/Form.php +++ b/app/code/Magento/Adminhtml/Block/Newsletter/Template/Edit/Form.php @@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -52,7 +52,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic public function __construct( \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php b/app/code/Magento/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php index cba05c6f1d6ad7fe0edfcc49b43ce58f83e907c7..a2099f27cd5db0f5375e42cde230696f83266e09 100644 --- a/app/code/Magento/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php +++ b/app/code/Magento/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php @@ -87,7 +87,7 @@ class Date $dateFormat = 'yyyy'; break; default: - $dateFormat = \Magento\Date::DATE_INTERNAL_FORMAT; + $dateFormat = \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT; break; } diff --git a/app/code/Magento/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php b/app/code/Magento/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php index 08e6dd3f3e1cfc77cad69c49a00099866511bb9e..89335c849104ac0e0c1505cf78f71645c4493497 100644 --- a/app/code/Magento/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php +++ b/app/code/Magento/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php @@ -204,6 +204,6 @@ class Grid extends \Magento\Adminhtml\Block\Report\Grid\Shopcart public function getRowUrl($row) { - return $this->getUrl('adminhtml/customer/edit', array('id'=>$row->getCustomerId(), 'active_tab'=>'cart')); + return $this->getUrl('customer/index/edit', array('id'=>$row->getCustomerId(), 'active_tab'=>'cart')); } } diff --git a/app/code/Magento/Adminhtml/Block/Review/Add/Form.php b/app/code/Magento/Adminhtml/Block/Review/Add/Form.php index 9df6b28ad36c0d46b255e6722698153b303d82d6..49843a68a04570a7021870f06b3713220082c7d3 100644 --- a/app/code/Magento/Adminhtml/Block/Review/Add/Form.php +++ b/app/code/Magento/Adminhtml/Block/Review/Add/Form.php @@ -52,7 +52,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Review\Helper\Data $reviewData * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -61,7 +61,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Core\Model\System\Store $systemStore, \Magento\Review\Helper\Data $reviewData, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/Review/Edit.php b/app/code/Magento/Adminhtml/Block/Review/Edit.php index 820a22e7757543d52da3aeb80f98c9f00772ebc9..19aec3669700f38a72882833c3b31b9209b22c13 100644 --- a/app/code/Magento/Adminhtml/Block/Review/Edit.php +++ b/app/code/Magento/Adminhtml/Block/Review/Edit.php @@ -157,7 +157,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container 'onclick', 'setLocation(\'' . $this->getUrl( - 'adminhtml/customer/edit', + 'customer/index/edit', array('id' => $this->getRequest()->getParam('customerId', false)) ) .'\')' diff --git a/app/code/Magento/Adminhtml/Block/Review/Edit/Form.php b/app/code/Magento/Adminhtml/Block/Review/Edit/Form.php index 99a6bb126411aef470213b6107badab136a3c25f..41c5fac3f074ca3147bcf2187e8080601cce5aec 100644 --- a/app/code/Magento/Adminhtml/Block/Review/Edit/Form.php +++ b/app/code/Magento/Adminhtml/Block/Review/Edit/Form.php @@ -59,7 +59,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Review\Helper\Data $reviewData * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -70,7 +70,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Review\Helper\Data $reviewData, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -108,12 +108,12 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $fieldset->addField('product_name', 'note', array( 'label' => __('Product'), 'text' => '<a href="' . $this->getUrl('catalog/product/edit', array('id' => $product->getId())) - . '" onclick="this.target=\'blank\'">' . $this->_reviewData->escapeHtml($product->getName()) . '</a>' + . '" onclick="this.target=\'blank\'">' . $this->escapeHtml($product->getName()) . '</a>' )); if ($customer->getId()) { $customerText = __('<a href="%1" onclick="this.target=\'blank\'">%2 %3</a> <a href="mailto:%4">(%4)</a>', - $this->getUrl('adminhtml/customer/edit', array('id' => $customer->getId(), 'active_tab'=>'review')), + $this->getUrl('customer/index/edit', array('id' => $customer->getId(), 'active_tab'=>'review')), $this->escapeHtml($customer->getFirstname()), $this->escapeHtml($customer->getLastname()), $this->escapeHtml($customer->getEmail())); diff --git a/app/code/Magento/Adminhtml/Block/Sitemap/Edit/Form.php b/app/code/Magento/Adminhtml/Block/Sitemap/Edit/Form.php index 60a72f75a45f20d898ebfefb1abb3fd5519dc152..35e38bb6a1ef89ece8fd9c536364d0f6ca6b3f01 100644 --- a/app/code/Magento/Adminhtml/Block/Sitemap/Edit/Form.php +++ b/app/code/Magento/Adminhtml/Block/Sitemap/Edit/Form.php @@ -43,7 +43,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -51,7 +51,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic public function __construct( \Magento\Core\Model\System\Store $systemStore, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php b/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php index 55b7614b3f65991e5cb0e96071e95f362561725e..87e2bbf6f94babc7c29dcc12301c9ab00816ffc1 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php +++ b/app/code/Magento/Adminhtml/Block/Urlrewrite/Catalog/Edit/Form.php @@ -71,7 +71,7 @@ class Form extends \Magento\Adminhtml\Block\Urlrewrite\Edit\Form * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Backend\Helper\Data $adminhtmlData * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -89,7 +89,7 @@ class Form extends \Magento\Adminhtml\Block\Urlrewrite\Edit\Form \Magento\Backend\Model\Session $backendSession, \Magento\Backend\Helper\Data $adminhtmlData, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php b/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php index 8013bc87706fdc0812004d2fc206e216fde3ba15..f7a1a53addb90afcab4512fed55238589d8926bd 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php +++ b/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Edit/Form.php @@ -63,7 +63,7 @@ class Form extends \Magento\Adminhtml\Block\Urlrewrite\Edit\Form * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Backend\Helper\Data $adminhtmlData * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -80,7 +80,7 @@ class Form extends \Magento\Adminhtml\Block\Urlrewrite\Edit\Form \Magento\Backend\Model\Session $backendSession, \Magento\Backend\Helper\Data $adminhtmlData, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php b/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php index e042d50d091a05cb787b4e7a1758d5b0e7aa868f..3c6b2c1c2c5066b211b76d7a40bad3c1e79857f9 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php +++ b/app/code/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Adminhtml\Block\Urlrewrite\Cms\Page; -class Grid extends \Magento\Adminhtml\Block\Cms\Page\Grid +class Grid extends \Magento\Cms\Block\Adminhtml\Page\Grid { /** * Constructor diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php b/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php index ca19c7659c8d155117312d2570d2cb3677278335..7c2b06f3fe90c7cff7ce694550c7faac3337b595 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php +++ b/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php @@ -102,7 +102,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Backend\Helper\Data $adminhtmlData * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -117,7 +117,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Backend\Model\Session $backendSession, \Magento\Backend\Helper\Data $adminhtmlData, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Controller/Report/AbstractReport.php b/app/code/Magento/Adminhtml/Controller/Report/AbstractReport.php index 2d3a87439e274012673d71dee64a20506492f02a..5d6a4d569e63e271b445f3d79e4237d586331530 100644 --- a/app/code/Magento/Adminhtml/Controller/Report/AbstractReport.php +++ b/app/code/Magento/Adminhtml/Controller/Report/AbstractReport.php @@ -114,7 +114,7 @@ abstract class AbstractReport extends \Magento\Backend\Controller\Adminhtml\Acti $flag = $this->_objectManager->create('Magento\Reports\Model\Flag')->setReportFlagCode($flagCode)->loadSelf(); $updatedAt = ($flag->hasData()) ? $this->_objectManager->get('Magento\Core\Model\LocaleInterface')->storeDate( - 0, new \Zend_Date($flag->getLastUpdate(), \Magento\Date::DATETIME_INTERNAL_FORMAT), true + 0, new \Zend_Date($flag->getLastUpdate(), \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT), true ) : 'undefined'; diff --git a/app/code/Magento/Adminhtml/Controller/Report/Statistics.php b/app/code/Magento/Adminhtml/Controller/Report/Statistics.php index 2b1a66ec2affe1abe46fd1a34e1e95de68a8f735..7671ef5b8148084d91e2271f011e5a7705eb1be8 100644 --- a/app/code/Magento/Adminhtml/Controller/Report/Statistics.php +++ b/app/code/Magento/Adminhtml/Controller/Report/Statistics.php @@ -135,7 +135,7 @@ class Statistics extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Exception $e) { $this->_objectManager->get('Magento\Adminhtml\Model\Session') ->addError(__('We can\'t refresh recent statistics.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } if($this->_getSession()->isFirstPageAfterLogin()) { @@ -166,7 +166,7 @@ class Statistics extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Exception $e) { $this->_objectManager->get('Magento\Adminhtml\Model\Session') ->addError(__('We can\'t refresh lifetime statistics.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } if($this->_getSession()->isFirstPageAfterLogin()) { diff --git a/app/code/Magento/Adminhtml/Model/LayoutUpdate/Validator.php b/app/code/Magento/Adminhtml/Model/LayoutUpdate/Validator.php index 2f1c87e3dc662510e8d455438ac40c494de34502..f0225f5f5b16d1b69b5c3e1cd9eac6dddc227910 100644 --- a/app/code/Magento/Adminhtml/Model/LayoutUpdate/Validator.php +++ b/app/code/Magento/Adminhtml/Model/LayoutUpdate/Validator.php @@ -72,7 +72,7 @@ class Validator extends \Zend_Validate_Abstract protected $_xsdSchemas; /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_modulesReader; @@ -82,11 +82,11 @@ class Validator extends \Zend_Validate_Abstract protected $_domConfigFactory; /** - * @param \Magento\Core\Model\Config\Modules\Reader $modulesReader + * @param \Magento\Module\Dir\Reader $modulesReader * @param \Magento\Config\DomFactory $domConfigFactory */ public function __construct( - \Magento\Core\Model\Config\Modules\Reader $modulesReader, + \Magento\Module\Dir\Reader $modulesReader, \Magento\Config\DomFactory $domConfigFactory ) { $this->_modulesReader = $modulesReader; diff --git a/app/code/Magento/Adminhtml/Model/Search/Catalog.php b/app/code/Magento/Adminhtml/Model/Search/Catalog.php index a34a54267bbc33718b1072c05cef9f509b5eb40c..39d6edb9bdd7eb0b7dcfb99cd37d51d933509fce 100644 --- a/app/code/Magento/Adminhtml/Model/Search/Catalog.php +++ b/app/code/Magento/Adminhtml/Model/Search/Catalog.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Adminhtml\Model\Search; + /** * Search Catalog Model - * - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Model\Search; - class Catalog extends \Magento\Object { /** @@ -43,11 +39,11 @@ class Catalog extends \Magento\Object protected $_catalogSearchData = null; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * Adminhtml data @@ -58,16 +54,16 @@ class Catalog extends \Magento\Object /** * @param \Magento\Adminhtml\Helper\Data $adminhtmlData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\CatalogSearch\Helper\Data $catalogSearchData */ public function __construct( \Magento\Adminhtml\Helper\Data $adminhtmlData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\CatalogSearch\Helper\Data $catalogSearchData ) { $this->_adminhtmlData = $adminhtmlData; - $this->_coreString = $coreString; + $this->string = $string; $this->_catalogSearchData = $catalogSearchData; } @@ -98,7 +94,7 @@ class Catalog extends \Magento\Object 'id' => 'product/1/'.$product->getId(), 'type' => __('Product'), 'name' => $product->getName(), - 'description' => $this->_coreString->substr($description, 0, 30), + 'description' => $this->string->substr($description, 0, 30), 'url' => $this->_adminhtmlData->getUrl('catalog/product/edit', array('id' => $product->getId())), ); } diff --git a/app/code/Magento/Adminhtml/Model/Search/Customer.php b/app/code/Magento/Adminhtml/Model/Search/Customer.php index 3129e9d58856c53e34bcc5d5d1b3e548cbda0858..fa11df0c69b531554d1513e291a10c8c3c7bfdab 100644 --- a/app/code/Magento/Adminhtml/Model/Search/Customer.php +++ b/app/code/Magento/Adminhtml/Model/Search/Customer.php @@ -89,7 +89,7 @@ class Customer extends \Magento\Object 'type' => __('Customer'), 'name' => $customer->getName(), 'description' => $customer->getCompany(), - 'url' => $this->_adminhtmlData->getUrl('adminhtml/customer/edit', array('id' => $customer->getId())), + 'url' => $this->_adminhtmlData->getUrl('customer/index/edit', array('id' => $customer->getId())), ); } diff --git a/app/code/Magento/Adminhtml/Model/Session/Quote.php b/app/code/Magento/Adminhtml/Model/Session/Quote.php index 3f61ec714130a2050ed38f8ba257e37c94ab1ff2..c7759239aa3ff1a29bbfa2ced3ba5ff650c621c7 100644 --- a/app/code/Magento/Adminhtml/Model/Session/Quote.php +++ b/app/code/Magento/Adminhtml/Model/Session/Quote.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Adminhtml\Model\Session; + /** * Adminhtml quote session - * - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Model\Session; - class Quote extends \Magento\Core\Model\Session\AbstractSession { const XML_PATH_DEFAULT_CREATEACCOUNT_GROUP = 'customer/create_account/default_group'; @@ -163,7 +159,8 @@ class Quote extends \Magento\Core\Model\Session\AbstractSession if ($useSetStore && $this->getStore()->getId()) { $this->_customer->setStore($this->getStore()); } - if ($customerId = $this->getCustomerId()) { + $customerId = $this->getCustomerId(); + if ($customerId) { $this->_customer->load($customerId); } } @@ -179,7 +176,8 @@ class Quote extends \Magento\Core\Model\Session\AbstractSession { if (is_null($this->_store)) { $this->_store = $this->_storeManager->getStore($this->getStoreId()); - if ($currencyId = $this->getCurrencyId()) { + $currencyId = $this->getCurrencyId(); + if ($currencyId) { $this->_store->setCurrentCurrencyCode($currencyId); } } diff --git a/app/code/Magento/Adminhtml/etc/adminhtml/menu.xml b/app/code/Magento/Adminhtml/etc/adminhtml/menu.xml index 68de1fb3dcd646ee80bdc13f4e3373c1332acae9..27d92ec34c8d4416ab5582163bbe05f2ad521b42 100644 --- a/app/code/Magento/Adminhtml/etc/adminhtml/menu.xml +++ b/app/code/Magento/Adminhtml/etc/adminhtml/menu.xml @@ -31,14 +31,8 @@ <add id="Magento_Adminhtml::system" title="System" module="Magento_Adminhtml" sortOrder="80" resource="Magento_Adminhtml::system"/> <add id="Magento_Adminhtml::system_tools" title="Tools" module="Magento_Adminhtml" sortOrder="50" parent="Magento_Adminhtml::system" resource="Magento_Adminhtml::tools"/> <add id="Magento_Adminhtml::system_design" title="Design" module="Magento_Adminhtml" sortOrder="20" parent="Magento_Adminhtml::content" resource="Magento_Adminhtml::design"/> - <add id="Magento_Adminhtml::system_design_schedule" title="Schedule" module="Magento_Adminhtml" sortOrder="30" parent="Magento_Adminhtml::system_design" action="adminhtml/system_design" resource="Magento_Adminhtml::schedule"/> <add id="Magento_Adminhtml::system_convert" title="Data Transfer" module="Magento_Adminhtml" sortOrder="10" parent="Magento_Adminhtml::system" resource="Magento_Adminhtml::convert"/> - <add id="Magento_Adminhtml::system_currency" title="Currency" module="Magento_Adminhtml" sortOrder="30" parent="Magento_Adminhtml::stores" action="adminhtml/system_currency" resource="Magento_CurrencySymbol::system_currency"/> - <add id="Magento_Adminhtml::system_email_template" title="Email Templates" module="Magento_Adminhtml" sortOrder="10" parent="Magento_Adminhtml::marketing_communications" action="adminhtml/system_email_template" resource="Magento_Adminhtml::email_template"/> - <add id="Magento_Adminhtml::system_variable" title="Custom Variables" module="Magento_Adminhtml" sortOrder="20" parent="Magento_Adminhtml::system_other_settings" action="adminhtml/system_variable" resource="Magento_Adminhtml::variable"/> <add id="Magento_Adminhtml::system_cache" title="Cache Management" module="Magento_Adminhtml" sortOrder="10" parent="Magento_Adminhtml::system_tools" action="adminhtml/cache" resource="Magento_Adminhtml::cache"/> - <add id="Magento_Adminhtml::system_store" title="All Stores" module="Magento_Core" sortOrder="10" parent="Magento_Adminhtml::stores_settings" action="adminhtml/system_store/" resource="Magento_Adminhtml::store"/> - <add id="Magento_Adminhtml::system_config" title="Configuration" module="Magento_Adminhtml" sortOrder="20" parent="Magento_Adminhtml::stores_settings" action="adminhtml/system_config" resource="Magento_Adminhtml::config"/> <add id="Magento_Catalog::inventory" title="Inventory" module="Magento_Catalog" sortOrder="10" parent="Magento_Catalog::catalog" dependsOnModule="Magento_Catalog" resource="Magento_Catalog::catalog"/> diff --git a/app/code/Magento/Adminhtml/etc/config.xml b/app/code/Magento/Adminhtml/etc/config.xml index 7f3ff1cc81a11d00a2c079d526c273230918628c..2142978ee0ca1186a4c2b7c1e6bb41a8b01f876d 100644 --- a/app/code/Magento/Adminhtml/etc/config.xml +++ b/app/code/Magento/Adminhtml/etc/config.xml @@ -26,22 +26,6 @@ */ --> <config> - <adminhtml> - <global_search> - <products> - <class>Magento\Adminhtml\Model\Search\Catalog</class> - <acl>Magento_Catalog::catalog</acl> - </products> - <customers> - <class>Magento\Adminhtml\Model\Search\Customer</class> - <acl>Magento_Customer::customer</acl> - </customers> - <sales> - <class>Magento\Adminhtml\Model\Search\Order</class> - <acl>Magento_Sales::sales</acl> - </sales> - </global_search> - </adminhtml> <default> <system> <media_storage_configuration> @@ -73,14 +57,6 @@ </input_types> </validator_data> </general> - <hints> - <store_switcher> - <url> - <![CDATA[http://www.magentocommerce.com/knowledge-base/entry/understanding-store-scopes]]> -</url> - <enabled>1</enabled> - </store_switcher> - </hints> </default> <stores> <admin> @@ -108,4 +84,4 @@ </web> </admin> </websites> -</config> +</config> \ No newline at end of file diff --git a/app/code/Magento/Adminhtml/etc/module.xml b/app/code/Magento/Adminhtml/etc/module.xml index f34309c3f0d3d83506a1a98bf466dc2d52b697d6..4c589cb95b45aabd9afcefb495be8354ad7a819a 100755 --- a/app/code/Magento/Adminhtml/etc/module.xml +++ b/app/code/Magento/Adminhtml/etc/module.xml @@ -30,32 +30,24 @@ <module name="Magento_Reports"/> <module name="Magento_Customer"/> <module name="Magento_Newsletter"/> - <module name="Magento_Wishlist"/> <module name="Magento_Sales"/> <module name="Magento_Sitemap"/> - <module name="Magento_Directory"/> <module name="Magento_Backend"/> <module name="Magento_Catalog"/> <module name="Magento_Cms"/> - <module name="Magento_CatalogRule"/> <module name="Magento_Review"/> <module name="Magento_Rating"/> <module name="Magento_Tax"/> <module name="Magento_Eav"/> <module name="Magento_CatalogSearch"/> - <module name="Magento_Rule"/> <module name="Magento_SalesRule"/> <module name="Magento_Downloadable"/> <module name="Magento_Shipping"/> <module name="Magento_Backup"/> - <module name="Magento_User"/> <module name="Magento_Checkout"/> - <module name="Magento_Widget"/> - <module name="Magento_Log"/> <module name="Magento_Page"/> <module name="Magento_GiftMessage"/> <module name="Magento_Weee"/> - <module name="Magento_Usa"/> </depends> </module> </config> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/backup/dialogs.phtml b/app/code/Magento/Adminhtml/view/adminhtml/backup/dialogs.phtml index 6b6ed9d329b73a23ce855f9e1eee2c66539d2a1a..9a06acd722cc5df563fa426ebe6185dbe8e19296 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/backup/dialogs.phtml +++ b/app/code/Magento/Adminhtml/view/adminhtml/backup/dialogs.phtml @@ -158,8 +158,8 @@ //<![CDATA[ document.observe('dom:loaded', function () { backup = new AdminBackup(); - backup.rollbackUrl = '<?php echo $helper->jsQuoteEscape($rollbackUrl);?>'; - backup.backupUrl = '<?php echo $helper->jsQuoteEscape($backupUrl);?>'; + backup.rollbackUrl = '<?php echo $helper->escapeJsQuote($rollbackUrl);?>'; + backup.backupUrl = '<?php echo $helper->escapeJsQuote($backupUrl);?>'; }); //]]> </script> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_quote_couponsgrid.xml b/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_quote_couponsgrid.xml deleted file mode 100644 index 7425011f5f80f5704965e2b08e3e397aafbfa6ab..0000000000000000000000000000000000000000 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_quote_couponsgrid.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <container name="root" label="Root" output="1"> - <block class="Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Grid" name="promo_quote_edit_tab_coupons_grid"/> - </container> -</layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/default.xml b/app/code/Magento/Adminhtml/view/adminhtml/layout/default.xml index dc046bfc44e305aaba1c23a9976bb1b15f464afc..3980c42ad63e206bc1b1371275062c2c64b073c0 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/default.xml +++ b/app/code/Magento/Adminhtml/view/adminhtml/layout/default.xml @@ -253,7 +253,7 @@ </block> <block class="Magento\Page\Block\Html\Head\Script" name="magento-adminhtml-promo-rules-js"> <arguments> - <argument name="file" xsi:type="string">Magento_Adminhtml::promo/rules.js</argument> + <argument name="file" xsi:type="string">Magento_Rule::rules.js</argument> <argument name="properties" xsi:type="array"> <item name="attributes" xsi:type="string"/> <item name="ie_condition" xsi:type="string"/> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/editor.xml b/app/code/Magento/Adminhtml/view/adminhtml/layout/editor.xml index 81d9fd649ccb6240447fb00c61ddd407fcfaf603..9bb06c3802b9a1f075af72efc7f59691897de1e5 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/editor.xml +++ b/app/code/Magento/Adminhtml/view/adminhtml/layout/editor.xml @@ -30,7 +30,7 @@ </action> <block class="Magento\Page\Block\Html\Head\Script" name="magento-adminhtml-variables-js"> <arguments> - <argument name="file" xsi:type="string">Magento_Adminhtml::variables.js</argument> + <argument name="file" xsi:type="string">Magento_Backend::variables.js</argument> </arguments> </block> <block class="Magento\Page\Block\Html\Head\Script" name="magento-adminhtml-wysiwyg-widget-js"> diff --git a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php index 4e52666b5fd2f905382d323a2f992f5bfaa1d0f8..09086d4d67473752b920f39be3cc281f54402a9d 100644 --- a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php @@ -1,5 +1,7 @@ <?php /** + * Admihtml DirtectPost Payment Controller + * * Magento * * NOTICE OF LICENSE @@ -18,19 +20,9 @@ * 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_Authorizenet * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * Admihtml DirtectPost Payment Controller - * - * @category Magento - * @package Magento_DirtectPost - * @author Magento Core Team <core@magentocommerce.com> - */ namespace Magento\Authorizenet\Controller\Adminhtml\Authorizenet\Directpost; class Payment diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php index 6b7468235f2789d2c9661757fabe0ee8f9c00777..d8c19d1021f4564de4a8ff0b7a511e06b23ecebc 100644 --- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php @@ -95,11 +95,11 @@ class Payment extends \Magento\Core\Controller\Front\Action $paymentMethod->process($data); $result['success'] = 1; } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $result['success'] = 0; $result['error_msg'] = $e->getMessage(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $result['success'] = 0; $result['error_msg'] = __('We couldn\'t process your order right now. Please try again later.'); } diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index 76b9b4b57a910ce2f9b3cf76a49b278ab93b1022..e497766c0bda2f6ccb0fb0b2de6349072f54a358 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -81,10 +81,10 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet * @param \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Core\Model\Session\AbstractSession $session - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Paygate\Helper\Data $paygateData - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory @@ -103,10 +103,10 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Core\Model\Session\AbstractSession $session, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\Paygate\Helper\Data $paygateData, - \Magento\App\ModuleListInterface $moduleList, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, diff --git a/app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_redirect.xml b/app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_redirect.xml index 094823131176015f9e563fc0d81336434073ac0c..a6f7da163760b4271d01c4cfe504871a03cd9561 100644 --- a/app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_redirect.xml +++ b/app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_redirect.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="AuthorizeNet Directpost Redirect" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Authorizenet\Block\Directpost\Iframe" name="iframe" template="directpost/iframe.phtml"/> - </block> + <block class="Magento\Authorizenet\Block\Directpost\Iframe" name="iframe" output="1" template="directpost/iframe.phtml"/> </layout> diff --git a/app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_response.xml b/app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_response.xml index 27bcc151dbbb7df3e030695ebe30e336771b4c3a..31ad3f320f735f229ac1f5582afd72741fd2bb2c 100644 --- a/app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_response.xml +++ b/app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_response.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="AuthorizeNet Directpost Response" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Authorizenet\Block\Directpost\Iframe" name="iframe" template="directpost/iframe.phtml"/> - </block> + <block class="Magento\Authorizenet\Block\Directpost\Iframe" name="iframe" output="1" template="directpost/iframe.phtml"/> </layout> diff --git a/app/code/Magento/Backend/App/Area/FrontNameResolver.php b/app/code/Magento/Backend/App/Area/FrontNameResolver.php index 85dd32d939e682b878617578fefd8a753afb5dd9..172711098246a996333d0988f222670fdf1a0ab7 100644 --- a/app/code/Magento/Backend/App/Area/FrontNameResolver.php +++ b/app/code/Magento/Backend/App/Area/FrontNameResolver.php @@ -1,5 +1,7 @@ <?php /** + * Backend area front name resolver. Reads front name from configuration + * * Magento * * NOTICE OF LICENSE @@ -30,6 +32,11 @@ class FrontNameResolver implements \Magento\App\Area\FrontNameResolverInterface const PARAM_BACKEND_FRONT_NAME = 'backend.frontName'; + /** + * Backend area code + */ + const AREA_CODE = 'adminhtml'; + /** * @var string */ @@ -63,4 +70,4 @@ class FrontNameResolver implements \Magento\App\Area\FrontNameResolverInterface } return $this->_defaultFrontName; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Backend/App/DefaultPath.php b/app/code/Magento/Backend/App/DefaultPath.php new file mode 100644 index 0000000000000000000000000000000000000000..b69472565a7c9b5f0b2a6867a3b31e1ac0a951ff --- /dev/null +++ b/app/code/Magento/Backend/App/DefaultPath.php @@ -0,0 +1,60 @@ +<?php +/** + * Default application path for backend area + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Backend\App; + +class DefaultPath implements \Magento\App\DefaultPathInterface +{ + /** + * @var array + */ + protected $_parts; + + /** + * @param \Magento\Core\Model\Config $config + */ + public function __construct(\Magento\Core\Model\Config $config) + { + $pathParts = explode('/', $config->getValue('web/default/admin', 'default')); + + $this->_parts = array( + 'area' => isset($pathParts[0]) ? $pathParts[0] : '', + 'module' => isset($pathParts[1]) ? $pathParts[1] : 'admin', + 'controller' => isset($pathParts[2]) ? $pathParts[2] : 'index', + 'action' => isset($pathParts[3]) ? $pathParts[3] : 'index', + ); + } + + /** + * Retrieve default path part by code + * + * @param string $code + * @return string + */ + public function getPart($code) + { + return isset($this->_parts[$code]) ? $this->_parts[$code] : null; + } +} \ No newline at end of file diff --git a/app/code/Magento/Backend/App/Request/PathInfoProcessor.php b/app/code/Magento/Backend/App/Request/PathInfoProcessor.php index e88af14ad33a64b29b2053790e5db1d9306bc2c0..c81b8048079b5bccdace805117ab4a8b12b8047d 100644 --- a/app/code/Magento/Backend/App/Request/PathInfoProcessor.php +++ b/app/code/Magento/Backend/App/Request/PathInfoProcessor.php @@ -1,5 +1,7 @@ <?php /** + * Prevents path info processing for admin store + * * Magento * * NOTICE OF LICENSE @@ -29,6 +31,7 @@ class PathInfoProcessor implements \Magento\App\Request\PathInfoProcessorInterfa * @var \Magento\Backend\Helper\Data */ private $_helper; + /** * @var \Magento\Core\App\Request\PathInfoProcessor */ diff --git a/app/code/Magento/Backend/App/Router/DefaultRouter.php b/app/code/Magento/Backend/App/Router/DefaultRouter.php new file mode 100644 index 0000000000000000000000000000000000000000..8f377599555aabeeab063aeb88bfa8b981775bb5 --- /dev/null +++ b/app/code/Magento/Backend/App/Router/DefaultRouter.php @@ -0,0 +1,129 @@ +<?php +/** + * Backend router + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * + */ +namespace Magento\Backend\App\Router; + +class DefaultRouter extends \Magento\Core\App\Router\Base +{ + /** + * List of required request parameters + * Order sensitive + * @var array + */ + protected $_requiredParams = array( + 'areaFrontName', + 'moduleFrontName', + 'controllerName', + 'actionName', + ); + + /** + * Get router default request path + * @return string + */ + protected function _getDefaultPath() + { + return (string)$this->_storeConfig->getConfig('web/default/admin', 'admin'); + } + + /** + * We need to have noroute action in this router + * not to pass dispatching to next routers + * + * @return bool + */ + protected function _noRouteShouldBeApplied() + { + return true; + } + + /** + * Check whether URL for corresponding path should use https protocol + * + * @param string $path + * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + protected function _shouldBeSecure($path) + { + return substr((string)$this->_storeConfig->getConfig('web/unsecure/base_url'), 0, 5) === 'https' + || $this->_storeConfig->getConfigFlag( + 'web/secure/use_in_adminhtml', + \Magento\Core\Model\AppInterface::ADMIN_STORE_ID + ) && substr((string)$this->_storeConfig->getConfig('web/secure/base_url'), 0, 5) === 'https'; + } + + /** + * Retrieve current secure url + * + * @param \Magento\App\RequestInterface $request + * @return string + */ + protected function _getCurrentSecureUrl($request) + { + return $this->_storeManager->getStore(\Magento\Core\Model\AppInterface::ADMIN_STORE_ID) + ->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/'); + } + + /** + * Check whether redirect should be used for secure routes + * + * @return bool + */ + protected function _shouldRedirectToSecure() + { + return false; + } + + /** + * Build controller class name based on moduleName and controllerName + * + * @param string $realModule + * @param string $controller + * @return string + */ + public function getControllerClassName($realModule, $controller) + { + /** + * Start temporary block + * TODO: Sprint#27. Delete after adminhtml refactoring + */ + if ($realModule == 'Magento_Adminhtml') { + return parent::getControllerClassName($realModule, $controller); + } + /** + * End temporary block + */ + + $parts = explode('_', $realModule); + $parts = array_splice($parts, 0, 2); + $parts[] = 'Controller'; + $parts[] = \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE; + $parts[] = $controller; + + return \Magento\Core\Helper\String::buildClassName($parts); + } +} diff --git a/app/code/Magento/Backend/App/Router/NoRouteHandler.php b/app/code/Magento/Backend/App/Router/NoRouteHandler.php index da35e1856de310b106e7f1b7c43f9da16c2db661..5db07afe0fe49eb1c83f9bf5bf44ccba0bc459c1 100644 --- a/app/code/Magento/Backend/App/Router/NoRouteHandler.php +++ b/app/code/Magento/Backend/App/Router/NoRouteHandler.php @@ -23,10 +23,9 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Backend\App\Router; -class NoRouteHandler implements \Magento\Appl\Router\NoRouteHandlerInterface +class NoRouteHandler implements \Magento\App\Router\NoRouteHandlerInterface { /** * @var \Magento\Backend\Helper\Data @@ -54,7 +53,7 @@ class NoRouteHandler implements \Magento\Appl\Router\NoRouteHandlerInterface if ($areaFrontName == $this->_helper->getAreaFrontName()) { - $moduleName = 'core'; + $moduleName = 'admin'; $controllerName = 'index'; $actionName = 'noRoute'; diff --git a/app/code/Magento/Backend/Block/AbstractBlock.php b/app/code/Magento/Backend/Block/AbstractBlock.php index 5f622082df5df3d2925f5b77a6c9ad7609df388e..4b6938b6d9605e1637fd79bf5f5e3fabfe6c7400 100644 --- a/app/code/Magento/Backend/Block/AbstractBlock.php +++ b/app/code/Magento/Backend/Block/AbstractBlock.php @@ -24,17 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Backend abstract block - * - * @category Magento - * @package Magento_Backend - * @author Magento Core Team <core@magentocommerce.com> - * - */ namespace Magento\Backend\Block; /** + * Backend abstract block + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class AbstractBlock extends \Magento\Core\Block\AbstractBlock @@ -44,11 +38,6 @@ class AbstractBlock extends \Magento\Core\Block\AbstractBlock */ protected $_authorization; - /** - * @var \Magento\Core\Model\Logger - */ - protected $_logger; - /** * @param \Magento\Backend\Block\Context $context * @param array $data @@ -59,6 +48,5 @@ class AbstractBlock extends \Magento\Core\Block\AbstractBlock ) { parent::__construct($context, $data); $this->_authorization = $context->getAuthorization(); - $this->_logger = $context->getLogger(); } } diff --git a/app/code/Magento/Backend/Block/Context.php b/app/code/Magento/Backend/Block/Context.php index c7213a9dddde26007b2a527f17ff95a8b477b150..5cefccfe4795e0e1e99eac032204afb07262196c 100644 --- a/app/code/Magento/Backend/Block/Context.php +++ b/app/code/Magento/Backend/Block/Context.php @@ -41,7 +41,7 @@ class Context extends \Magento\Core\Block\Context * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Core\Model\Translate $translator - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\View\DesignInterface $design * @param \Magento\Core\Model\Session\AbstractSession $session * @param \Magento\Core\Model\Store\Config $storeConfig @@ -51,8 +51,10 @@ class Context extends \Magento\Core\Block\Context * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\Core\Model\Cache\StateInterface $cacheState * @param \Magento\AuthorizationInterface $authorization - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\App $app + * @param \Magento\Escaper $escaper + * @param \Magento\Filter\FilterManager $filterManager * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -63,7 +65,7 @@ class Context extends \Magento\Core\Block\Context \Magento\Event\ManagerInterface $eventManager, \Magento\UrlInterface $urlBuilder, \Magento\Core\Model\Translate $translator, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\View\DesignInterface $design, \Magento\Core\Model\Session\AbstractSession $session, \Magento\Core\Model\Store\Config $storeConfig, @@ -73,14 +75,16 @@ class Context extends \Magento\Core\Block\Context \Magento\View\ConfigInterface $viewConfig, \Magento\Core\Model\Cache\StateInterface $cacheState, \Magento\AuthorizationInterface $authorization, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\App $app, + \Magento\Escaper $escaper, + \Magento\Filter\FilterManager $filterManager, array $data = array() ) { $this->_authorization = $authorization; parent::__construct($request, $layout, $eventManager, $urlBuilder, $translator, $cache, $design, $session, $storeConfig, $frontController, $helperFactory, $viewUrl, $viewConfig, $cacheState, $logger, $app, - $data + $escaper, $filterManager, $data ); } diff --git a/app/code/Magento/Backend/Block/Dashboard.php b/app/code/Magento/Backend/Block/Dashboard.php index a1568bb961a432a3e1c5a502898127fca3febdf9..309a8c54b3e0099c9e3a81fa767161ccc57ee973 100644 --- a/app/code/Magento/Backend/Block/Dashboard.php +++ b/app/code/Magento/Backend/Block/Dashboard.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php b/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php index 49096dd63f886ecb83b0dabb94f34324eee1bd95..96b3a8860c8aefb8891f1eeb70835932e8a3cb24 100644 --- a/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php +++ b/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard tab abstract * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Bar.php b/app/code/Magento/Backend/Block/Dashboard/Bar.php index 7829f508cbc296d1cef97c68aacde1799a9a62b8..83974093b46c674ae15e04931b4a6cd7611014ea 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Bar.php +++ b/app/code/Magento/Backend/Block/Dashboard/Bar.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard bar block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Diagrams.php b/app/code/Magento/Backend/Block/Dashboard/Diagrams.php index 30293996e80f3c71fe37f84797b36b0fd8c28f00..6350b9994804682e9c709dc1ae02c24c3b8ebe6f 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Diagrams.php +++ b/app/code/Magento/Backend/Block/Dashboard/Diagrams.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard diagram tabs * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Graph.php b/app/code/Magento/Backend/Block/Dashboard/Graph.php index f62e3d263437b88c02cce6aceffcbb1a798263fb..31b7da638ef78678f6d7fb63a5845135d297c67b 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Graph.php +++ b/app/code/Magento/Backend/Block/Dashboard/Graph.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard google chart block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Grid.php b/app/code/Magento/Backend/Block/Dashboard/Grid.php index 034a4df364a49603f819e524b285d97f64c280c0..b76681b712649a9b78d1c3aa4a6c415a3f5442ba 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Grid.php +++ b/app/code/Magento/Backend/Block/Dashboard/Grid.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard grid * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Grids.php b/app/code/Magento/Backend/Block/Dashboard/Grids.php index e927e658f4333232bc74016c06dc1650b50893b6..f0d09b59a1fb867ea969c1c4858f9bb6eb859d40 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Grids.php +++ b/app/code/Magento/Backend/Block/Dashboard/Grids.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard bottom tabs * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php b/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php index c101cf0dd60186f99d3c1110ab2b0f67a11e085d..93c1f246cf9cd71b13c9787c899bbdf365f0193e 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php +++ b/app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard recent orders grid * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Sales.php b/app/code/Magento/Backend/Block/Dashboard/Sales.php index 0220b643a4b80752139f3e6845557cbdf64d8d71..48893c077f2bde43d7d6d4651336f81aae7ac8ed 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Sales.php +++ b/app/code/Magento/Backend/Block/Dashboard/Sales.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard sales statistics bar * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Searches/Last.php b/app/code/Magento/Backend/Block/Dashboard/Searches/Last.php index 4de111d5d70b78f7597acd4b5d9e2d5b0d23395d..b5e82583b7c507557c5ff081130612031240d257 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Searches/Last.php +++ b/app/code/Magento/Backend/Block/Dashboard/Searches/Last.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard last search keywords block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php b/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php index 559aebebda77876ce2b15586b7fc4439a4b0e36d..153d2ca483bc8011b70a50c3623e955d79601b8f 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php +++ b/app/code/Magento/Backend/Block/Dashboard/Searches/Renderer/Searchquery.php @@ -27,9 +27,6 @@ /** * Dashboard search query column renderer - * - * @category Magento - * @package Magento_Adminhtml */ namespace Magento\Backend\Block\Dashboard\Searches\Renderer; diff --git a/app/code/Magento/Backend/Block/Dashboard/Searches/Top.php b/app/code/Magento/Backend/Block/Dashboard/Searches/Top.php index 453ed8f84e1bc01f02f2bc23d23dcf071ddbf31a..c440370317c11fe7dfa86b8d48999bb3510049a1 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Searches/Top.php +++ b/app/code/Magento/Backend/Block/Dashboard/Searches/Top.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard last search keywords block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Amounts.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Amounts.php index a1bcc0c15684d86e7784d8b2709a665e775b1f5c..4d63408b8241bd9bd020519837ad0283572ab90d 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Amounts.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Amounts.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard order amounts diagram * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php index 74bd1d70e3617d917c0f75c46574798263a791f5..4b4839f51e4e875a9836ff4dfba29101d4655ac8 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard most active buyers * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ @@ -140,6 +140,6 @@ class Most extends \Magento\Backend\Block\Dashboard\Grid public function getRowUrl($row) { - return $this->getUrl('adminhtml/customer/edit', array('id'=>$row->getCustomerId())); + return $this->getUrl('customer/index/edit', array('id'=>$row->getCustomerId())); } } diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Newest.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Newest.php index dfb8b578183698851913d1a46a556473b37e01aa..e07c4254b63f29aa58b6d980012a109eaade5afa 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Newest.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Newest.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard most recent customers grid * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ @@ -138,6 +138,6 @@ class Newest extends \Magento\Backend\Block\Dashboard\Grid public function getRowUrl($row) { - return $this->getUrl('adminhtml/customer/edit', array('id'=>$row->getId())); + return $this->getUrl('customer/index/edit', array('id'=>$row->getId())); } } diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Orders.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Orders.php index 12799a540ddcf28051a84f271d35d3e7a8740d8c..ff24fa61da3c6febd28215ed1663730f499792d3 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Orders.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Orders.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard orders diagram * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php index 5cb3852864af2e96dd913c2f6d2f9b4df8b72afb..01881f2902d5e2f537386df3c84bedae67085ae0 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Ordered.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard most ordered products grid * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Viewed.php b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Viewed.php index a6021ff461ba87efc99eac224f6e8993f7754c12..937f782d4a1d11fd1645b618d8bb130b2b0ee297 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Viewed.php +++ b/app/code/Magento/Backend/Block/Dashboard/Tab/Products/Viewed.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml dashboard most viewed products grid * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ diff --git a/app/code/Magento/Backend/Block/Dashboard/Totals.php b/app/code/Magento/Backend/Block/Dashboard/Totals.php index dcd1ff8feeea85abdcb4d3828bdafe7e8dd441a3..3f6879a491ebd1b5c9305e89b836dfcfbd9fc172 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Totals.php +++ b/app/code/Magento/Backend/Block/Dashboard/Totals.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,7 +29,7 @@ * Adminhtml dashboard totals bar * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ namespace Magento\Backend\Block\Dashboard; diff --git a/app/code/Magento/Backend/Block/GlobalSearch.php b/app/code/Magento/Backend/Block/GlobalSearch.php index 93f0419e561e30eed966393d5bbf81645874d0c1..a40b0585a6df0aeea1bc5ab726d6ac33006f2f1a 100644 --- a/app/code/Magento/Backend/Block/GlobalSearch.php +++ b/app/code/Magento/Backend/Block/GlobalSearch.php @@ -31,7 +31,7 @@ class GlobalSearch extends \Magento\Backend\Block\Template /** * @var string */ - protected $_template = 'Magento_Adminhtml::system/search.phtml'; + protected $_template = 'Magento_Backend::system/search.phtml'; /** * Get components configuration diff --git a/app/code/Magento/Backend/Block/Store/Switcher.php b/app/code/Magento/Backend/Block/Store/Switcher.php index 347905d605fdf5521ea27a9200ce1367ca45649e..6f557d2761f7135eb87672dfda55d9732fdacc95 100644 --- a/app/code/Magento/Backend/Block/Store/Switcher.php +++ b/app/code/Magento/Backend/Block/Store/Switcher.php @@ -39,9 +39,9 @@ namespace Magento\Backend\Block\Store; class Switcher extends \Magento\Backend\Block\Template { /** - * Key in config for store switcher hint + * URL for store switcher hint */ - const XPATH_HINT_KEY = 'store_switcher'; + const HINT_URL = 'http://www.magentocommerce.com/knowledge-base/entry/understanding-store-scopes'; /** * @var array @@ -127,7 +127,6 @@ class Switcher extends \Magento\Backend\Block\Template $this->_storeFactory = $storeFactory; } - protected function _construct() { parent::_construct(); @@ -338,10 +337,7 @@ class Switcher extends \Magento\Backend\Block\Template */ public function getHintUrl() { - if (null === $this->_hintUrl) { - $this->_hintUrl = $this->helper('Magento\Core\Helper\Hint')->getHintByCode(self::XPATH_HINT_KEY); - } - return $this->_hintUrl; + return self::HINT_URL; } /** diff --git a/app/code/Magento/Adminhtml/Block/System/Account/Edit.php b/app/code/Magento/Backend/Block/System/Account/Edit.php similarity index 90% rename from app/code/Magento/Adminhtml/Block/System/Account/Edit.php rename to app/code/Magento/Backend/Block/System/Account/Edit.php index a830c4edfc1a59df9bb29480263c328f6e3f6a2d..026982028073d6b784623083adf65da3cbc461ad 100644 --- a/app/code/Magento/Adminhtml/Block/System/Account/Edit.php +++ b/app/code/Magento/Backend/Block/System/Account/Edit.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml edit admin user account * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Account; +namespace Magento\Backend\Block\System\Account; class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -40,6 +40,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { parent::_construct(); + $this->_blockGroup = 'Magento_Backend'; $this->_controller = 'system_account'; $this->_updateButton('save', 'label', __('Save Account')); $this->_removeButton('delete'); diff --git a/app/code/Magento/Adminhtml/Block/System/Account/Edit/Form.php b/app/code/Magento/Backend/Block/System/Account/Edit/Form.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/System/Account/Edit/Form.php rename to app/code/Magento/Backend/Block/System/Account/Edit/Form.php index fadde160ebaecf62f89df85cbf4ee364d3698ff0..40e5c2607aefd8267f5307b997fab567fee5fbe8 100644 --- a/app/code/Magento/Adminhtml/Block/System/Account/Edit/Form.php +++ b/app/code/Magento/Backend/Block/System/Account/Edit/Form.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml edit admin user account form * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Account\Edit; +namespace Magento\Backend\Block\System\Account\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { @@ -50,7 +50,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\User\Model\UserFactory $userFactory * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -59,7 +59,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\User\Model\UserFactory $userFactory, \Magento\Backend\Model\Auth\Session $authSession, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/System/Cache/Edit.php b/app/code/Magento/Backend/Block/System/Cache/Edit.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/System/Cache/Edit.php rename to app/code/Magento/Backend/Block/System/Cache/Edit.php index c31263adf6c20fec33f9eb8b2b592ad0b1dbfb79..db9796f31786c3152d75f86cadd34dbdfa17f239 100644 --- a/app/code/Magento/Adminhtml/Block/System/Cache/Edit.php +++ b/app/code/Magento/Backend/Block/System/Cache/Edit.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,15 +28,15 @@ * Cache management edit page * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Cache; +namespace Magento\Backend\Block\System\Cache; class Edit extends \Magento\Adminhtml\Block\Widget { - protected $_template = 'system/cache/edit.phtml'; + protected $_template = 'Magento_Backend::system/cache/edit.phtml'; protected function _construct() { @@ -72,7 +72,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget public function initForm() { $this->setChild('form', - $this->getLayout()->createBlock('Magento\Adminhtml\Block\System\Cache\Form') + $this->getLayout()->createBlock('Magento\Backend\Block\System\Cache\Form') ->initForm() ); return $this; diff --git a/app/code/Magento/Adminhtml/Block/System/Cache/Form.php b/app/code/Magento/Backend/Block/System/Cache/Form.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/System/Cache/Form.php rename to app/code/Magento/Backend/Block/System/Cache/Form.php index c761d03a9a0a1e7bb13caa6ac6cd1a20db51a815..2cf01c41a9e24d67f23a635c0148309bd48d3150 100644 --- a/app/code/Magento/Adminhtml/Block/System/Cache/Form.php +++ b/app/code/Magento/Backend/Block/System/Cache/Form.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,17 +29,17 @@ * Cache management form page * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Cache; +namespace Magento\Backend\Block\System\Cache; class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** * Initialize cache management form * - * @return \Magento\Adminhtml\Block\System\Cache\Form + * @return \Magento\Backend\Block\System\Cache\Form */ public function initForm() { diff --git a/app/code/Magento/Backend/Block/System/Config/Form.php b/app/code/Magento/Backend/Block/System/Config/Form.php index 0ccb76f8a7ebbe78f482a3e2edd5a042a9013829..b35c713e5473ac2605710bbd806dc7f22a3bc542 100644 --- a/app/code/Magento/Backend/Block/System/Config/Form.php +++ b/app/code/Magento/Backend/Block/System/Config/Form.php @@ -90,9 +90,9 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic protected $_configFactory; /** - * \Magento\Data\Form\Factory + * \Magento\Data\FormFactory * - * @var \Magento\Data\Form\Factory + * @var \Magento\Data\FormFactory */ protected $_formFactory; @@ -137,7 +137,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -152,7 +152,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Core\Model\Config $coreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -466,10 +466,6 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic public function getConfigValue($path) { return $this->_config->getValue($path, $this->getScope(), $this->getScopeCode()); - if (empty($this->_configRoot)) { - $this->_configRoot = $this->_coreConfig->getNode(null, $this->getScope(), $this->getScopeCode()); - } - return $this->_configRoot; } /** diff --git a/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php b/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php index 24d9cfe5082a5aa2d215c8b2aebe38d776738392..380ac862d61eb0cd1256ffe7c215a39fdbfc7d68 100644 --- a/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php +++ b/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php @@ -41,21 +41,21 @@ class Export extends \Magento\Data\Form\Element\AbstractElement protected $_helperFactory; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Core\Model\Factory\Helper $helperFactory * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Core\Model\Factory\Helper $helperFactory, array $attributes = array() ) { $this->_helperFactory = $helperFactory; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); } public function getElementHtml() diff --git a/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php b/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php index 923206ff93bd30b0b9c11a5e63273143022f7b53..2e3e9a7c2ce057e90581d615f77fc70e343740f4 100644 --- a/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php +++ b/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php @@ -49,20 +49,20 @@ class DisableOutput protected $_values; /** - * @var \Magento\App\ModuleListInterface + * @var \Magento\Module\ModuleListInterface */ protected $_moduleList; /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\ModuleListInterface $moduleList * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, - \Magento\App\ModuleListInterface $moduleList, + \Magento\Module\ModuleListInterface $moduleList, array $data = array() ) { parent::__construct($context, $authSession, $data); diff --git a/app/code/Magento/Backend/Block/System/Config/Switcher.php b/app/code/Magento/Backend/Block/System/Config/Switcher.php index b8388e4b79fefe89ddffe2586f63cd140d8974c9..c7c5f07be63ff66d9837481c7710d2dcc8a22652 100644 --- a/app/code/Magento/Backend/Block/System/Config/Switcher.php +++ b/app/code/Magento/Backend/Block/System/Config/Switcher.php @@ -62,7 +62,7 @@ class Switcher extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->setTemplate('system/config/switcher.phtml'); + $this->setTemplate('Magento_Backend::system/config/switcher.phtml'); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Backend/Block/System/Config/System/Storage/Media/Synchronize.php b/app/code/Magento/Backend/Block/System/Config/System/Storage/Media/Synchronize.php index 0fc731332cf95ec3ecbee4e82788374c5f2b0fd5..dd8743738cfa2a7fef9f868ec0a886eca4550b10 100644 --- a/app/code/Magento/Backend/Block/System/Config/System/Storage/Media/Synchronize.php +++ b/app/code/Magento/Backend/Block/System/Config/System/Storage/Media/Synchronize.php @@ -32,7 +32,7 @@ namespace Magento\Backend\Block\System\Config\System\Storage\Media; class Synchronize extends \Magento\Backend\Block\System\Config\Form\Field { - protected $_template = 'system/config/system/storage/media/synchronize.phtml'; + protected $_template = 'Magento_Backend::system/config/system/storage/media/synchronize.phtml'; /** * @var \Magento\Core\Model\File\Storage diff --git a/app/code/Magento/Backend/Block/System/Config/Tabs.php b/app/code/Magento/Backend/Block/System/Config/Tabs.php index ebaea6bc0e8529ccce2359d05db7bbe380eba688..5bae0bf86e45fe4b0246b5b97a9ba6220027177d 100644 --- a/app/code/Magento/Backend/Block/System/Config/Tabs.php +++ b/app/code/Magento/Backend/Block/System/Config/Tabs.php @@ -53,7 +53,7 @@ class Tabs extends \Magento\Backend\Block\Widget * * @var string */ - protected $_template = 'system/config/tabs.phtml'; + protected $_template = 'Magento_Backend::system/config/tabs.phtml'; /** * Currently selected section id diff --git a/app/code/Magento/Adminhtml/Block/System/Design.php b/app/code/Magento/Backend/Block/System/Design.php similarity index 90% rename from app/code/Magento/Adminhtml/Block/System/Design.php rename to app/code/Magento/Backend/Block/System/Design.php index c627207bfc96ae69311da0739def5c72bcad4111..07cbdd28d744260f0a5141951e4ca0f6a1e764a5 100644 --- a/app/code/Magento/Adminhtml/Block/System/Design.php +++ b/app/code/Magento/Backend/Block/System/Design.php @@ -19,19 +19,19 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System; +namespace Magento\Backend\Block\System; class Design extends \Magento\Adminhtml\Block\Template { protected function _prepareLayout() { - $this->setTemplate('system/design/index.phtml'); + $this->setTemplate('Magento_Backend::system/design/index.phtml'); $this->addChild('add_new_button', 'Magento\Adminhtml\Block\Widget\Button', array( 'label' => __('Add Design Change'), diff --git a/app/code/Magento/Adminhtml/Block/System/Design/Edit.php b/app/code/Magento/Backend/Block/System/Design/Edit.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/System/Design/Edit.php rename to app/code/Magento/Backend/Block/System/Design/Edit.php index f91ca37a681caff129861be81c5d3a5cdb99c202..599bfd2fccc1be39bb088130874f6a609e0392e4 100644 --- a/app/code/Magento/Adminhtml/Block/System/Design/Edit.php +++ b/app/code/Magento/Backend/Block/System/Design/Edit.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Design; +namespace Magento\Backend\Block\System\Design; class Edit extends \Magento\Adminhtml\Block\Widget { - protected $_template = 'system/design/edit.phtml'; + protected $_template = 'Magento_Backend::system/design/edit.phtml'; /** * Core registry diff --git a/app/code/Magento/Adminhtml/Block/System/Design/Edit/Tab/General.php b/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/System/Design/Edit/Tab/General.php rename to app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php index 10188bca091b672926cd8670742c860553b3c4d3..b353c44dd719edf1c5d24f361c621bebbebe370d 100644 --- a/app/code/Magento/Adminhtml/Block/System/Design/Edit/Tab/General.php +++ b/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php @@ -19,11 +19,11 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Design\Edit\Tab; +namespace Magento\Backend\Block\System\Design\Edit\Tab; class General extends \Magento\Backend\Block\Widget\Form\Generic { @@ -47,7 +47,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -57,7 +57,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Backend\Model\Session $backendSession, \Magento\Core\Model\System\Store $systemStore, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -71,7 +71,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic /** * Initialise form fields * - * @return \Magento\Adminhtml\Block\System\Design\Edit\Tab\General + * @return \Magento\Backend\Block\System\Design\Edit\Tab\General */ protected function _prepareForm() { diff --git a/app/code/Magento/Adminhtml/Block/System/Design/Edit/Tabs.php b/app/code/Magento/Backend/Block/System/Design/Edit/Tabs.php similarity index 88% rename from app/code/Magento/Adminhtml/Block/System/Design/Edit/Tabs.php rename to app/code/Magento/Backend/Block/System/Design/Edit/Tabs.php index 83a95698c72fbdd018450c84f879044254f4e044..56f07b4ea538a4f10cab8330c4771d847d888a90 100644 --- a/app/code/Magento/Adminhtml/Block/System/Design/Edit/Tabs.php +++ b/app/code/Magento/Backend/Block/System/Design/Edit/Tabs.php @@ -19,12 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Design\Edit; +namespace Magento\Backend\Block\System\Design\Edit; class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs { @@ -41,7 +41,7 @@ class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs $this->addTab('general', array( 'label' => __('General'), 'content' => $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\System\Design\Edit\Tab\General')->toHtml(), + ->createBlock('Magento\Backend\Block\System\Design\Edit\Tab\General')->toHtml(), )); return parent::_prepareLayout(); diff --git a/app/code/Magento/Adminhtml/Block/System/Email/Template.php b/app/code/Magento/Backend/Block/System/Email/Template.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/System/Email/Template.php rename to app/code/Magento/Backend/Block/System/Email/Template.php index 944913eaf2d2c25c999096f6552580f5c61cfb6b..e8e00e46f57a555831fb799cbc1db27396dc2b4d 100644 --- a/app/code/Magento/Adminhtml/Block/System/Email/Template.php +++ b/app/code/Magento/Backend/Block/System/Email/Template.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,16 +28,16 @@ * Adminhtml system templates page content block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Email; +namespace Magento\Backend\Block\System\Email; class Template extends \Magento\Adminhtml\Block\Template { - protected $_template = 'system/email/template/list.phtml'; + protected $_template = 'Magento_Backend::system/email/template/list.phtml'; /** * Create add button and grid blocks diff --git a/app/code/Magento/Adminhtml/Block/System/Email/Template/Edit.php b/app/code/Magento/Backend/Block/System/Email/Template/Edit.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/System/Email/Template/Edit.php rename to app/code/Magento/Backend/Block/System/Email/Template/Edit.php index d1cd8171a56f8c999d52d31e89b62de543111431..337fe6274d0179f240eda3955b454a068d908347 100644 --- a/app/code/Magento/Adminhtml/Block/System/Email/Template/Edit.php +++ b/app/code/Magento/Backend/Block/System/Email/Template/Edit.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml system template edit block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> * @method array getTemplateOptions() */ -namespace Magento\Adminhtml\Block\System\Email\Template; +namespace Magento\Backend\Block\System\Email\Template; class Edit extends \Magento\Adminhtml\Block\Widget { @@ -61,7 +61,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget * * @var string */ - protected $_template = 'system/email/template/edit.phtml'; + protected $_template = 'Magento_Backend::system/email/template/edit.phtml'; /** * @param \Magento\Core\Helper\Data $coreData @@ -189,14 +189,14 @@ class Edit extends \Magento\Adminhtml\Block\Widget ) ); - $this->addChild('form', 'Magento\Adminhtml\Block\System\Email\Template\Edit\Form'); + $this->addChild('form', 'Magento\Backend\Block\System\Email\Template\Edit\Form'); return parent::_prepareLayout(); } /** * Collect, sort and set template options * - * @return \Magento\Adminhtml\Block\System\Email\Template\Edit + * @return \Magento\Backend\Block\System\Email\Template\Edit */ protected function _beforeToHtml() { @@ -372,7 +372,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget */ public function getUsedDefaultForPaths($asJSON = true) { - /** @var $template \Magento\Adminhtml\Model\Email\Template */ + /** @var $template \Magento\Backend\Model\Email\Template */ $template = $this->getEmailTemplate(); $paths = $template->getSystemConfigPathsWhereUsedAsDefault(); $pathsParts = $this->_getSystemConfigPathsParts($paths); @@ -390,7 +390,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget */ public function getUsedCurrentlyForPaths($asJSON = true) { - /** @var $template \Magento\Adminhtml\Model\Email\Template */ + /** @var $template \Magento\Backend\Model\Email\Template */ $template = $this->getEmailTemplate(); $paths = $template->getSystemConfigPathsWhereUsedCurrently(); $pathsParts = $this->_getSystemConfigPathsParts($paths); diff --git a/app/code/Magento/Adminhtml/Block/System/Email/Template/Edit/Form.php b/app/code/Magento/Backend/Block/System/Email/Template/Edit/Form.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/System/Email/Template/Edit/Form.php rename to app/code/Magento/Backend/Block/System/Email/Template/Edit/Form.php index 7916596053f906fd950cd592f943787dfdd73b86..6e0004524a88989e6728ed006e5adf561c8ba57f 100644 --- a/app/code/Magento/Adminhtml/Block/System/Email/Template/Edit/Form.php +++ b/app/code/Magento/Backend/Block/System/Email/Template/Edit/Form.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml system template edit form */ -namespace Magento\Adminhtml\Block\System\Email\Template\Edit; +namespace Magento\Backend\Block\System\Email\Template\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { @@ -52,7 +52,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Core\Model\Source\Email\Variables $variables * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -62,7 +62,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Core\Model\Source\Email\Variables $variables, \Magento\Backend\Model\Session $backendSession, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -77,7 +77,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * Prepare layout. * Add files to use dialog windows * - * @return \Magento\Adminhtml\Block\System\Email\Template\Edit\Form + * @return \Magento\Backend\Block\System\Email\Template\Edit\Form */ protected function _prepareLayout() { @@ -107,7 +107,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic 'magento-adminhtml-variables-js', 'Magento\Page\Block\Html\Head\Script', array( - 'file' => 'Magento_Adminhtml::variables.js' + 'file' => 'Magento_Backend::variables.js' ) ); } diff --git a/app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php b/app/code/Magento/Backend/Block/System/Email/Template/Grid/Filter/Type.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php rename to app/code/Magento/Backend/Block/System/Email/Template/Grid/Filter/Type.php index e4d85ffdf7264057608e60751c19bb900bcc8f2c..b178130deb949092ad03761d4ab1c187cf605b30 100644 --- a/app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php +++ b/app/code/Magento/Backend/Block/System/Email/Template/Grid/Filter/Type.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml system template grid type filter * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Email\Template\Grid\Filter; +namespace Magento\Backend\Block\System\Email\Template\Grid\Filter; class Type extends \Magento\Adminhtml\Block\Widget\Grid\Column\Filter\Select diff --git a/app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php b/app/code/Magento/Backend/Block/System/Email/Template/Grid/Renderer/Action.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php rename to app/code/Magento/Backend/Block/System/Email/Template/Grid/Renderer/Action.php index 55ff7edcd49eb7d8b657f2bc4847f4602acc5013..2c1f2f54a505269f70230588d9b6b20e3b1a011c 100644 --- a/app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php +++ b/app/code/Magento/Backend/Block/System/Email/Template/Grid/Renderer/Action.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml newsletter templates grid block action item renderer * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Email\Template\Grid\Renderer; +namespace Magento\Backend\Block\System\Email\Template\Grid\Renderer; class Action extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Action { diff --git a/app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php b/app/code/Magento/Backend/Block/System/Email/Template/Grid/Renderer/Sender.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php rename to app/code/Magento/Backend/Block/System/Email/Template/Grid/Renderer/Sender.php index fd2181e37c80d03e77f3942f07df04dff209a386..0dda95acf89a39645e4fb35a287f659aad035019 100644 --- a/app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php +++ b/app/code/Magento/Backend/Block/System/Email/Template/Grid/Renderer/Sender.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml system templates grid block sender item renderer * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Email\Template\Grid\Renderer; +namespace Magento\Backend\Block\System\Email\Template\Grid\Renderer; class Sender extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer { diff --git a/app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php b/app/code/Magento/Backend/Block/System/Email/Template/Grid/Renderer/Type.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php rename to app/code/Magento/Backend/Block/System/Email/Template/Grid/Renderer/Type.php index 8ad515bef13704f911ac272abfaffc50b7c7037a..367b713ee68a125c386275e2f367ab2526440712 100644 --- a/app/code/Magento/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php +++ b/app/code/Magento/Backend/Block/System/Email/Template/Grid/Renderer/Type.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml system templates grid block type item renderer * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Email\Template\Grid\Renderer; +namespace Magento\Backend\Block\System\Email\Template\Grid\Renderer; class Type extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer diff --git a/app/code/Magento/Adminhtml/Block/System/Email/Template/Preview.php b/app/code/Magento/Backend/Block/System/Email/Template/Preview.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/System/Email/Template/Preview.php rename to app/code/Magento/Backend/Block/System/Email/Template/Preview.php index 0c33516e90e5bf8dccee83508a2b9954d8f03210..3378f8e3a08f2c31485e8a4c526d601aaa4cae2a 100644 --- a/app/code/Magento/Adminhtml/Block/System/Email/Template/Preview.php +++ b/app/code/Magento/Backend/Block/System/Email/Template/Preview.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml system template preview block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Email\Template; +namespace Magento\Backend\Block\System\Email\Template; class Preview extends \Magento\Adminhtml\Block\Widget { diff --git a/app/code/Magento/Adminhtml/Block/System/Shipping/Ups.php b/app/code/Magento/Backend/Block/System/Shipping/Ups.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/System/Shipping/Ups.php rename to app/code/Magento/Backend/Block/System/Shipping/Ups.php index 1a47a04662c2afda9b4d26e4b869a0f402c130ee..17d4f85f6992ea33f2ab97d6beaab12559a2e2c7 100644 --- a/app/code/Magento/Adminhtml/Block/System/Shipping/Ups.php +++ b/app/code/Magento/Backend/Block/System/Shipping/Ups.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +27,7 @@ /** * Adminhtml shipping UPS content block */ -namespace Magento\Adminhtml\Block\System\Shipping; +namespace Magento\Backend\Block\System\Shipping; class Ups extends \Magento\Backend\Block\Template { diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Delete.php b/app/code/Magento/Backend/Block/System/Store/Delete.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/System/Store/Delete.php rename to app/code/Magento/Backend/Block/System/Store/Delete.php index bb02681babfda0ca9319b03e752c1d5ae378cf4b..536d7de13c59f593e63f500e1137ccaa1df5f308 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Delete.php +++ b/app/code/Magento/Backend/Block/System/Store/Delete.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Store / store view / website delete form container * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store; +namespace Magento\Backend\Block\System\Store; class Delete extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -45,6 +45,7 @@ class Delete extends \Magento\Adminhtml\Block\Widget\Form\Container { $this->_objectId = 'item_id'; $this->_mode = 'delete'; + $this->_blockGroup = 'Magento_Backend'; $this->_controller = 'system_store'; parent::_construct(); @@ -82,7 +83,7 @@ class Delete extends \Magento\Adminhtml\Block\Widget\Form\Container * Set store type title * * @param string $title - * @return \Magento\Adminhtml\Block\System\Store\Delete + * @return \Magento\Backend\Block\System\Store\Delete */ public function setStoreTypeTitle($title) { @@ -94,7 +95,7 @@ class Delete extends \Magento\Adminhtml\Block\Widget\Form\Container * Set back URL for "Cancel" and "Back" buttons * * @param string $url - * @return \Magento\Adminhtml\Block\System\Store\Delete + * @return \Magento\Backend\Block\System\Store\Delete */ public function setBackUrl($url) { diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Delete/Form.php b/app/code/Magento/Backend/Block/System/Store/Delete/Form.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/System/Store/Delete/Form.php rename to app/code/Magento/Backend/Block/System/Store/Delete/Form.php index cc155554249e8554c8935fb2512025318ed79fcc..24afcf4cd7a508eee2c5b2dcf0f0f6225ffbaee1 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Delete/Form.php +++ b/app/code/Magento/Backend/Block/System/Store/Delete/Form.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Adminhtml cms block edit form * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store\Delete; +namespace Magento\Backend\Block\System\Store\Delete; class Form extends \Magento\Backend\Block\Widget\Form\Generic { diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Delete/Group.php b/app/code/Magento/Backend/Block/System/Store/Delete/Group.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/System/Store/Delete/Group.php rename to app/code/Magento/Backend/Block/System/Store/Delete/Group.php index 3c9bf889bca742b4f594062420b82f15b552db67..35f0a61524f6266f7061ac8aa97f5ebdc1f20767 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Delete/Group.php +++ b/app/code/Magento/Backend/Block/System/Store/Delete/Group.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml store delete group block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store\Delete; +namespace Magento\Backend\Block\System\Store\Delete; class Group extends \Magento\Adminhtml\Block\Template { diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Delete/Website.php b/app/code/Magento/Backend/Block/System/Store/Delete/Website.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/System/Store/Delete/Website.php rename to app/code/Magento/Backend/Block/System/Store/Delete/Website.php index e3a36bf3237c986132b16e17ea83a8e1cc13b637..6ece68ecb706f6d6ff5e82683e6f6d0b3342ffa1 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Delete/Website.php +++ b/app/code/Magento/Backend/Block/System/Store/Delete/Website.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml store delete group block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store\Delete; +namespace Magento\Backend\Block\System\Store\Delete; class Website extends \Magento\Adminhtml\Block\Template { diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Edit.php b/app/code/Magento/Backend/Block/System/Store/Edit.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/System/Store/Edit.php rename to app/code/Magento/Backend/Block/System/Store/Edit.php index dde44d3340ffca382f1ce6c246a2121fcfb43328..c46b8beaf388105abfd16274b62c0a791dd24a81 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Edit.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Adminhtml store edit */ -namespace Magento\Adminhtml\Block\System\Store; +namespace Magento\Backend\Block\System\Store; class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -94,6 +94,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container $deleteLabel = ''; $deleteUrl = ''; } + $this->_blockGroup = 'Magento_Backend'; $this->_controller = 'system_store'; parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Edit/AbstractForm.php b/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/System/Store/Edit/AbstractForm.php rename to app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php index 868357a09aca8d279558476294125da8ca543c70..c2b29edc020d0235f548e1fbdc0d62634868591a 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Edit/AbstractForm.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php @@ -19,18 +19,18 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Store\Edit; +namespace Magento\Backend\Block\System\Store\Edit; /** * Adminhtml store edit form * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> * * @SuppressWarnings(PHPMD.DepthOfInheritance) diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Edit/Form/Group.php b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/System/Store/Edit/Form/Group.php rename to app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php index 2168448b55e17680ee3286b036d38eda222d3699..ad1392b7b5d0883debc9cf7c70dbfee6e1ba37c7 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Edit/Form/Group.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,16 +28,16 @@ * Adminhtml store edit form for group * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store\Edit\Form; +namespace Magento\Backend\Block\System\Store\Edit\Form; /** * @SuppressWarnings(PHPMD.DepthOfInheritance) */ class Group - extends \Magento\Adminhtml\Block\System\Store\Edit\AbstractForm + extends \Magento\Backend\Block\System\Store\Edit\AbstractForm { /** * @var \Magento\Catalog\Model\Config\Source\Category @@ -59,7 +59,7 @@ class Group * @param \Magento\Core\Model\StoreFactory $storeFactory * @param \Magento\Core\Model\Website\Factory $websiteFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -69,7 +69,7 @@ class Group \Magento\Core\Model\StoreFactory $storeFactory, \Magento\Core\Model\Website\Factory $websiteFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Edit/Form/Store.php b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/System/Store/Edit/Form/Store.php rename to app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php index 4cf3d84952c7c17f7c71cf46b2825364ba9729c4..fa9b3af8a5b3689ef0f798f5b48a3f88a5cd8dcf 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Edit/Form/Store.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,16 +28,16 @@ * Adminhtml store edit form for store * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store\Edit\Form; +namespace Magento\Backend\Block\System\Store\Edit\Form; /** * @SuppressWarnings(PHPMD.DepthOfInheritance) */ class Store - extends \Magento\Adminhtml\Block\System\Store\Edit\AbstractForm + extends \Magento\Backend\Block\System\Store\Edit\AbstractForm { /** * @var \Magento\Core\Model\Website\Factory @@ -53,7 +53,7 @@ class Store * @param \Magento\Core\Model\Store\Group\Factory $groupFactory * @param \Magento\Core\Model\Website\Factory $websiteFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -62,7 +62,7 @@ class Store \Magento\Core\Model\Store\Group\Factory $groupFactory, \Magento\Core\Model\Website\Factory $websiteFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Edit/Form/Website.php b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/System/Store/Edit/Form/Website.php rename to app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php index b8bdc4b0a8000ce2eaa9485034f00a4ec05144e0..45fa7e16811639d6114fade65c5ef31be84c3cf5 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Edit/Form/Website.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,16 +28,16 @@ * Adminhtml store edit form for website * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store\Edit\Form; +namespace Magento\Backend\Block\System\Store\Edit\Form; /** * @SuppressWarnings(PHPMD.DepthOfInheritance) */ class Website - extends \Magento\Adminhtml\Block\System\Store\Edit\AbstractForm + extends \Magento\Backend\Block\System\Store\Edit\AbstractForm { /** * @var \Magento\Core\Model\Store\GroupFactory @@ -47,7 +47,7 @@ class Website /** * @param \Magento\Core\Model\Store\GroupFactory $groupFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -55,7 +55,7 @@ class Website public function __construct( \Magento\Core\Model\Store\GroupFactory $groupFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Grid/Render/Group.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/System/Store/Grid/Render/Group.php rename to app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php index f5a4b8b06d07d87502878a3c9ffb47b794547ef8..346df9d58ce92e253cca2a28105dc33430de4837 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Grid/Render/Group.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Store render group * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store\Grid\Render; +namespace Magento\Backend\Block\System\Store\Grid\Render; class Group extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Grid/Render/Store.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/System/Store/Grid/Render/Store.php rename to app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php index bb95effa01a49e4836d3de34ea822e5d7445f9bb..68f82bae201a1ef9a2f7613e1f5b2f24cf835599 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Grid/Render/Store.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Store render store * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store\Grid\Render; +namespace Magento\Backend\Block\System\Store\Grid\Render; class Store extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Grid/Render/Website.php b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/System/Store/Grid/Render/Website.php rename to app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php index ca6ddc77fb9d67c67dad9d9d714f44c5fda202aa..ffacc3a6d2e1f0430875c1499f268b89882fb4d4 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Grid/Render/Website.php +++ b/app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Store render website * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store\Grid\Render; +namespace Magento\Backend\Block\System\Store\Grid\Render; class Website extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer diff --git a/app/code/Magento/Adminhtml/Block/System/Store/Store.php b/app/code/Magento/Backend/Block/System/Store/Store.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/System/Store/Store.php rename to app/code/Magento/Backend/Block/System/Store/Store.php index 5358ead9a6f738868d194141b54e1599f6fde6aa..e629cf44ba284fb24f96b2467dffc21deb6062ee 100644 --- a/app/code/Magento/Adminhtml/Block/System/Store/Store.php +++ b/app/code/Magento/Backend/Block/System/Store/Store.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml store content block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Store; +namespace Magento\Backend\Block\System\Store; class Store extends \Magento\Backend\Block\Widget\Grid\Container { @@ -43,6 +43,7 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Container protected function _construct() { + $this->_blockGroup = 'Magento_Backend'; $this->_controller = 'system_store'; $this->_headerText = __('Stores'); parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/System/Variable.php b/app/code/Magento/Backend/Block/System/Variable.php similarity index 90% rename from app/code/Magento/Adminhtml/Block/System/Variable.php rename to app/code/Magento/Backend/Block/System/Variable.php index ccec4c604b68291112777655470d24ec4261cbe6..3218f18310debf185f0ec2e549397c6a191a0578 100644 --- a/app/code/Magento/Adminhtml/Block/System/Variable.php +++ b/app/code/Magento/Backend/Block/System/Variable.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Custom Varieble Block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System; +namespace Magento\Backend\Block\System; class Variable extends \Magento\Adminhtml\Block\Widget\Grid\Container { @@ -41,6 +41,7 @@ class Variable extends \Magento\Adminhtml\Block\Widget\Grid\Container */ protected function _construct() { + $this->_blockGroup = 'Magento_Backend'; $this->_controller = 'system_variable'; $this->_headerText = __('Custom Variables'); parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/System/Variable/Edit.php b/app/code/Magento/Backend/Block/System/Variable/Edit.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/System/Variable/Edit.php rename to app/code/Magento/Backend/Block/System/Variable/Edit.php index 42a702ee9c5a0c3e0ba88def4bc4ae7b6d48f080..70e9d49104509ab7b14b05f8f07711cda0ac341c 100644 --- a/app/code/Magento/Adminhtml/Block/System/Variable/Edit.php +++ b/app/code/Magento/Backend/Block/System/Variable/Edit.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +27,7 @@ /** * Custom Variable Edit Container */ -namespace Magento\Adminhtml\Block\System\Variable; +namespace Magento\Backend\Block\System\Variable; class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -61,6 +61,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container protected function _construct() { $this->_objectId = 'variable_id'; + $this->_blockGroup = 'Magento_Backend'; $this->_controller = 'system_variable'; parent::_construct(); @@ -80,7 +81,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container * Prepare layout. * Adding save_and_continue button * - * @return \Magento\Adminhtml\Block\System\Variable\Edit + * @return \Magento\Backend\Block\System\Variable\Edit */ protected function _preparelayout() { diff --git a/app/code/Magento/Adminhtml/Block/System/Variable/Edit/Form.php b/app/code/Magento/Backend/Block/System/Variable/Edit/Form.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/System/Variable/Edit/Form.php rename to app/code/Magento/Backend/Block/System/Variable/Edit/Form.php index a323441b6be046aa33bfe61db3e007c90be7e619..418f10eadd8354186a80323b5b512ede8badceac 100644 --- a/app/code/Magento/Adminhtml/Block/System/Variable/Edit/Form.php +++ b/app/code/Magento/Backend/Block/System/Variable/Edit/Form.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Custom Variable Edit Form * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\System\Variable\Edit; +namespace Magento\Backend\Block\System\Variable\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { @@ -48,7 +48,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Prepare form before rendering HTML * - * @return \Magento\Adminhtml\Block\System\Variable\Edit\Form + * @return \Magento\Backend\Block\System\Variable\Edit\Form */ protected function _prepareForm() { diff --git a/app/code/Magento/Backend/Block/Template.php b/app/code/Magento/Backend/Block/Template.php index 7cfaeb27f28d7932877c239652ef69909e8d89d5..aff926903f8c79a410f61bef52fb6f833fcdf6e6 100644 --- a/app/code/Magento/Backend/Block/Template.php +++ b/app/code/Magento/Backend/Block/Template.php @@ -48,6 +48,11 @@ class Template extends \Magento\Core\Block\Template */ protected $_locale; + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context @@ -61,6 +66,7 @@ class Template extends \Magento\Core\Block\Template $this->_storeManager = $context->getStoreManager(); $this->_locale = $context->getLocale(); $this->_authorization = $context->getAuthorization(); + $this->mathRandom = $context->getMathRandom(); parent::__construct($coreData, $context, $data); } diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index eaf911dcd52d08492247f54e97ec8a119d8a59c8..4f15d4831ee77d6b0b95d20d7b9b8cd6d8e2f9b6 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -45,6 +45,11 @@ class Context extends \Magento\Core\Block\Template\Context */ protected $_storeManager; + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + /** * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\App\RequestInterface $request @@ -52,7 +57,7 @@ class Context extends \Magento\Core\Block\Template\Context * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Core\Model\Translate $translator - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\View\DesignInterface $design * @param \Magento\Core\Model\Session $session * @param \Magento\Core\Model\Store\Config $storeConfig @@ -62,15 +67,19 @@ class Context extends \Magento\Core\Block\Template\Context * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\Core\Model\Cache\StateInterface $cacheState * @param \Magento\App\Dir $dirs - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEngineFactory $engineFactory * @param \Magento\AuthorizationInterface $authorization * @param \Magento\Core\Model\App $app + * @param \Magento\App\State $appState + * @param \Magento\Escaper $escaper + * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Core\Model\LocaleInterface $locale - * + * @param \Magento\Math\Random $mathRandom + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -80,7 +89,7 @@ class Context extends \Magento\Core\Block\Template\Context \Magento\Event\ManagerInterface $eventManager, \Magento\UrlInterface $urlBuilder, \Magento\Core\Model\Translate $translator, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\View\DesignInterface $design, \Magento\Core\Model\Session $session, \Magento\Core\Model\Store\Config $storeConfig, @@ -90,24 +99,49 @@ class Context extends \Magento\Core\Block\Template\Context \Magento\View\ConfigInterface $viewConfig, \Magento\Core\Model\Cache\StateInterface $cacheState, \Magento\App\Dir $dirs, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Filesystem $filesystem, \Magento\Core\Model\View\FileSystem $viewFileSystem, \Magento\View\TemplateEngineFactory $engineFactory, \Magento\AuthorizationInterface $authorization, \Magento\Core\Model\App $app, + \Magento\App\State $appState, + \Magento\Escaper $escaper, + \Magento\Filter\FilterManager $filterManager, \Magento\Backend\Model\Session $backendSession, - \Magento\Core\Model\LocaleInterface $locale + \Magento\Core\Model\LocaleInterface $locale, + \Magento\Math\Random $mathRandom ) { parent::__construct( - $request, $layout, $eventManager, $urlBuilder, $translator, $cache, $design, $session, $storeConfig, - $frontController, $helperFactory, $viewUrl, $viewConfig, $cacheState, - $dirs, $logger, $filesystem, $viewFileSystem, $engineFactory, $app + $request, + $layout, + $eventManager, + $urlBuilder, + $translator, + $cache, + $design, + $session, + $storeConfig, + $frontController, + $helperFactory, + $viewUrl, + $viewConfig, + $cacheState, + $dirs, + $logger, + $filesystem, + $viewFileSystem, + $engineFactory, + $app, + $appState, + $escaper, + $filterManager ); $this->_storeManager = $storeManager; $this->_authorization = $authorization; $this->_backendSession = $backendSession; $this->_locale = $locale; + $this->mathRandom = $mathRandom; } /** @@ -145,4 +179,12 @@ class Context extends \Magento\Core\Block\Template\Context { return $this->_locale; } + + /** + * @return \Magento\Math\Random + */ + public function getMathRandom() + { + return $this->mathRandom; + } } diff --git a/app/code/Magento/Backend/Block/Widget.php b/app/code/Magento/Backend/Block/Widget.php index 9f4ba7952c9ab7ff923128a251c114bdba01a787..db86f7d1957eb3a65adf3b11ce151fccd94b831e 100644 --- a/app/code/Magento/Backend/Block/Widget.php +++ b/app/code/Magento/Backend/Block/Widget.php @@ -42,8 +42,7 @@ class Widget extends \Magento\Backend\Block\Template public function getId() { if (null === $this->getData('id')) { - $helper = $this->helper('Magento\Core\Helper\Data'); - $this->setData('id', $helper->uniqHash('id_')); + $this->setData('id', $this->mathRandom->getUniqueHash('id_')); } return $this->getData('id'); } diff --git a/app/code/Magento/Backend/Block/Widget/Button.php b/app/code/Magento/Backend/Block/Widget/Button.php index 9b487fd606ac81a5786f46e928e580e82f75cd0a..bcb67e4605121c90298b4e28fce9384876949caa 100644 --- a/app/code/Magento/Backend/Block/Widget/Button.php +++ b/app/code/Magento/Backend/Block/Widget/Button.php @@ -137,7 +137,7 @@ class Button extends \Magento\Backend\Block\Widget continue; } $html .= $attributeKey . '="' - . $this->helper('Magento\Backend\Helper\Data')->escapeHtml($attributeValue) . '" '; + . $this->escapeHtml($attributeValue) . '" '; } return $html; diff --git a/app/code/Magento/Backend/Block/Widget/Button/SplitButton.php b/app/code/Magento/Backend/Block/Widget/Button/SplitButton.php index 41e78317b5faaf9dc288c00672df0523fff0f0da..1b9d5f9ecac0798a3fc53030b4e466a54e0270a8 100644 --- a/app/code/Magento/Backend/Block/Widget/Button/SplitButton.php +++ b/app/code/Magento/Backend/Block/Widget/Button/SplitButton.php @@ -250,15 +250,12 @@ class SplitButton extends \Magento\Backend\Block\Widget */ protected function _getAttributesString($attributes) { - /** @var $helper \Magento\Backend\Helper\Data */ - $helper = $this->helper('Magento\Backend\Helper\Data'); - $html = array(); foreach ($attributes as $attributeKey => $attributeValue) { if ($attributeValue === null || $attributeValue == '') { continue; } - $html[] = $attributeKey . '="' . $helper->escapeHtml($attributeValue) . '"'; + $html[] = $attributeKey . '="' . $this->escapeHtml($attributeValue) . '"'; } return join(' ', $html); } diff --git a/app/code/Magento/Backend/Block/Widget/Form/Container.php b/app/code/Magento/Backend/Block/Widget/Form/Container.php index b7f113228a850645411e574818779fcf28a691ae..ec3aa2de9429253ad15c28b184335087a3109447 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Container.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Container.php @@ -103,10 +103,13 @@ class Container extends \Magento\Backend\Block\Widget\Container */ protected function _buildFormClassName() { - return ucwords(str_replace('_', '\\', $this->_blockGroup)) - . '\\Block\\' - . str_replace('_', '\\', uc_words(str_replace('_', ' ', $this->_controller) . '\\' . uc_words($this->_mode))) - . '\\Form'; + return \Magento\Core\Helper\String::buildClassName(array( + $this->_blockGroup, + 'Block', + $this->_controller, + $this->_mode, + 'Form' + )); } /** @@ -145,7 +148,7 @@ class Container extends \Magento\Backend\Block\Widget\Container if ($this->hasFormActionUrl()) { return $this->getData('form_action_url'); } - return $this->getUrl('*/' . $this->_controller . '/save'); + return $this->getUrl('*/*/save'); } public function getFormHtml() diff --git a/app/code/Magento/Backend/Block/Widget/Form/Generic.php b/app/code/Magento/Backend/Block/Widget/Form/Generic.php index aa038ba7bbbd3ec146d27672cd0089b4845b38b2..8cee1231e12d9ea4723696c24f330dbf35f37058 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Generic.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Generic.php @@ -36,7 +36,7 @@ namespace Magento\Backend\Block\Widget\Form; class Generic extends \Magento\Backend\Block\Widget\Form { /** - * @var \Magento\Data\Form\Factory + * @var \Magento\Data\FormFactory */ protected $_formFactory; @@ -49,14 +49,14 @@ class Generic extends \Magento\Backend\Block\Widget\Form /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Backend/Block/Widget/Grid.php b/app/code/Magento/Backend/Block/Widget/Grid.php index e538afc87016c1084b46751abbfa502514134aa5..582288bc39838b695f5712e5d397b0e7b785cf86 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid.php +++ b/app/code/Magento/Backend/Block/Widget/Grid.php @@ -674,22 +674,6 @@ class Grid extends \Magento\Backend\Block\Widget return empty($this->_rssLists) ? false : $this->_rssLists; } - /** - * Returns url for RSS - * Can be overloaded in descendant classes to perform custom changes to url passed to addRssList() - * - * @param string $url - * @return string - */ - protected function _getRssUrl($url) - { - if ($this->_storeManager->getStore()->isUseStoreInUrl()) { - // Url in 'admin' store view won't be accessible, so form it in default store view frontend - $this->_urlModel->setStore($this->_storeManager->getDefaultStoreView()); - } - return $this->_urlModel->getUrl($url); - } - /** * Add new rss list to grid * @@ -701,7 +685,7 @@ class Grid extends \Magento\Backend\Block\Widget { $this->_rssLists[] = new \Magento\Object( array( - 'url' => $this->_getRssUrl($url), + 'url' => $this->getUrl($url, array('_nosecret' => true)), 'label' => $label ) ); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php index a406093604dbe3b0fd8a2b54cd8de8c8b9244541..016098c1020dad7674980739f21c9c9fccad6582 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php @@ -38,28 +38,26 @@ class Date protected $_locale; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Math\Random */ - protected $_coreData; + protected $mathRandom; /** - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\Resource\Helper $resourceHelper * @param \Magento\Backend\Block\Context $context * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\Math\Random $mathRandom * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\Resource\Helper $resourceHelper, \Magento\Backend\Block\Context $context, \Magento\Core\Model\LocaleInterface $locale, + \Magento\Math\Random $mathRandom, array $data = array() ) { - $this->_coreData = $coreData; $this->_locale = $locale; + $this->mathRandom = $mathRandom; parent::__construct($context, $resourceHelper, $data); } @@ -73,7 +71,7 @@ class Date public function getHtml() { - $htmlId = $this->_coreData->uniqHash($this->_getHtmlId()); + $htmlId = $this->mathRandom->getUniqueHash($this->_getHtmlId()); $format = $this->getLocale()->getDateFormat(\Magento\Core\Model\LocaleInterface::FORMAT_TYPE_SHORT); $html = '<div class="range" id="' . $htmlId . '_range"><div class="range-line date">' . '<input type="text" name="' . $this->_getHtmlName() . '[from]" id="' . $htmlId . '_from"' diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php index a448409c2ae390a1c518a434c64c8d6bb964d236..4efdf791c679720568ac230cc4fdb89508028054 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php @@ -110,7 +110,7 @@ class Datetime */ public function getHtml() { - $htmlId = $this->_coreData->uniqHash($this->_getHtmlId()); + $htmlId = $this->mathRandom->getUniqueHash($this->_getHtmlId()); $format = $this->getLocale()->getDateFormat(\Magento\Core\Model\LocaleInterface::FORMAT_TYPE_SHORT); $timeFormat = ''; diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Date.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Date.php index 332b1be94c44da0d8f0fd8681810ebd746c9b477..a28975c7375d52acd4e388b045cbb1fa77f20d6c 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Date.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Date.php @@ -93,7 +93,7 @@ class Date $format = $this->_getFormat(); try { if ($this->getColumn()->getGmtoffset()) { - $data = $this->_locale->date($data, \Magento\Date::DATETIME_INTERNAL_FORMAT)->toString($format); + $data = $this->_locale->date($data, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)->toString($format); } else { $data = $this->_locale->date($data, \Zend_Date::ISO_8601, null, false)->toString($format); } @@ -101,7 +101,7 @@ class Date catch (\Exception $e) { if ($this->getColumn()->getTimezone()) { - $data = $this->_locale->date($data, \Magento\Date::DATETIME_INTERNAL_FORMAT)->toString($format); + $data = $this->_locale->date($data, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)->toString($format); } else { $data = $this->_locale->date($data, null, null, false)->toString($format); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Datetime.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Datetime.php index 1576115932a75d5a1a884bb63f1345cd5d568c5b..6eb6c5bf23e6d8f47e82b97463d1dae3fcae7945 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Datetime.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Datetime.php @@ -91,11 +91,11 @@ class Datetime if ($data = $this->_getValue($row)) { $format = $this->_getFormat(); try { - $data = $this->_locale->date($data, \Magento\Date::DATETIME_INTERNAL_FORMAT)->toString($format); + $data = $this->_locale->date($data, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)->toString($format); } catch (\Exception $e) { - $data = $this->_locale->date($data, \Magento\Date::DATETIME_INTERNAL_FORMAT)->toString($format); + $data = $this->_locale->date($data, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)->toString($format); } return $data; } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Longtext.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Longtext.php index 855607b8a36449e98187c72fa75c4f2d319ed944..f1521180522d5bf3ee7d736f6829a16d7a4a75e6 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Longtext.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Longtext.php @@ -24,36 +24,31 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Backend\Block\Widget\Grid\Column\Renderer; + /** * Backend Grid Renderer - * - * @category Magento - * @package Magento_Backend - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Backend\Block\Widget\Grid\Column\Renderer; - -class Longtext - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Longtext extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * Core string * - * @var \Magento\Core\Helper\String + * @var \Magento\Filter\FilterManager */ - protected $_coreString = null; + protected $filter; /** - * @param \Magento\Core\Helper\String $coreString * @param \Magento\Backend\Block\Context $context + * @param \Magento\Filter\FilterManager $filter * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Backend\Block\Context $context, + \Magento\Filter\FilterManager $filter, array $data = array() ) { - $this->_coreString = $coreString; + $this->filter = $filter; parent::__construct($context, $data); } @@ -76,7 +71,7 @@ class Longtext if ($this->getColumn()->getTruncate()) { $truncateLength = $this->getColumn()->getTruncate(); } - $text = $this->_coreString->truncate(parent::_getValue($row), $truncateLength); + $text = $this->filter->truncate(parent::_getValue($row), array('length' => $truncateLength)); if ($this->getColumn()->getEscape()) { $text = $this->escapeHtml($text); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Wrapline.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Wrapline.php index 8b146ac581bdb93996fcfc622542ff7d3da57256..e823978995edf2fee5fa3b07f4e8938672130e23 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Wrapline.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Wrapline.php @@ -24,17 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Backend\Block\Widget\Grid\Column\Renderer; + /** * Backend grid item renderer line to wrap - * - * @category Magento - * @package Magento_Backend - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Backend\Block\Widget\Grid\Column\Renderer; - -class Wrapline - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer +class Wrapline extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * Default max length of a line at one row @@ -44,23 +39,23 @@ class Wrapline protected $_defaultMaxLineLength = 60; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * @param \Magento\Core\Helper\String $coreString * @param \Magento\Backend\Block\Context $context + * @param \Magento\Stdlib\String $string * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Backend\Block\Context $context, + \Magento\Stdlib\String $string, array $data = array() ) { - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($context, $data); } @@ -77,8 +72,8 @@ class Wrapline $lineLength = $this->getColumn()->getData('lineLength') ? $this->getColumn()->getData('lineLength') : $this->_defaultMaxLineLength; - for ($i = 0, $n = floor($this->_coreString->strlen($line) / $lineLength); $i <= $n; $i++) { - $wrappedLine .= $this->_coreString->substr($line, ($lineLength * $i), $lineLength) + for ($i = 0, $n = floor($this->string->strlen($line) / $lineLength); $i <= $n; $i++) { + $wrappedLine .= $this->string->substr($line, ($lineLength * $i), $lineLength) . "<br />"; } return $wrappedLine; diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index d2e8a1c7c2595305c239ce06a83ed02f494f0f3f..88c70aad1f0c21d6d60adc78855bc8fc1ad9de19 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -57,8 +57,7 @@ abstract class AbstractMassaction extends \Magento\Backend\Block\Widget { parent::_construct(); - $this->setErrorText($this->helper('Magento\Backend\Helper\Data') - ->jsQuoteEscape(__('Please select items.'))); + $this->escapeJsQuote(__('Please select items.')); if (null !== $this->getOptions()) { foreach ($this->getOptions() as $optionId => $option) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php index 5855972ee9b21167783a5a2790ff7b3c2e173d3f..69ccd8cb84927a9698b4dc7bb3d2e841eaea246e 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php @@ -46,7 +46,7 @@ class Additional extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Layout\Argument\HandlerFactory $handlerFactory @@ -54,7 +54,7 @@ class Additional extends \Magento\Backend\Block\Widget\Form\Generic */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Layout\Argument\HandlerFactory $handlerFactory, diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php index 87b65c23ce0b63cee398c9396ac9c196eea5e1a9..9d439f94933f517c21357c2d7a54e6ad29835af8 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php @@ -81,10 +81,7 @@ class Extended extends \Magento\Backend\Block\Widget public function _construct() { parent::_construct(); - $this->setErrorText( - $this->_backendData - ->jsQuoteEscape(__('Please select items.')) - ); + $this->setErrorText($this->escapeJsQuote(__('Please select items.'))); } /** diff --git a/app/code/Magento/Backend/Controller/AbstractAction.php b/app/code/Magento/Backend/Controller/AbstractAction.php index a0f745f517503d275792eec240173f2bd650d033..f5969a7cf0133903dc48ca2ed62ee6f420f13fe4 100644 --- a/app/code/Magento/Backend/Controller/AbstractAction.php +++ b/app/code/Magento/Backend/Controller/AbstractAction.php @@ -92,6 +92,11 @@ abstract class AbstractAction extends \Magento\Core\Controller\Varien\Action */ protected $_locale; + /** + * @var bool + */ + protected $_canUseBaseUrl; + /** * @param \Magento\Backend\Controller\Context $context */ @@ -105,6 +110,7 @@ abstract class AbstractAction extends \Magento\Core\Controller\Varien\Action $this->_auth = $context->getAuth(); $this->_backendUrl = $context->getBackendUrl(); $this->_locale = $context->getLocale(); + $this->_canUseBaseUrl = $context->getCanUseBaseUrl(); } protected function _isAllowed() @@ -249,7 +255,7 @@ abstract class AbstractAction extends \Magento\Core\Controller\Varien\Action return !$this->getFlag('', self::FLAG_IS_URLS_CHECKED) && !$this->getRequest()->getParam('forwarded') && !$this->_getSession()->getIsUrlNotice(true) - && !$this->_objectManager->get('Magento\Core\Model\Config')->getNode('global/can_use_base_url'); + && !$this->_canUseBaseUrl; } /** diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Action.php b/app/code/Magento/Backend/Controller/Adminhtml/Action.php index e41636898d6cec745c64b602ec5080e526ecd17c..bc612975e59101e362e24d548493bc43a82d2b31 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Action.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Action.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -31,10 +31,4 @@ namespace Magento\Backend\Controller\Adminhtml; class Action extends \Magento\Backend\Controller\AbstractAction { - /** - * Currently used area - * - * @var string - */ - protected $_currentArea = 'adminhtml'; } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php b/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php index 9e843632f74b9572d3940eaacb26e2a3de13396c..a8ff8da09e04540c72dc9bd2ba6e29c6140706ee 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend */ namespace Magento\Backend\Controller\Adminhtml; diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache.php index 7fc6334cf5b48eb7fdf5bb453ed6a4bf74d9f177..05c8ae2024a641ee533621e59f54cc07503c2f90 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard.php b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard.php index 209dd13fe79e0314a81877fc8219435f0576053a..859a2eb70bd3bc4e856a056b4d0ba36d55878da9 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Dashboard admin controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ namespace Magento\Backend\Controller\Adminhtml; @@ -79,11 +79,13 @@ class Dashboard extends \Magento\Backend\Controller\Adminhtml\Action { $output = ''; $blockTab = $this->getRequest()->getParam('block'); - $blockClassSuffix = str_replace(' ', \Magento\Autoload\IncludePath::NS_SEPARATOR, - ucwords(str_replace(\Magento\Autoload\IncludePath::NS_SEPARATOR, ' ', $blockTab))); - + $blockClassSuffix = str_replace( + ' ', + \Magento\Autoload\IncludePath::NS_SEPARATOR, + ucwords(str_replace('_', ' ', $blockTab)) + ); if (in_array($blockTab, array('tab_orders', 'tab_amounts', 'totals'))) { - $output = $this->getLayout()->createBlock('Magento\\Adminhtml\\Block\\Dashboard\\' . $blockClassSuffix) + $output = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Dashboard\\' . $blockClassSuffix) ->toHtml(); } $this->getResponse()->setBody($output); @@ -122,7 +124,7 @@ class Dashboard extends \Magento\Backend\Controller\Adminhtml\Action ->setBody($response->getBody()); return; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $error = __('see error log for details'); $httpCode = 503; } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/Index.php index e52af1e505e0fe49c8000927d709988d1a25445a..a9893978394b43826dec8a2441ce821a7e3b0c3b 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Index.php @@ -31,12 +31,30 @@ namespace Magento\Backend\Controller\Adminhtml; class Index extends \Magento\Backend\Controller\AbstractAction { + /** + * Search modules list + * + * @var array + */ + protected $_searchModules; + + /** + * @param \Magento\Backend\Controller\Context $context + * @param array $searchModules + */ + public function __construct( + \Magento\Backend\Controller\Context $context, + array $searchModules = array() + ) { + $this->_searchModules = $searchModules; + parent::__construct($context); + } + /** * Global Search Action */ public function globalSearchAction() { - $searchModules = $this->_objectManager->get('Magento\Core\Model\Config')->getNode("adminhtml/global_search"); $items = array(); if (!$this->_authorization->isAllowed('Magento_Adminhtml::global_search')) { @@ -47,7 +65,7 @@ class Index extends \Magento\Backend\Controller\AbstractAction 'description' => __('You need more permissions to do this.') ); } else { - if (empty($searchModules)) { + if (empty($this->_searchModules)) { $items[] = array( 'id' => 'error', 'type' => __('Error'), @@ -58,14 +76,13 @@ class Index extends \Magento\Backend\Controller\AbstractAction $start = $this->getRequest()->getParam('start', 1); $limit = $this->getRequest()->getParam('limit', 10); $query = $this->getRequest()->getParam('query', ''); - foreach ($searchModules->children() as $searchConfig) { + foreach ($this->_searchModules as $searchConfig) { - if ($searchConfig->acl && !$this->_authorization->isAllowed($searchConfig->acl)){ + if ($searchConfig['acl'] && !$this->_authorization->isAllowed($searchConfig['acl'])){ continue; } - $className = $searchConfig->getClassName(); - + $className = $searchConfig['class']; if (empty($className)) { continue; } diff --git a/app/code/Magento/Backend/Controller/System/AbstractConfig.php b/app/code/Magento/Backend/Controller/Adminhtml/System/AbstractConfig.php similarity index 98% rename from app/code/Magento/Backend/Controller/System/AbstractConfig.php rename to app/code/Magento/Backend/Controller/Adminhtml/System/AbstractConfig.php index fd223a110c8c75f1fb1d6704667b5f59fa53423e..b85f4cdb54b1a0331abc460a38940b876b8e8f1a 100644 --- a/app/code/Magento/Backend/Controller/System/AbstractConfig.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/AbstractConfig.php @@ -27,7 +27,7 @@ /** * System Configuration Abstract Controller */ -namespace Magento\Backend\Controller\System; +namespace Magento\Backend\Controller\Adminhtml\System; abstract class AbstractConfig extends \Magento\Backend\Controller\AbstractAction { diff --git a/app/code/Magento/Adminhtml/Controller/System/Account.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php similarity index 96% rename from app/code/Magento/Adminhtml/Controller/System/Account.php rename to app/code/Magento/Backend/Controller/Adminhtml/System/Account.php index 2dbb3514b1556d391c30900be3850bd05040b250..1a425ff8dab88709cfbb620ccdc5ff33f6bac7a1 100644 --- a/app/code/Magento/Adminhtml/Controller/System/Account.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml account controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\System; +namespace Magento\Backend\Controller\Adminhtml\System; class Account extends \Magento\Backend\Controller\Adminhtml\Action { diff --git a/app/code/Magento/Adminhtml/Controller/System/Backup.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Backup.php similarity index 96% rename from app/code/Magento/Adminhtml/Controller/System/Backup.php rename to app/code/Magento/Backend/Controller/Adminhtml/System/Backup.php index 44e7b667e8483ddc0e59a0e9897b77e9b59a5d09..d0359eaf83fe1b6d9361bb43eae30caeaf7220b0 100644 --- a/app/code/Magento/Adminhtml/Controller/System/Backup.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Backup.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Backup admin controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\System; +namespace Magento\Backend\Controller\Adminhtml\System; class Backup extends \Magento\Backend\Controller\Adminhtml\Action { @@ -157,10 +157,10 @@ class Backup extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Magento\Backup\Exception\NotEnoughFreeSpace $e) { $errorMessage = __('You need more free space to create a backup.'); } catch (\Magento\Backup\Exception\NotEnoughPermissions $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->log($e->getMessage()); + $this->_objectManager->get('Magento\Logger')->log($e->getMessage()); $errorMessage = __('You need more permissions to create a backup.'); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->log($e->getMessage()); + $this->_objectManager->get('Magento\Logger')->log($e->getMessage()); $errorMessage = __('Something went wrong creating the backup.'); } @@ -303,10 +303,10 @@ class Backup extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Magento\Backup\Exception\FtpValidationFailed $e) { $errorMsg = __('Failed to validate FTP'); } catch (\Magento\Backup\Exception\NotEnoughPermissions $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->log($e->getMessage()); + $this->_objectManager->get('Magento\Logger')->log($e->getMessage()); $errorMsg = __('You need more permissions to create a backup.'); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->log($e->getMessage()); + $this->_objectManager->get('Magento\Logger')->log($e->getMessage()); $errorMsg = __('Failed to rollback'); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php index f8ea5e8a3d790f11709c635dd8c9d8bf975b3d16..7ee8fb21bd01a03370b1d40d90bc9450c7da5368 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Controller\Adminhtml\System; -class Config extends \Magento\Backend\Controller\System\AbstractConfig +class Config extends \Magento\Backend\Controller\Adminhtml\System\AbstractConfig { /** * @var \Magento\Core\Model\StoreManagerInterface diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php index 8625ffdcbcf832f6cd9616794f677b079279642e..e2794d4d203c9431c4be35aa3009cc77282b1088 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php @@ -37,7 +37,7 @@ namespace Magento\Backend\Controller\Adminhtml\System\Config; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Save extends \Magento\Backend\Controller\System\AbstractConfig +class Save extends \Magento\Backend\Controller\Adminhtml\System\AbstractConfig { /** * Backend Config Model Factory @@ -51,21 +51,29 @@ class Save extends \Magento\Backend\Controller\System\AbstractConfig */ protected $_cache; + /** + * @var \Magento\Stdlib\String + */ + protected $string; + /** * @param \Magento\Backend\Controller\Context $context * @param \Magento\Backend\Model\Config\Structure $configStructure * @param \Magento\Backend\Model\Config\Factory $configFactory * @param \Magento\Cache\FrontendInterface $cache + * @param \Magento\Stdlib\String $string */ public function __construct( \Magento\Backend\Controller\Context $context, \Magento\Backend\Model\Config\Structure $configStructure, \Magento\Backend\Model\Config\Factory $configFactory, - \Magento\Cache\FrontendInterface $cache + \Magento\Cache\FrontendInterface $cache, + \Magento\Stdlib\String $string ) { parent::__construct($context, $configStructure); $this->_configFactory = $configFactory; $this->_cache = $cache; + $this->string = $string; } /** @@ -177,7 +185,9 @@ class Save extends \Magento\Backend\Controller\System\AbstractConfig */ protected function _saveSection() { - $method = '_save' . uc_words($this->getRequest()->getParam('section'), ''); + $method = '_save' . $this->string->upperCaseWords( + $this->getRequest()->getParam('section'), '_', '' + ); if (method_exists($this, $method)) { $this->$method(); } diff --git a/app/code/Magento/Adminhtml/Controller/System/Config/System/Storage.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php similarity index 96% rename from app/code/Magento/Adminhtml/Controller/System/Config/System/Storage.php rename to app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php index 2752ac1f3ef76c0161539b1f22852847586c2efa..74067e8c9618416f91b0066f0c6e95522af69572 100644 --- a/app/code/Magento/Adminhtml/Controller/System/Config/System/Storage.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml account controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\System\Config\System; +namespace Magento\Backend\Controller\Adminhtml\System\Config\System; class Storage extends \Magento\Backend\Controller\Adminhtml\Action { @@ -88,7 +88,7 @@ class Storage extends \Magento\Backend\Controller\Adminhtml\Action try { $this->_getSyncSingleton()->synchronize($storage); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $flag->passError($e); } @@ -139,7 +139,7 @@ class Storage extends \Magento\Backend\Controller\Adminhtml\Action if (is_array($flagData) && !(isset($flagData['timeout_reached']) && $flagData['timeout_reached']) ) { - $this->_objectManager->get('Magento\Core\Model\Logger') + $this->_objectManager->get('Magento\Logger') ->logException(new \Magento\Exception( __('The timeout limit for response from synchronize process was reached.') )); diff --git a/app/code/Magento/Adminhtml/Controller/System/Design.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php similarity index 96% rename from app/code/Magento/Adminhtml/Controller/System/Design.php rename to app/code/Magento/Backend/Controller/Adminhtml/System/Design.php index add865cab9ef562839985625cb47ba9ea260a0fb..71293d03c9529f1bb7859446ec8148a6eb70fb45 100644 --- a/app/code/Magento/Adminhtml/Controller/System/Design.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Design.php @@ -19,12 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller\System; +namespace Magento\Backend\Controller\Adminhtml\System; class Design extends \Magento\Backend\Controller\Adminhtml\Action { @@ -85,8 +85,8 @@ class Design extends \Magento\Backend\Controller\Adminhtml\Action $this->_coreRegistry->register('design', $design); - $this->_addContent($this->getLayout()->createBlock('Magento\Adminhtml\Block\System\Design\Edit')); - $this->_addLeft($this->getLayout()->createBlock('Magento\Adminhtml\Block\System\Design\Edit\Tabs', 'design_tabs')); + $this->_addContent($this->getLayout()->createBlock('Magento\Backend\Block\System\Design\Edit')); + $this->_addLeft($this->getLayout()->createBlock('Magento\Backend\Block\System\Design\Edit\Tabs', 'design_tabs')); $this->renderLayout(); } diff --git a/app/code/Magento/Adminhtml/Controller/System/Email/Template.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Email/Template.php similarity index 92% rename from app/code/Magento/Adminhtml/Controller/System/Email/Template.php rename to app/code/Magento/Backend/Controller/Adminhtml/System/Email/Template.php index ff57dec4d25a8024164380a03beb0b5d15fd3156..43c7009bd8c73ea0bb79b4223ec9da4868e997a2 100644 --- a/app/code/Magento/Adminhtml/Controller/System/Email/Template.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Email/Template.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * System Template admin controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\System\Email; +namespace Magento\Backend\Controller\Adminhtml\System\Email; class Template extends \Magento\Backend\Controller\Adminhtml\Action { @@ -104,7 +104,7 @@ class Template extends \Magento\Backend\Controller\Adminhtml\Action $this->_title($template->getId() ? $template->getTemplateCode() : __('New Template')); $this->_addContent($this->getLayout() - ->createBlock('Magento\Adminhtml\Block\System\Email\Template\Edit', 'template_edit') + ->createBlock('Magento\Backend\Block\System\Email\Template\Edit', 'template_edit') ->setEditMode((bool)$this->getRequest()->getParam('id')) ); $this->renderLayout(); @@ -171,7 +171,7 @@ class Template extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('An error occurred while deleting email template data. Please review log and try again.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); // save data in session $this->_objectManager->get('Magento\Adminhtml\Model\Session') ->setFormData($this->getRequest()->getParams()); @@ -189,7 +189,7 @@ class Template extends \Magento\Backend\Controller\Adminhtml\Action public function previewAction() { - $this->loadLayout('systemPreview'); + $this->loadLayout('adminhtml_system_preview'); $this->renderLayout(); } @@ -206,14 +206,14 @@ class Template extends \Magento\Backend\Controller\Adminhtml\Action $template->setData('orig_template_code', $templateCode); $template->setData('template_variables', \Zend_Json::encode($template->getVariablesOptionArray(true))); - $templateBlock = $this->getLayout()->createBlock('Magento\Adminhtml\Block\System\Email\Template\Edit'); + $templateBlock = $this->getLayout()->createBlock('Magento\Backend\Block\System\Email\Template\Edit'); $template->setData('orig_template_used_default_for', $templateBlock->getUsedDefaultForPaths(false)); $this->getResponse()->setBody( $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($template->getData()) ); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } @@ -221,14 +221,14 @@ class Template extends \Magento\Backend\Controller\Adminhtml\Action * Load email template from request * * @param string $idFieldName - * @return \Magento\Adminhtml\Model\Email\Template $model + * @return \Magento\Backend\Model\Email\Template $model */ protected function _initTemplate($idFieldName = 'template_id') { $this->_title(__('Email Templates')); $id = (int)$this->getRequest()->getParam($idFieldName); - $model = $this->_objectManager->create('Magento\Adminhtml\Model\Email\Template'); + $model = $this->_objectManager->create('Magento\Backend\Model\Email\Template'); if ($id) { $model->load($id); } diff --git a/app/code/Magento/Adminhtml/Controller/System/Store.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php similarity index 94% rename from app/code/Magento/Adminhtml/Controller/System/Store.php rename to app/code/Magento/Backend/Controller/Adminhtml/System/Store.php index f65f38436ed48f16bbc36ed5ba04e42cfb5be9d8..36fabb88e2e5c498e233874dc65da368d4f70191 100644 --- a/app/code/Magento/Adminhtml/Controller/System/Store.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Store controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\System; +namespace Magento\Backend\Controller\Adminhtml\System; class Store extends \Magento\Backend\Controller\Adminhtml\Action { @@ -40,24 +40,32 @@ class Store extends \Magento\Backend\Controller\Adminhtml\Action * * @var \Magento\Core\Model\Registry */ - protected $_coreRegistry = null; + protected $_coreRegistry; + + /** + * @var \Magento\Filter\FilterManager + */ + protected $filterManager; /** * @param \Magento\Backend\Controller\Context $context * @param \Magento\Core\Model\Registry $coreRegistry + * @param \Magento\Filter\FilterManager $filterManager */ public function __construct( \Magento\Backend\Controller\Context $context, - \Magento\Core\Model\Registry $coreRegistry + \Magento\Core\Model\Registry $coreRegistry, + \Magento\Filter\FilterManager $filterManager ) { $this->_coreRegistry = $coreRegistry; + $this->filterManager = $filterManager; parent::__construct($context); } /** * Init actions * - * @return \Magento\Adminhtml\Controller\Cms\Page + * @return \Magento\Cms\Controller\Adminhtml\Page */ protected function _initAction() { @@ -167,7 +175,7 @@ class Store extends \Magento\Backend\Controller\Adminhtml\Action } $this->_initAction() - ->_addContent($this->getLayout()->createBlock('Magento\Adminhtml\Block\System\Store\Edit')) + ->_addContent($this->getLayout()->createBlock('Magento\Backend\Block\System\Store\Edit')) ->renderLayout(); } else { $session->addError($notExists); @@ -187,7 +195,7 @@ class Store extends \Magento\Backend\Controller\Adminhtml\Action try { switch ($postData['store_type']) { case 'website': - $postData['website']['name'] = $this->_getHelper()->removeTags($postData['website']['name']); + $postData['website']['name'] = $this->filterManager->removeTags($postData['website']['name']); $websiteModel = $this->_objectManager->create('Magento\Core\Model\Website'); if ($postData['website']['website_id']) { $websiteModel->load($postData['website']['website_id']); @@ -202,7 +210,7 @@ class Store extends \Magento\Backend\Controller\Adminhtml\Action break; case 'group': - $postData['group']['name'] = $this->_getHelper()->removeTags($postData['group']['name']); + $postData['group']['name'] = $this->filterManager->removeTags($postData['group']['name']); $groupModel = $this->_objectManager->create('Magento\Core\Model\Store\Group'); if ($postData['group']['group_id']) { $groupModel->load($postData['group']['group_id']); @@ -222,7 +230,7 @@ class Store extends \Magento\Backend\Controller\Adminhtml\Action case 'store': $eventName = 'store_edit'; $storeModel = $this->_objectManager->create('Magento\Core\Model\Store'); - $postData['store']['name'] = $this->_getHelper()->removeTags($postData['store']['name']); + $postData['store']['name'] = $this->filterManager->removeTags($postData['store']['name']); if ($postData['store']['store_id']) { $storeModel->load($postData['store']['store_id']); } @@ -282,7 +290,7 @@ class Store extends \Magento\Backend\Controller\Adminhtml\Action $this->_initAction() ->_addBreadcrumb(__('Delete Web Site'), __('Delete Web Site')) - ->_addContent($this->getLayout()->createBlock('Magento\Adminhtml\Block\System\Store\Delete') + ->_addContent($this->getLayout()->createBlock('Magento\Backend\Block\System\Store\Delete') ->setFormActionUrl($this->getUrl('adminhtml/*/deleteWebsitePost')) ->setBackUrl($this->getUrl('adminhtml/*/editWebsite', array('website_id' => $itemId))) ->setStoreTypeTitle(__('Web Site')) @@ -312,7 +320,7 @@ class Store extends \Magento\Backend\Controller\Adminhtml\Action $this->_initAction() ->_addBreadcrumb(__('Delete Store'), __('Delete Store')) - ->_addContent($this->getLayout()->createBlock('Magento\Adminhtml\Block\System\Store\Delete') + ->_addContent($this->getLayout()->createBlock('Magento\Backend\Block\System\Store\Delete') ->setFormActionUrl($this->getUrl('adminhtml/*/deleteGroupPost')) ->setBackUrl($this->getUrl('adminhtml/*/editGroup', array('group_id' => $itemId))) ->setStoreTypeTitle(__('Store')) @@ -342,7 +350,7 @@ class Store extends \Magento\Backend\Controller\Adminhtml\Action $this->_initAction() ->_addBreadcrumb(__('Delete Store View'), __('Delete Store View')) - ->_addContent($this->getLayout()->createBlock('Magento\Adminhtml\Block\System\Store\Delete') + ->_addContent($this->getLayout()->createBlock('Magento\Backend\Block\System\Store\Delete') ->setFormActionUrl($this->getUrl('adminhtml/*/deleteStorePost')) ->setBackUrl($this->getUrl('adminhtml/*/editStore', array('store_id' => $itemId))) ->setStoreTypeTitle(__('Store View')) @@ -459,7 +467,7 @@ class Store extends \Magento\Backend\Controller\Adminhtml\Action * * @param string $failPath redirect path if backup failed * @param array $arguments - * @return \Magento\Adminhtml\Controller\System\Store + * @return \Magento\Backend\Controller\Adminhtml\System\Store */ protected function _backupDatabase($failPath, $arguments=array()) { @@ -491,7 +499,7 @@ class Store extends \Magento\Backend\Controller\Adminhtml\Action * Add notification on deleting store / store view / website * * @param string $typeTitle - * @return \Magento\Adminhtml\Controller\System\Store + * @return \Magento\Backend\Controller\Adminhtml\System\Store */ protected function _addDeletionNotice($typeTitle) { diff --git a/app/code/Magento/Adminhtml/Controller/System/Variable.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php similarity index 95% rename from app/code/Magento/Adminhtml/Controller/System/Variable.php rename to app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php index c3cf3800f30101053d9939d26da76b3c2e6a6e25..1ddee1bd032b16a00df68964a1a6ed5d0985f404 100644 --- a/app/code/Magento/Adminhtml/Controller/System/Variable.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Custom Variables admin controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\System; +namespace Magento\Backend\Controller\Adminhtml\System; class Variable extends \Magento\Backend\Controller\Adminhtml\Action { @@ -57,7 +57,7 @@ class Variable extends \Magento\Backend\Controller\Adminhtml\Action /** * Initialize Layout and set breadcrumbs * - * @return \Magento\Adminhtml\Controller\System\Variable + * @return \Magento\Backend\Controller\Adminhtml\System\Variable */ protected function _initLayout() { @@ -117,9 +117,9 @@ class Variable extends \Magento\Backend\Controller\Adminhtml\Action $this->_title($variable->getId() ? $variable->getCode() : __('New Custom Variable')); $this->_initLayout() - ->_addContent($this->getLayout()->createBlock('Magento\Adminhtml\Block\System\Variable\Edit')) + ->_addContent($this->getLayout()->createBlock('Magento\Backend\Block\System\Variable\Edit')) ->_addJs($this->getLayout()->createBlock('Magento\Core\Block\Template', '', array( - 'data' => array('template' => 'Magento_Adminhtml::system/variable/js.phtml') + 'data' => array('template' => 'Magento_Backend::system/variable/js.phtml') ))) ->renderLayout(); } diff --git a/app/code/Magento/Backend/Controller/Context.php b/app/code/Magento/Backend/Controller/Context.php index d3218cad9d00755f3da23f4bcebd7475c9a1e482..c575120a4691d664a00382b5c0d1ec941590be01 100644 --- a/app/code/Magento/Backend/Controller/Context.php +++ b/app/code/Magento/Backend/Controller/Context.php @@ -69,14 +69,20 @@ class Context extends \Magento\Core\Controller\Varien\Action\Context protected $_locale; /** - * @param \Magento\Core\Model\Logger $logger + * @var bool + */ + protected $_canUseBaseUrl; + + /** + * @param \Magento\Logger $logger * @param \Magento\App\RequestInterface $request * @param \Magento\App\ResponseInterface $response * @param \Magento\ObjectManager $objectManager * @param \Magento\App\FrontController $frontController * @param \Magento\View\LayoutInterface $layout * @param \Magento\Event\ManagerInterface $eventManager - * @param $isRenderInherited + * @param \Magento\HTTP\Authentication $authentication + * @param bool $isRenderInherited * @param \Magento\Backend\Model\Session $session * @param \Magento\Backend\Helper\Data $helper * @param \Magento\AuthorizationInterface $authorization @@ -84,17 +90,19 @@ class Context extends \Magento\Core\Controller\Varien\Action\Context * @param \Magento\Backend\Model\Auth $auth * @param \Magento\Backend\Model\Url $backendUrl * @param \Magento\Core\Model\LocaleInterface $locale + * @param bool $canUseBaseUrl * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\App\RequestInterface $request, \Magento\App\ResponseInterface $response, \Magento\ObjectManager $objectManager, \Magento\App\FrontController $frontController, \Magento\View\LayoutInterface $layout, \Magento\Event\ManagerInterface $eventManager, + \Magento\HTTP\Authentication $authentication, $isRenderInherited, \Magento\Backend\Model\Session $session, \Magento\Backend\Helper\Data $helper, @@ -102,11 +110,13 @@ class Context extends \Magento\Core\Controller\Varien\Action\Context \Magento\Core\Model\Translate $translator, \Magento\Backend\Model\Auth $auth, \Magento\Backend\Model\Url $backendUrl, - \Magento\Core\Model\LocaleInterface $locale + \Magento\Core\Model\LocaleInterface $locale, + $canUseBaseUrl = false ) { parent::__construct($logger, $request, $response, $objectManager, $frontController, $layout, $eventManager, - $isRenderInherited + $authentication, $isRenderInherited ); + $this->_canUseBaseUrl = $canUseBaseUrl; $this->_session = $session; $this->_helper = $helper; $this->_authorization = $authorization; @@ -171,4 +181,12 @@ class Context extends \Magento\Core\Controller\Varien\Action\Context { return $this->_locale; } + + /** + * @return boolean + */ + public function getCanUseBaseUrl() + { + return $this->_canUseBaseUrl; + } } diff --git a/app/code/Magento/Backend/Controller/Router/DefaultRouter.php b/app/code/Magento/Backend/Controller/Router/DefaultRouter.php deleted file mode 100644 index a5a5a2ba2a4e1e695f6789cf84e99088da1de2de..0000000000000000000000000000000000000000 --- a/app/code/Magento/Backend/Controller/Router/DefaultRouter.php +++ /dev/null @@ -1,305 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ - -namespace Magento\Backend\Controller\Router; - -/** - * Class \Magento\Backend\Controller\Router\DefaultRouter - * - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - * @SuppressWarnings(PHPMD.ExcessiveParameterList) - */ -class DefaultRouter extends \Magento\Core\Controller\Varien\Router\Base -{ - /** - * List of required request parameters - * Order sensitive - * @var array - */ - protected $_requiredParams = array( - 'areaFrontName', - 'moduleFrontName', - 'controllerName', - 'actionName', - ); - - /** - * Url key of area - * - * @var string - */ - protected $_areaFrontName; - - /** - * @var \Magento\Backend\Helper\Data - */ - protected $_backendData; - - /** - * @param \Magento\Backend\Helper\Data $backendData - * Default routeId for router - * - * @var string - */ - protected $_defaultRouteId; - - /** - * @var \Magento\App\State - */ - protected $_appState; - - /** - * @var \Magento\Core\Model\StoreManagerInterface - */ - protected $_storeManager; - - /** - * @var \Magento\Core\Model\Url - */ - protected $_url; - - /** - * @param \Magento\Backend\Helper\Data $backendData - * @param \Magento\App\ActionFactory $controllerFactory - * @param \Magento\Filesystem $filesystem - * @param \Magento\Core\Model\App $app - * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Route\Config $routeConfig - * @param \Magento\Core\Model\Url\SecurityInfoInterface $securityInfo - * @param \Magento\Core\Model\Config $config - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Url $url - * @param \Magento\App\State $appState - * @param $areaCode - * @param $baseController - * @param $routerId - * @param $defaultRouteId - * - * @throws \InvalidArgumentException - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) - */ - public function __construct( - \Magento\Backend\Helper\Data $backendData, - \Magento\App\ActionFactory $controllerFactory, - \Magento\Filesystem $filesystem, - \Magento\Core\Model\App $app, - \Magento\App\State $appState, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Route\Config $routeConfig, - \Magento\Core\Model\Url\SecurityInfoInterface $securityInfo, - \Magento\Core\Model\Config $config, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Url $url, - \Magento\App\State $appState, - $areaCode, - $baseController, - $routerId, - $defaultRouteId - ) { - parent::__construct( - $controllerFactory, - $filesystem, - $app, - $coreStoreConfig, - $routeConfig, - $securityInfo, - $config, - $url, - $storeManager, - $appState, - $areaCode, - $baseController, - $routerId, - $defaultRouteId - ); - $this->_backendData = $backendData; - $this->_appState = $appState; - $this->_storeManager = $storeManager; - $this->_url = $url; - $this->_areaFrontName = $this->_backendData->getAreaFrontName(); - $this->_defaultRouteId = $defaultRouteId; - } - - /** - * Fetch default path - */ - public function fetchDefault() - { - // set defaults - $pathParts = explode('/', $this->_getDefaultPath()); - $backendRoutes = $this->_getRoutes(); - $moduleFrontName = $backendRoutes[$this->_defaultRouteId]['frontName']; - - $this->getFront()->setDefault(array( - 'area' => $this->_getParamWithDefaultValue($pathParts, 0, ''), - 'module' => $this->_getParamWithDefaultValue($pathParts, 1, $moduleFrontName), - 'controller' => $this->_getParamWithDefaultValue($pathParts, 2, 'index'), - 'action' => $this->_getParamWithDefaultValue($pathParts, 3, 'index'), - )); - } - - /** - * Retrieve array param by key, or default value - * - * @param array $array - * @param string $key - * @param mixed $defaultValue - * @return mixed - */ - protected function _getParamWithDefaultValue($array, $key, $defaultValue) - { - return !empty($array[$key]) ? $array[$key] : $defaultValue; - } - - /** - * Get router default request path - * @return string - */ - protected function _getDefaultPath() - { - return (string)$this->_config->getValue('web/default/admin', 'default'); - } - - /** - * Dummy call to pass through checking - * - * @return boolean - */ - protected function _beforeModuleMatch() - { - return true; - } - - /** - * checking if we installed or not and doing redirect - * - * @return bool - * @SuppressWarnings(PHPMD.ExitExpression) - */ - protected function _afterModuleMatch() - { - if (!$this->_appState->isInstalled()) { - $this->_app->getFrontController() - ->getResponse() - ->setRedirect($this->_url->getUrl('install')) - ->sendResponse(); - exit; - } - return true; - } - - /** - * We need to have noroute action in this router - * not to pass dispatching to next routers - * - * @return bool - */ - protected function _noRouteShouldBeApplied() - { - return true; - } - - /** - * Check whether URL for corresponding path should use https protocol - * - * @param string $path - * @return bool - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _shouldBeSecure($path) - { - return substr((string)$this->_config->getValue('web/unsecure/base_url', 'default'), 0, 5) === 'https' - || $this->_coreStoreConfig->getConfigFlag( - 'web/secure/use_in_adminhtml', - \Magento\Core\Model\AppInterface::ADMIN_STORE_ID - ) && substr((string)$this->_config->getValue('web/secure/base_url', 'default'), 0, 5) === 'https'; - } - - /** - * Retrieve current secure url - * - * @param \Magento\App\RequestInterface $request - * @return string - */ - protected function _getCurrentSecureUrl($request) - { - return $this->_storeManager->getStore(\Magento\Core\Model\AppInterface::ADMIN_STORE_ID) - ->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/'); - } - - /** - * Check whether redirect should be used for secure routes - * - * @return bool - */ - protected function _shouldRedirectToSecure() - { - return false; - } - - /** - * Build controller class name based on moduleName and controllerName - * - * @param string $realModule - * @param string $controller - * @return string - */ - public function getControllerClassName($realModule, $controller) - { - /** - * Start temporary block - * TODO: Sprint#27. Delete after adminhtml refactoring - */ - if ($realModule == 'Magento_Adminhtml') { - return parent::getControllerClassName($realModule, $controller); - } - /** - * End temporary block - */ - - $parts = explode('_', $realModule); - $realModule = implode(\Magento\Autoload\IncludePath::NS_SEPARATOR, array_splice($parts, 0, 2)); - return $realModule . \Magento\Autoload\IncludePath::NS_SEPARATOR . 'Controller' . - \Magento\Autoload\IncludePath::NS_SEPARATOR . ucfirst($this->_areaCode) . - \Magento\Autoload\IncludePath::NS_SEPARATOR . - str_replace('_', '\\', uc_words(str_replace('_', ' ', $controller))); - - } - - /** - * Check whether this router should process given request - * - * @param array $params - * @return bool - */ - protected function _canProcess(array $params) - { - return $params['areaFrontName'] == $this->_areaFrontName; - } -} diff --git a/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php b/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php index e8bc4628fbbb70c02e330b659cefc1d9ea5d6706..90f1309216681f43d027c76a7569e496cfca8867 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php +++ b/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/Magento/Backend/Helper/Dashboard/Data.php b/app/code/Magento/Backend/Helper/Dashboard/Data.php index 80f601e203364896a7c1d1c64a78b3953e38a709..f8d1c270e459a63d6c84a65c554cae2746da5683 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/Data.php +++ b/app/code/Magento/Backend/Helper/Dashboard/Data.php @@ -19,20 +19,21 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Backend\Helper\Dashboard; /** * Data helper for dashboard */ -namespace Magento\Backend\Helper\Dashboard; - class Data extends \Magento\Core\Helper\Data { - protected $_locale = null; - protected $_stores = null; + /** + * @var \Magento\Data\Collection\Db + */ + protected $_stores; /** * @var string @@ -42,34 +43,34 @@ class Data extends \Magento\Core\Helper\Data /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor - * @param \Magento\Core\Model\StoreManager $storeManager - * @param string $installDate + * @param $installDate * @param bool $dbCompatibleMode */ public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, $installDate, $dbCompatibleMode = true ) { - parent::__construct($context, $eventManager, $coreHttp, $config, $coreStoreConfig, $storeManager, - $locale, $dateModel, $appState, $encryptor, $dbCompatibleMode + parent::__construct( + $context, + $eventManager, + $coreStoreConfig, + $storeManager, + $locale, + $dateModel, + $appState, + $dbCompatibleMode ); $this->_installDate = $installDate; } @@ -81,10 +82,9 @@ class Data extends \Magento\Core\Helper\Data */ public function getStores() { - if(!$this->_stores) { + if (!$this->_stores) { $this->_stores = $this->_storeManager->getStore()->getResourceCollection()->load(); } - return $this->_stores; } diff --git a/app/code/Magento/Backend/Helper/Dashboard/Order.php b/app/code/Magento/Backend/Helper/Dashboard/Order.php index 0e4f7e930959ed4cc63e68491e0114dec24634fe..391689ae5fc9e63ba0a903e349ef881c27679f8e 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/Order.php +++ b/app/code/Magento/Backend/Helper/Dashboard/Order.php @@ -19,16 +19,15 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Backend\Helper\Dashboard; /** * Adminhtml dashboard helper for orders */ -namespace Magento\Backend\Helper\Dashboard; - class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard { /** @@ -39,35 +38,35 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor * @param \Magento\Reports\Model\Resource\Order\Collection $orderCollection * @param bool $dbCompatibleMode */ public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, \Magento\Reports\Model\Resource\Order\Collection $orderCollection, $dbCompatibleMode = true - ) - { + ) { $this->_orderCollection = $orderCollection; - parent::__construct($context, $eventManager, $coreHttp, $config, $coreStoreConfig, $storeManager, - $locale, $dateModel, $appState, $encryptor, $dbCompatibleMode + parent::__construct( + $context, + $eventManager, + $coreStoreConfig, + $storeManager, + $locale, + $dateModel, + $appState, + $dbCompatibleMode ); } diff --git a/app/code/Magento/Backend/Helper/Data.php b/app/code/Magento/Backend/Helper/Data.php index 58c66c98540762ff1bb192fbe1367325d7f3c2cd..5f0eaed22c82887e185c4e19e63ba2991f20d49b 100644 --- a/app/code/Magento/Backend/Helper/Data.php +++ b/app/code/Magento/Backend/Helper/Data.php @@ -32,26 +32,13 @@ namespace Magento\Backend\Helper; class Data extends \Magento\Core\Helper\AbstractHelper { const XML_PATH_USE_CUSTOM_ADMIN_URL = 'admin/url/use_custom'; - const BACKEND_AREA_CODE = 'adminhtml'; protected $_pageHelpUrl; /** - * @var \Magento\Core\Model\Config\Primary + * @var \Magento\App\Route\Config */ - protected $_primaryConfig; - - /** - * @var \Magento\App\RouterList - */ - protected $_routerList; - - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; + protected $_routeConfig; /** * @var \Magento\Core\Model\App @@ -73,34 +60,36 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ protected $_frontNameResolver; + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + /** * @param \Magento\Core\Helper\Context $context - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Config\Primary $primaryConfig - * @param \Magento\App\RouterList $routerList - * @param \Magento\Core\Model\App $app + * @param \Magento\App\Route\Config $routeConfig + * @param \Magento\Core\Model\AppInterface $app * @param \Magento\Backend\Model\Url $backendUrl * @param \Magento\Backend\Model\Auth $auth * @param \Magento\Backend\App\Area\FrontNameResolver $frontNameResolver + * @param \Magento\Math\Random $mathRandom */ public function __construct( \Magento\Core\Helper\Context $context, - \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Config\Primary $primaryConfig, - \Magento\App\RouterList $routerList, - \Magento\Core\Model\App $app, + \Magento\App\Route\Config $routeConfig, + \Magento\Core\Model\AppInterface $app, \Magento\Backend\Model\Url $backendUrl, \Magento\Backend\Model\Auth $auth, - \Magento\Backend\App\Area\FrontNameResolver $frontNameResolver + \Magento\Backend\App\Area\FrontNameResolver $frontNameResolver, + \Magento\Math\Random $mathRandom ) { parent::__construct($context); - $this->_coreData = $coreData; - $this->_primaryConfig = $primaryConfig; - $this->_routerList = $routerList; + $this->_routeConfig = $routeConfig; $this->_app = $app; $this->_backendUrl = $backendUrl; $this->_auth = $auth; $this->_frontNameResolver = $frontNameResolver; + $this->mathRandom = $mathRandom; } public function getPageHelpUrl() @@ -117,10 +106,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper $request = $this->_app->getRequest(); $frontModule = $request->getControllerModule(); if (!$frontModule) { - $frontName = $request->getModuleName(); - $router = $this->_routerList->getRouterByFrontName($frontName); - - $frontModule = $router->getModulesByFrontName($frontName); + $frontModule = $this->_routeConfig->getModulesByFrontName($request->getModuleName()); if (empty($frontModule) === false) { $frontModule = $frontModule[0]; } else { @@ -191,7 +177,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function generateResetPasswordLinkToken() { - return $this->_coreData->uniqHash(); + return $this->mathRandom->getUniqueHash(); } /** @@ -204,16 +190,6 @@ class Data extends \Magento\Core\Helper\AbstractHelper return $this->_backendUrl->getRouteUrl('adminhtml'); } - /** - * Return Backend area code - * - * @return string - */ - public function getAreaCode() - { - return self::BACKEND_AREA_CODE; - } - /** * Return Backend area front name * diff --git a/app/code/Magento/Backend/Model/Auth/Session.php b/app/code/Magento/Backend/Model/Auth/Session.php index 2c977a61c38a922bdf114c8732cb83153cbc9b69..0965978eb67dce281184482584acb6ac00abd2ff 100644 --- a/app/code/Magento/Backend/Model/Auth/Session.php +++ b/app/code/Magento/Backend/Model/Auth/Session.php @@ -52,20 +52,20 @@ class Session protected $_aclBuilder; /** - * @var \Magento\Backend\Model\Url\Proxy + * @var \Magento\Backend\Model\Url */ protected $_backendUrl; /** * @param \Magento\Core\Model\Session\Context $context * @param \Magento\Acl\Builder $aclBuilder - * @param \Magento\Backend\Model\Url\Proxy $backendUrl + * @param \Magento\Backend\Model\Url $backendUrl * @param array $data */ public function __construct( \Magento\Core\Model\Session\Context $context, \Magento\Acl\Builder $aclBuilder, - \Magento\Backend\Model\Url\Proxy $backendUrl, + \Magento\Backend\Model\Url $backendUrl, array $data = array() ) { $this->_aclBuilder = $aclBuilder; diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php index f6e46f13921fac16fe6054a5724d3d231cd044be..f446a33e46d168a852208055611a0104cd3ec6b9 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php @@ -88,7 +88,7 @@ abstract class AbstractCurrency extends \Magento\Core\Model\Config\Value { if ($this->getData('groups/options/fields/allow/inherit')) { return explode( - ',', $this->_config->getNode('currency/options/allow', $this->getScope(), $this->getScopeId()) + ',', (string) $this->_config->getValue('currency/options/allow', $this->getScope(), $this->getScopeId()) ); } return $this->getData('groups/options/fields/allow/value'); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php index 0b3ff65473d0080251a71f1dfd108b7ed695d9cd..d2a2f9ad9f872a99a21b6e73ab7d659969bbbe4d 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php @@ -32,46 +32,53 @@ class Encrypted implements \Magento\Core\Model\Config\Data\BackendModelInterface { /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Encryption\EncryptorInterface */ - protected $_coreData = null; + protected $_encryptor; /** - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Config $config + * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Config $config, + \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreData = $coreData; + $this->_encryptor = $encryptor; parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); } + /** + * Magic method called during class serialization + * + * @return array + */ public function __sleep() { $properties = parent::__sleep(); - return array_diff($properties, array('_coreData')); + return array_diff($properties, array('_encryptor')); } + /** + * Magic method called during class un-serialization + */ public function __wakeup() { parent::__wakeup(); - $this->_coreData = \Magento\Core\Model\ObjectManager::getInstance()->get('Magento\Core\Helper\Data'); + $this->_encryptor = \Magento\App\ObjectManager::getInstance() + ->get('Magento\Encryption\EncryptorInterface'); } /** @@ -81,7 +88,7 @@ class Encrypted protected function _afterLoad() { $value = (string)$this->getValue(); - if (!empty($value) && ($decrypted = $this->_coreData->decrypt($value))) { + if (!empty($value) && ($decrypted = $this->_encryptor->decrypt($value))) { $this->setValue($decrypted); } } @@ -97,8 +104,11 @@ class Encrypted if (preg_match('/^\*+$/', $this->getValue())) { $value = $this->getOldValue(); } - if (!empty($value) && ($encrypted = $this->_coreData->encrypt($value))) { - $this->setValue($encrypted); + if (!empty($value)) { + $encrypted = $this->_encryptor->encrypt($value); + if ($encrypted) { + $this->setValue($encrypted); + } } } @@ -110,6 +120,6 @@ class Encrypted */ public function processValue($value) { - return $this->_coreData->decrypt($value); + return $this->_encryptor->decrypt($value); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php index b580ad9d6bcd35a0b8836953deddb55dfe65413e..17d86acf5047a460be31ecc4ad641ae853263e1f 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php @@ -39,6 +39,11 @@ class Cron extends \Magento\Core\Model\Config\Value */ protected $_configValueFactory; + /** + * @var string + */ + protected $_runModelPath = ''; + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -47,6 +52,7 @@ class Cron extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection + * @param string $runModelPath * @param array $data */ public function __construct( @@ -57,9 +63,11 @@ class Cron extends \Magento\Core\Model\Config\Value \Magento\Core\Model\Config\ValueFactory $configValueFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, + $runModelPath = '', array $data = array() ) { $this->_configValueFactory = $configValueFactory; + $this->_runModelPath = $runModelPath; parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); } @@ -73,7 +81,7 @@ class Cron extends \Magento\Core\Model\Config\Value { $enabled = $this->getData('groups/log/fields/enabled/value'); $time = $this->getData('groups/log/fields/time/value'); - $frequncy = $this->getData('groups/log/fields/frequency/value'); + $frequency = $this->getData('groups/log/fields/frequency/value'); $frequencyWeekly = \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY; $frequencyMonthly = \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY; @@ -82,9 +90,9 @@ class Cron extends \Magento\Core\Model\Config\Value $cronExprArray = array( intval($time[1]), # Minute intval($time[0]), # Hour - ($frequncy == $frequencyMonthly) ? '1' : '*', # Day of the Month + ($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month '*', # Month of the Year - ($frequncy == $frequencyWeekly) ? '1' : '*', # Day of the Week + ($frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week ); $cronExprString = join(' ', $cronExprArray); } else { @@ -102,7 +110,7 @@ class Cron extends \Magento\Core\Model\Config\Value /** @var $configValue \Magento\Core\Model\Config\Value */ $configValue = $this->_configValueFactory->create(); $configValue->load(self::CRON_MODEL_PATH, 'path'); - $configValue->setValue((string) $this->_config->getNode(self::CRON_MODEL_PATH)) + $configValue->setValue($this->_runModelPath) ->setPath(self::CRON_MODEL_PATH) ->save(); } catch (\Exception $e) { diff --git a/app/code/Magento/Backend/Model/Config/SchemaLocator.php b/app/code/Magento/Backend/Model/Config/SchemaLocator.php index 8ebf4a046d6a8e7cea934388b1696d98b781b632..c5b8ef2a80a32fce88d4e17bd4256b0dc1261911 100644 --- a/app/code/Magento/Backend/Model/Config/SchemaLocator.php +++ b/app/code/Magento/Backend/Model/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Backend') . DIRECTORY_SEPARATOR . 'system.xsd'; diff --git a/app/code/Magento/Backend/Model/Config/Source/Dev/Dbautoup.php b/app/code/Magento/Backend/Model/Config/Source/Dev/Dbautoup.php index d9bf5431f30d01dda7f8dcfdab904520cb13cdd5..27c7850d7e2a04d0b470045ff655a1feec561329 100644 --- a/app/code/Magento/Backend/Model/Config/Source/Dev/Dbautoup.php +++ b/app/code/Magento/Backend/Model/Config/Source/Dev/Dbautoup.php @@ -31,15 +31,15 @@ class Dbautoup implements \Magento\Core\Model\Option\ArrayInterface { return array( array( - 'value'=>\Magento\Core\Model\Resource::AUTO_UPDATE_ALWAYS, + 'value'=> \Magento\App\Resource::AUTO_UPDATE_ALWAYS, 'label' => __('Always (during development)') ), array( - 'value'=>\Magento\Core\Model\Resource::AUTO_UPDATE_ONCE, + 'value'=> \Magento\App\Resource::AUTO_UPDATE_ONCE, 'label' => __('Only Once (version upgrade)') ), array( - 'value'=>\Magento\Core\Model\Resource::AUTO_UPDATE_NEVER, + 'value'=> \Magento\App\Resource::AUTO_UPDATE_NEVER, 'label' => __('Never (production)') ), ); diff --git a/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php b/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php index 811b888c7c2cee4164088b7e7ac73dc8deeefbea..e4caafea2c780ac9ae1c46c7f0b546b347e2e65e 100644 --- a/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php +++ b/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php @@ -32,14 +32,14 @@ namespace Magento\Backend\Model\Config\Source\Storage\Media; class Database implements \Magento\Core\Model\Option\ArrayInterface { /** - * @var \Magento\Core\Model\Config\Local + * @var \Magento\App\Config */ protected $_config; /** - * @param \Magento\Core\Model\Config\Local + * @param \Magento\App\Config */ - public function __construct(\Magento\Core\Model\Config\Local $config) + public function __construct(\Magento\App\Config $config) { $this->_config = $config; } diff --git a/app/code/Magento/Backend/Model/Config/Structure.php b/app/code/Magento/Backend/Model/Config/Structure.php index a3ccd63d1b0c6249ff69c0c29344b713670391f7..847541159912dd5f16efc2a7f5d539a247abf34c 100644 --- a/app/code/Magento/Backend/Model/Config/Structure.php +++ b/app/code/Magento/Backend/Model/Config/Structure.php @@ -96,12 +96,14 @@ class Structure implements \Magento\Backend\Model\Config\Structure\SearchInterfa */ public function getTabs() { - foreach ($this->_data['sections'] as $sectionId => $section) { - if (isset($section['tab']) && $section['tab']) { - $this->_data['tabs'][$section['tab']]['children'][$sectionId] = $section; + if (isset($this->_data['sections'])) { + foreach ($this->_data['sections'] as $sectionId => $section) { + if (isset($section['tab']) && $section['tab']) { + $this->_data['tabs'][$section['tab']]['children'][$sectionId] = $section; + } } + $this->_tabIterator->setElements($this->_data['tabs'], $this->_scopeDefiner->getScope()); } - $this->_tabIterator->setElements($this->_data['tabs'], $this->_scopeDefiner->getScope()); return $this->_tabIterator; } diff --git a/app/code/Magento/Adminhtml/Model/Email/Template.php b/app/code/Magento/Backend/Model/Email/Template.php similarity index 98% rename from app/code/Magento/Adminhtml/Model/Email/Template.php rename to app/code/Magento/Backend/Model/Email/Template.php index f192355359cfacdf8ad9de316d06fdfaf4296b49..43b284bf4ace3dede6027e559b69e6acafdc10c6 100644 --- a/app/code/Magento/Adminhtml/Model/Email/Template.php +++ b/app/code/Magento/Backend/Model/Email/Template.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml email template model * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Model\Email; +namespace Magento\Backend\Model\Email; class Template extends \Magento\Core\Model\Email\Template { diff --git a/app/code/Magento/Backend/Model/Locale.php b/app/code/Magento/Backend/Model/Locale.php index c96f676f0d4147ce9613a062b02e06ac4b9d7be0..d7c4bebf953cf902e23e16a22aac1b6370dba948 100644 --- a/app/code/Magento/Backend/Model/Locale.php +++ b/app/code/Magento/Backend/Model/Locale.php @@ -65,6 +65,7 @@ class Locale extends \Magento\Core\Model\Locale * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale\Config $config * @param \Magento\Core\Model\App $app + * @param \Magento\Stdlib\DateTime $dateTime * @param string $locale * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -81,6 +82,7 @@ class Locale extends \Magento\Core\Model\Locale \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale\Config $config, \Magento\Core\Model\App $app, + \Magento\Stdlib\DateTime $dateTime, $locale = null ) { $this->_session = $session; @@ -88,7 +90,15 @@ class Locale extends \Magento\Core\Model\Locale $this->_request = $request; $this->_localeValidator = $localeValidator; parent::__construct( - $eventManager, $translate, $coreStoreConfig, $appState, $storeManager, $config, $app, $locale + $eventManager, + $translate, + $coreStoreConfig, + $appState, + $storeManager, + $config, + $app, + $dateTime, + $locale ); } diff --git a/app/code/Magento/Backend/Model/Locale/Manager.php b/app/code/Magento/Backend/Model/Locale/Manager.php index d6e5046604d5826537f881a42bf49c52cbf07fa2..f480384d9bbde02157148ad0e43920d6613ab1bb 100644 --- a/app/code/Magento/Backend/Model/Locale/Manager.php +++ b/app/code/Magento/Backend/Model/Locale/Manager.php @@ -81,7 +81,7 @@ class Manager ->setInterfaceLocale($localeCode); $this->_translator->setLocale($localeCode) - ->init(\Magento\Backend\Helper\Data::BACKEND_AREA_CODE, true); + ->init(null, true); return $this; } diff --git a/app/code/Magento/Backend/Model/Menu.php b/app/code/Magento/Backend/Model/Menu.php index 26b814ef39e8d6f3953601f75746d007e3dace30..318cad6176fca712f149ecf41d12bb00585da21e 100644 --- a/app/code/Magento/Backend/Model/Menu.php +++ b/app/code/Magento/Backend/Model/Menu.php @@ -44,15 +44,15 @@ class Menu extends \ArrayObject protected $_path = ''; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param string $pathInMenuStructure */ - public function __construct(\Magento\Core\Model\Logger $logger, $pathInMenuStructure = '') + public function __construct(\Magento\Logger $logger, $pathInMenuStructure = '') { if ($pathInMenuStructure) { $this->_path = $pathInMenuStructure . '/'; diff --git a/app/code/Magento/Backend/Model/Menu/AbstractDirector.php b/app/code/Magento/Backend/Model/Menu/AbstractDirector.php index 211037baac04a10ccd7aecb06b3bd938b01f3bae..d7d5412ef74c54cfabab505c83d368c3ccb20b46 100644 --- a/app/code/Magento/Backend/Model/Menu/AbstractDirector.php +++ b/app/code/Magento/Backend/Model/Menu/AbstractDirector.php @@ -46,9 +46,9 @@ abstract class AbstractDirector * * @param array $config * @param \Magento\Backend\Model\Menu\Builder $builder - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ abstract public function direct( - array $config, \Magento\Backend\Model\Menu\Builder $builder, \Magento\Core\Model\Logger $logger + array $config, \Magento\Backend\Model\Menu\Builder $builder, \Magento\Logger $logger ); } diff --git a/app/code/Magento/Backend/Model/Menu/Config.php b/app/code/Magento/Backend/Model/Menu/Config.php index 84afc92fa39205421e433b69de2afb4a32ccd343..1effb7cfc2ce1186203c1338b4a456a5f37db8f4 100644 --- a/app/code/Magento/Backend/Model/Menu/Config.php +++ b/app/code/Magento/Backend/Model/Menu/Config.php @@ -52,7 +52,7 @@ class Config protected $_menu; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -71,6 +71,11 @@ class Config */ protected $_director; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * @param \Magento\Backend\Model\Menu\Builder $menuBuilder * @param \Magento\Backend\Model\Menu\AbstractDirector $menuDirector @@ -78,8 +83,9 @@ class Config * @param \Magento\Backend\Model\Menu\Config\Reader $configReader * @param \Magento\Core\Model\Cache\Type\Config $configCacheType * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\State $appState */ public function __construct( \Magento\Backend\Model\Menu\Builder $menuBuilder, @@ -88,8 +94,9 @@ class Config \Magento\Backend\Model\Menu\Config\Reader $configReader, \Magento\Core\Model\Cache\Type\Config $configCacheType, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Logger $logger, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\State $appState ) { $this->_menuBuilder = $menuBuilder; $this->_director = $menuDirector; @@ -99,18 +106,24 @@ class Config $this->_menuFactory = $menuFactory; $this->_configReader = $configReader; $this->_storeManager = $storeManager; + $this->_appState = $appState; } /** * Build menu model from config * * @return \Magento\Backend\Model\Menu - * @throws \InvalidArgumentException|BadMethodCallException|OutOfRangeException|Exception + * @throws \Exception|\InvalidArgumentException + * @throws \Exception + * @throws \BadMethodCallException|\Exception + * @throws \Exception|\OutOfRangeException */ public function getMenu() { - $store = $this->_storeManager->getStore(); - $this->_logger->addStoreLog(\Magento\Backend\Model\Menu::LOGGER_KEY, $store); + if ($this->_storeManager->getStore()->getConfig('dev/log/active')) { + $this->_logger->addStreamLog(\Magento\Backend\Model\Menu::LOGGER_KEY); + } + try { $this->_initMenu(); return $this->_menu; @@ -145,7 +158,7 @@ class Config } $this->_director->direct( - $this->_configReader->read(\Magento\Core\Model\App\Area::AREA_ADMINHTML), + $this->_configReader->read($this->_appState->getAreaCode()), $this->_menuBuilder, $this->_logger ); diff --git a/app/code/Magento/Backend/Model/Menu/Config/SchemaLocator.php b/app/code/Magento/Backend/Model/Menu/Config/SchemaLocator.php index 6124ed2109b72d9f5cc99df75e95c9d8b7c22e34..11236d78ae40732ac034eec3ef6e4db23ce40404 100644 --- a/app/code/Magento/Backend/Model/Menu/Config/SchemaLocator.php +++ b/app/code/Magento/Backend/Model/Menu/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Backend') . DIRECTORY_SEPARATOR . 'menu.xsd'; } diff --git a/app/code/Magento/Backend/Model/Menu/Director/Director.php b/app/code/Magento/Backend/Model/Menu/Director/Director.php index 5cb56deee2512602fa931501263185e9f743fd64..17a84f36d330fb2e19bcab89e028ae89af1ae461 100644 --- a/app/code/Magento/Backend/Model/Menu/Director/Director.php +++ b/app/code/Magento/Backend/Model/Menu/Director/Director.php @@ -39,7 +39,7 @@ class Director extends \Magento\Backend\Model\Menu\AbstractDirector * Get command object * * @param array $data command params - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @return \Magento\Backend\Model\Menu\Builder\AbstractCommand */ protected function _getCommand($data, $logger) @@ -58,12 +58,12 @@ class Director extends \Magento\Backend\Model\Menu\AbstractDirector * * @param array $config * @param \Magento\Backend\Model\Menu\Builder $builder - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function direct( array $config, \Magento\Backend\Model\Menu\Builder $builder, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { foreach ($config as $data) { $builder->processCommand($this->_getCommand($data, $logger)); diff --git a/app/code/Magento/Backend/Model/Menu/Item.php b/app/code/Magento/Backend/Model/Menu/Item.php index 17a3dcbf226b765ca5b7c43ed6fe7b3084925b1c..bade2870d2ea1122c86905131e42e3bace407762 100644 --- a/app/code/Magento/Backend/Model/Menu/Item.php +++ b/app/code/Magento/Backend/Model/Menu/Item.php @@ -161,7 +161,7 @@ class Item /** * Module list * - * @var \Magento\App\ModuleListInterface + * @var \Magento\Module\ModuleListInterface */ protected $_moduleList; @@ -172,7 +172,7 @@ class Item * @param \Magento\Backend\Model\MenuFactory $menuFactory * @param \Magento\Backend\Model\Url $urlModel * @param \Magento\Core\Helper\AbstractHelper $helper - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\ModuleListInterface $moduleList * @param array $data */ public function __construct( @@ -182,7 +182,7 @@ class Item \Magento\Backend\Model\MenuFactory $menuFactory, \Magento\Backend\Model\Url $urlModel, \Magento\Core\Helper\AbstractHelper $helper, - \Magento\App\ModuleListInterface $moduleList, + \Magento\Module\ModuleListInterface $moduleList, array $data = array() ) { $this->_validator = $validator; @@ -492,14 +492,14 @@ class Item public function __wakeup() { - $objectManager = \Magento\Core\Model\ObjectManager::getInstance(); + $objectManager = \Magento\App\ObjectManager::getInstance(); $this->_moduleHelper = $objectManager->get($this->_moduleHelperName); $this->_validator = $objectManager->get('Magento\Backend\Model\Menu\Item\Validator'); $this->_acl = $objectManager->get('Magento\AuthorizationInterface'); $this->_storeConfig = $objectManager->get('Magento\Core\Model\Store\Config'); $this->_menuFactory = $objectManager->get('Magento\Backend\Model\MenuFactory'); $this->_urlModel = $objectManager->get('Magento\Backend\Model\Url'); - $this->_moduleList = $objectManager->get('Magento\App\ModuleListInterface'); + $this->_moduleList = $objectManager->get('Magento\Module\ModuleListInterface'); if ($this->_serializedSubmenu) { $this->_submenu = $this->_menuFactory->create(); $this->_submenu->unserialize($this->_serializedSubmenu); diff --git a/app/code/Magento/Backend/Model/Url.php b/app/code/Magento/Backend/Model/Url.php index 20242b6159f4171716414cf1b8e1edc77ef96fd6..f55622f52b0742cc874c87592248626528041a59 100644 --- a/app/code/Magento/Backend/Model/Url.php +++ b/app/code/Magento/Backend/Model/Url.php @@ -23,7 +23,6 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Backend\Model; use Magento\Backend\Model\Auth; @@ -60,6 +59,7 @@ class Url extends \Magento\Core\Model\Url /** * Startup page url from config + * * @var string */ protected $_startupMenuItemId; @@ -69,11 +69,6 @@ class Url extends \Magento\Core\Model\Url */ protected $_backendHelper; - /** - * @var \Magento\Core\Helper\Data - */ - protected $_coreHelper; - /** * @var \Magento\Core\Model\Session */ @@ -87,42 +82,52 @@ class Url extends \Magento\Core\Model\Url protected $_menuConfig; /** - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; /** - * @param \Magento\App\RouterListInterface $routerList + * @var \Magento\Encryption\EncryptorInterface + */ + protected $_encryptor; + + /** + * @param \Magento\App\Route\ConfigInterface $routeConfig * @param \Magento\App\RequestInterface $request * @param \Magento\Core\Model\Url\SecurityInfoInterface $securityInfo * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Backend\Helper\Data $backendHelper * @param \Magento\Core\Model\Session $session * @param Menu\Config $menuConfig - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\App $app * @param \Magento\Core\Model\StoreManager $storeManager - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param Auth\Session $authSession + * @param \Magento\Encryption\EncryptorInterface $encryptor + * @param null $areaCode * @param array $data */ public function __construct( - \Magento\App\RouterListInterface $routerList, + \Magento\App\Route\ConfigInterface $routeConfig, \Magento\App\RequestInterface $request, \Magento\Core\Model\Url\SecurityInfoInterface $securityInfo, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Backend\Helper\Data $backendHelper, \Magento\Core\Model\Session $session, \Magento\Backend\Model\Menu\Config $menuConfig, - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\App $app, \Magento\Core\Model\StoreManager $storeManager, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Backend\Model\Auth\Session $authSession, + \Magento\Encryption\EncryptorInterface $encryptor, + $areaCode = null, array $data = array() ) { + $this->_encryptor = $encryptor; parent::__construct( - $routerList, $request, $securityInfo, $coreStoreConfig, $coreData, $app, $storeManager, $session, $data); + $routeConfig, $request, $securityInfo, $coreStoreConfig, + $app, $storeManager, $session, $areaCode, $data + ); $this->_startupMenuItemId = $coreStoreConfig->getConfig(self::XML_PATH_STARTUP_MENU_ITEM); $this->_backendHelper = $backendHelper; $this->_coreSession = $session; @@ -151,7 +156,7 @@ class Url extends \Magento\Core\Model\Url * @param bool $unsetOldParams * @return \Magento\Backend\Model\Url */ - public function setRouteParams(array $data, $unsetOldParams=true) + public function setRouteParams(array $data, $unsetOldParams = true) { if (isset($data['_nosecret'])) { $this->setNoSecret(true); @@ -159,7 +164,6 @@ class Url extends \Magento\Core\Model\Url } else { $this->setNoSecret(false); } - return parent::setRouteParams($data, $unsetOldParams); } @@ -170,23 +174,20 @@ class Url extends \Magento\Core\Model\Url * @param array $routeParams * @return string */ - public function getUrl($routePath=null, $routeParams=null) + public function getUrl($routePath = null, $routeParams = null) { $cacheSecretKey = false; if (is_array($routeParams) && isset($routeParams['_cache_secret_key'])) { unset($routeParams['_cache_secret_key']); $cacheSecretKey = true; } - $result = parent::getUrl($routePath, $routeParams); if (!$this->useSecretKey()) { return $result; } - $routeName = $this->getRouteName('*'); $controllerName = $this->getControllerName($this->getDefaultControllerName()); $actionName = $this->getActionName($this->getDefaultActionName()); - if ($cacheSecretKey) { $secret = array(self::SECRET_KEY_PARAM_NAME => "\${$routeName}/{$controllerName}/{$actionName}\$"); } else { @@ -202,7 +203,6 @@ class Url extends \Magento\Core\Model\Url if (is_array($this->getRouteParams())) { $routeParams = array_merge($this->getRouteParams(), $routeParams); } - return parent::getUrl("{$routeName}/{$controllerName}/{$actionName}", $routeParams); } @@ -218,7 +218,6 @@ class Url extends \Magento\Core\Model\Url { $salt = $this->_coreSession->getFormKey(); $request = $this->getRequest(); - if (!$routeName) { if ($request->getBeforeForwardInfo('route_name') !== null) { $routeName = $request->getBeforeForwardInfo('route_name'); @@ -226,7 +225,6 @@ class Url extends \Magento\Core\Model\Url $routeName = $request->getRouteName(); } } - if (!$controller) { if ($request->getBeforeForwardInfo('controller_name') !== null) { $controller = $request->getBeforeForwardInfo('controller_name'); @@ -234,7 +232,6 @@ class Url extends \Magento\Core\Model\Url $controller = $request->getControllerName(); } } - if (!$action) { if ($request->getBeforeForwardInfo('action_name') !== null) { $action = $request->getBeforeForwardInfo('action_name'); @@ -242,9 +239,8 @@ class Url extends \Magento\Core\Model\Url $action = $request->getActionName(); } } - $secret = $routeName . $controller . $action . $salt; - return $this->_coreData->getHash($secret); + return $this->_encryptor->getHash($secret); } /** @@ -324,7 +320,6 @@ class Url extends \Magento\Core\Model\Url $action = '*/*/denied'; } return $action; - } /** @@ -362,7 +357,6 @@ class Url extends \Magento\Core\Model\Url return $this->_session; } - /** * Return backend area front name, defined in configuration * @@ -373,7 +367,6 @@ class Url extends \Magento\Core\Model\Url if (!$this->_getData('area_front_name')) { $this->setData('area_front_name', $this->_backendHelper->getAreaFrontName()); } - return $this->_getData('area_front_name'); } @@ -391,7 +384,6 @@ class Url extends \Magento\Core\Model\Url $path = $this->getAreaFrontName() . '/' . $path; } } - return $path; } } diff --git a/app/code/Magento/Backend/Model/Url/Proxy.php b/app/code/Magento/Backend/Model/Url/Proxy.php deleted file mode 100644 index a12360168c352fb5afeef19988d6788804165893..0000000000000000000000000000000000000000 --- a/app/code/Magento/Backend/Model/Url/Proxy.php +++ /dev/null @@ -1,826 +0,0 @@ -<?php -/** - * Proxy class for \Magento\Backend\Model\Url - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Backend - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ -namespace Magento\Backend\Model\Url; - -/** -* @SuppressWarnings(PHPMD.ExcessivePublicCount) -*/ -class Proxy extends \Magento\Backend\Model\Url -{ - /** - * Object Manager instance - * - * @var \Magento\ObjectManager - */ - protected $_objectManager = null; - - /** - * @var \Magento\Backend\Model\Url - */ - protected $_object; - - /** - * Proxy constructor - * - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Get instance - * - * @return \Magento\Backend\Model\Url - */ - protected function _getObject() - { - if (null === $this->_object) { - $this->_object = $this->_objectManager->get('Magento\Backend\Model\Url'); - } - return $this->_object; - } - - /** - * {@inheritdoc} - */ - public function isSecure() - { - return $this->_getObject()->isSecure(); - } - - /** - * {@inheritdoc} - */ - public function setRouteParams(array $data, $unsetOldParams = true) - { - return $this->_getObject()->setRouteParams($data, $unsetOldParams); - } - - /** - * {@inheritdoc} - */ - public function getUrl($routePath = null, $routeParams = null) - { - return $this->_getObject()->getUrl($routePath, $routeParams); - } - - /** - * {@inheritdoc} - */ - public function getSecretKey($routeName = null, $controller = null, $action = null) - { - return $this->_getObject()->getSecretKey($routeName, $controller, $action); - } - - /** - * {@inheritdoc} - */ - public function useSecretKey() - { - return $this->_getObject()->useSecretKey(); - } - - /** - * {@inheritdoc} - */ - public function turnOnSecretKey() - { - return $this->_getObject()->turnOnSecretKey(); - } - - /** - * {@inheritdoc} - */ - public function turnOffSecretKey() - { - return $this->_getObject()->turnOffSecretKey(); - } - - /** - * {@inheritdoc} - */ - public function renewSecretUrls() - { - return $this->_getObject()->renewSecretUrls(); - } - - /** - * {@inheritdoc} - */ - public function getStartupPageUrl() - { - return $this->_getObject()->getStartupPageUrl(); - } - - /** - * {@inheritdoc} - */ - public function findFirstAvailableMenu() - { - return $this->_getObject()->findFirstAvailableMenu(); - } - - /** - * {@inheritdoc} - */ - public function setSession(\Magento\Backend\Model\Auth\Session $session) - { - return $this->_getObject()->setSession($session); - } - - /** - * {@inheritdoc} - */ - public function getAreaFrontName() - { - return $this->_getObject()->getAreaFrontName(); - } - - /** - * {@inheritdoc} - */ - public function getActionPath() - { - return $this->_getObject()->getActionPath(); - } - - /** - * {@inheritdoc} - */ - public function parseUrl($url) - { - return $this->_getObject()->parseUrl($url); - } - - /** - * {@inheritdoc} - */ - public function getDefaultControllerName() - { - return $this->_getObject()->getDefaultControllerName(); - } - - /** - * {@inheritdoc} - */ - public function setUseUrlCache($flag) - { - return $this->_getObject()->setUseUrlCache($flag); - } - - /** - * {@inheritdoc} - */ - public function setUseSession($useSession) - { - return $this->_getObject()->setUseSession($useSession); - } - - /** - * {@inheritdoc} - */ - public function setRouteFrontName($name) - { - return $this->_getObject()->setRouteFrontName($name); - } - - /** - * {@inheritdoc} - */ - public function getUseSession() - { - return $this->_getObject()->getUseSession(); - } - - /** - * {@inheritdoc} - */ - public function getDefaultActionName() - { - return $this->_getObject()->getDefaultActionName(); - } - - /** - * {@inheritdoc} - */ - public function getConfigData($key, $prefix = null) - { - return $this->_getObject()->getConfigData($key, $prefix); - } - - /** - * {@inheritdoc} - */ - public function setRequest(\Magento\App\RequestInterface $request) - { - return $this->_getObject()->setRequest($request); - } - - /** - * {@inheritdoc} - */ - public function getRequest() - { - return $this->_getObject()->getRequest(); - } - - /** - * {@inheritdoc} - */ - public function getType() - { - return $this->_getObject()->getType(); - } - - /** - * {@inheritdoc} - */ - public function setStore($params) - { - return $this->_getObject()->setStore($params); - } - - /** - * {@inheritdoc} - */ - public function getStore() - { - return $this->_getObject()->getStore(); - } - - /** - * {@inheritdoc} - */ - public function getBaseUrl($params = array()) - { - return $this->_getObject()->getBaseUrl($params); - } - - /** - * {@inheritdoc} - */ - public function setRoutePath($data) - { - return $this->_getObject()->setRoutePath($data); - } - - /** - * {@inheritdoc} - */ - public function getRoutePath($routeParams = array()) - { - return $this->_getObject()->getRoutePath($routeParams); - } - - /** - * {@inheritdoc} - */ - public function setRouteName($data) - { - return $this->_getObject()->setRouteName($data); - } - - /** - * {@inheritdoc} - */ - public function getRouteFrontName() - { - return $this->_getObject()->getRouteFrontName(); - } - - /** - * {@inheritdoc} - */ - public function getRouteName($default = null) - { - return $this->_getObject()->getRouteName($default); - } - - /** - * {@inheritdoc} - */ - public function setControllerName($data) - { - return $this->_getObject()->setControllerName($data); - } - - /** - * {@inheritdoc} - */ - public function getControllerName($default = null) - { - return $this->_getObject()->getControllerName($default); - } - - /** - * {@inheritdoc} - */ - public function setActionName($data) - { - return $this->_getObject()->setActionName($data); - } - - /** - * {@inheritdoc} - */ - public function getActionName($default = null) - { - return $this->_getObject()->getActionName($default); - } - - /** - * {@inheritdoc} - */ - public function getRouteParams() - { - return $this->_getObject()->getRouteParams(); - } - - /** - * {@inheritdoc} - */ - public function setRouteParam($key, $data) - { - return $this->_getObject()->setRouteParam($key, $data); - } - - /** - * {@inheritdoc} - */ - public function getRouteParam($key) - { - return $this->_getObject()->getRouteParam($key); - } - - /** - * {@inheritdoc} - */ - public function getRouteUrl($routePath = null, $routeParams = null) - { - return $this->_getObject()->getRouteUrl($routePath, $routeParams); - } - - /** - * {@inheritdoc} - */ - public function checkCookieDomains() - { - return $this->_getObject()->checkCookieDomains(); - } - - /** - * {@inheritdoc} - */ - public function addSessionParam() - { - return $this->_getObject()->addSessionParam(); - } - - /** - * {@inheritdoc} - */ - public function setQuery($data) - { - return $this->_getObject()->setQuery($data); - } - - /** - * {@inheritdoc} - */ - public function getQuery($escape = false) - { - return $this->_getObject()->getQuery($escape); - } - - /** - * {@inheritdoc} - */ - public function setQueryParams(array $data) - { - return $this->_getObject()->setQueryParams($data); - } - - /** - * {@inheritdoc} - */ - public function purgeQueryParams() - { - return $this->_getObject()->purgeQueryParams(); - } - - /** - * {@inheritdoc} - */ - public function getQueryParams() - { - return $this->_getObject()->getQueryParams(); - } - - /** - * {@inheritdoc} - */ - public function setQueryParam($key, $data) - { - return $this->_getObject()->setQueryParam($key, $data); - } - - /** - * {@inheritdoc} - */ - public function getQueryParam($key) - { - return $this->_getObject()->getQueryParam($key); - } - - /** - * {@inheritdoc} - */ - public function setFragment($data) - { - return $this->_getObject()->setFragment($data); - } - - /** - * {@inheritdoc} - */ - public function getFragment() - { - return $this->_getObject()->getFragment(); - } - - /** - * {@inheritdoc} - */ - public function getRebuiltUrl($url) - { - return $this->_getObject()->getRebuiltUrl($url); - } - - /** - * {@inheritdoc} - */ - public function escape($value) - { - return $this->_getObject()->escape($value); - } - - /** - * {@inheritdoc} - */ - public function getDirectUrl($url, $params = array()) - { - return $this->_getObject()->getDirectUrl($url, $params); - } - - /** - * {@inheritdoc} - */ - public function sessionUrlVar($html) - { - return $this->_getObject()->sessionUrlVar($html); - } - - /** - * {@inheritdoc} - */ - public function useSessionIdForUrl($secure = false) - { - return $this->_getObject()->useSessionIdForUrl($secure); - } - - /** - * {@inheritdoc} - */ - public function sessionVarCallback($match) - { - return $this->_getObject()->sessionVarCallback($match); - } - - /** - * {@inheritdoc} - */ - public function isOwnOriginUrl() - { - return $this->_getObject()->isOwnOriginUrl(); - } - - /** - * {@inheritdoc} - */ - public function getRedirectUrl($url) - { - return $this->_getObject()->getRedirectUrl($url); - } - - /** - * {@inheritdoc} - */ - public function isDeleted($isDeleted = null) - { - return $this->_getObject()->isDeleted($isDeleted); - } - - /** - * {@inheritdoc} - */ - public function hasDataChanges() - { - return $this->_getObject()->hasDataChanges(); - } - - /** - * {@inheritdoc} - */ - public function setIdFieldName($name) - { - return $this->_getObject()->setIdFieldName($name); - } - - /** - * {@inheritdoc} - */ - public function getIdFieldName() - { - return $this->_getObject()->getIdFieldName(); - } - - /** - * {@inheritdoc} - */ - public function getId() - { - return $this->_getObject()->getId(); - } - - /** - * {@inheritdoc} - */ - public function setId($value) - { - return $this->_getObject()->setId($value); - } - - /** - * {@inheritdoc} - */ - public function addData(array $arr) - { - return $this->_getObject()->addData($arr); - } - - /** - * {@inheritdoc} - */ - public function setData($key, $value = null) - { - return $this->_getObject()->setData($key, $value); - } - - /** - * {@inheritdoc} - */ - public function unsetData($key = null) - { - return $this->_getObject()->unsetData($key); - } - - /** - * {@inheritdoc} - */ - public function getData($key = '', $index = null) - { - return $this->_getObject()->getData($key, $index); - } - - /** - * {@inheritdoc} - */ - public function getDataByPath($path) - { - return $this->_getObject()->getDataByPath($path); - } - - /** - * {@inheritdoc} - */ - public function getDataByKey($key) - { - return $this->_getObject()->getDataByKey($key); - } - - /** - * {@inheritdoc} - */ - public function setDataUsingMethod($key, $args = array()) - { - return $this->_getObject()->setDataUsingMethod($key, $args); - } - - /** - * {@inheritdoc} - */ - public function getDataUsingMethod($key, $args = null) - { - return $this->_getObject()->getDataUsingMethod($key, $args); - } - - /** - * {@inheritdoc} - */ - public function getDataSetDefault($key, $default) - { - return $this->_getObject()->getDataSetDefault($key, $default); - } - - /** - * {@inheritdoc} - */ - public function hasData($key = '') - { - return $this->_getObject()->hasData($key); - } - - /** - * {@inheritdoc} - */ - public function toArray(array $keys = array()) - { - return $this->_getObject()->toArray($keys); - } - - /** - * {@inheritdoc} - */ - public function convertToArray(array $keys = array()) - { - return $this->_getObject()->convertToArray($keys); - } - - /** - * {@inheritdoc} - */ - public function toXml(array $keys = array(), $rootName = 'item', $addOpenTag = false, $addCdata = true) - { - return $this->_getObject()->toXml($keys, $rootName, $addOpenTag, $addCdata); - } - - /** - * {@inheritdoc} - */ - public function convertToXml( - array $arrAttributes = array(), - $rootName = 'item', - $addOpenTag = false, - $addCdata = true - ) { - return $this->_getObject()->convertToXml($arrAttributes, $rootName, $addOpenTag, $addCdata); - } - - /** - * {@inheritdoc} - */ - public function toJson(array $keys = array()) - { - return $this->_getObject()->toJson($keys); - } - - /** - * {@inheritdoc} - */ - public function convertToJson(array $keys = array()) - { - return $this->_getObject()->convertToJson($keys); - } - - /** - * {@inheritdoc} - */ - public function toString($format = '') - { - return $this->_getObject()->toString($format); - } - - /** - * {@inheritdoc} - */ - public function __call($method, $args) - { - return $this->_getObject()->__call($method, $args); - } - - /** - * {@inheritdoc} - */ - public function isEmpty() - { - return $this->_getObject()->isEmpty(); - } - - /** - * {@inheritdoc} - */ - public function serialize($keys = array(), $valueSeparator = '=', $fieldSeparator = ' ', $quote = '"') - { - return $this->_getObject()->serialize($keys, $valueSeparator, $fieldSeparator, $quote); - } - - /** - * {@inheritdoc} - */ - public function setOrigData($key = null, $data = null) - { - return $this->_getObject()->setOrigData($key, $data); - } - - /** - * {@inheritdoc} - */ - public function getOrigData($key = null) - { - return $this->_getObject()->getOrigData($key); - } - - /** - * {@inheritdoc} - */ - public function dataHasChangedFor($field) - { - return $this->_getObject()->dataHasChangedFor($field); - } - - /** - * {@inheritdoc} - */ - public function setDataChanges($value) - { - return $this->_getObject()->setDataChanges($value); - } - - /** - * {@inheritdoc} - */ - public function debug($data = null, &$objects = array()) - { - return $this->_getObject()->debug($data, $objects); - } - - /** - * {@inheritdoc} - */ - public function offsetSet($offset, $value) - { - $this->_getObject()->offsetSet($offset, $value); - } - - /** - * {@inheritdoc} - */ - public function offsetExists($offset) - { - return $this->_getObject()->offsetExists($offset); - } - - /** - * {@inheritdoc} - */ - public function offsetUnset($offset) - { - $this->_getObject()->offsetUnset($offset); - } - - /** - * {@inheritdoc} - */ - public function offsetGet($offset) - { - return $this->_getObject()->offsetGet($offset); - } -} diff --git a/app/code/Magento/Backend/etc/adminhtml/di.xml b/app/code/Magento/Backend/etc/adminhtml/di.xml index 714ade4dfffb8613c67e5b15fe1da7126d706187..ab4b298d5a8ae38cf04dbc3d08d2cc09e6495583 100644 --- a/app/code/Magento/Backend/etc/adminhtml/di.xml +++ b/app/code/Magento/Backend/etc/adminhtml/di.xml @@ -27,11 +27,18 @@ <preference for="Magento\Authorization\Policy" type="Magento\Authorization\Policy\Acl" /> <preference for="Magento\Authorization\RoleLocator" type="Magento\Backend\Model\Authorization\RoleLocator" /> <preference for="Magento\Core\Model\LocaleInterface" type="Magento\Backend\Model\Locale" /> + <preference for="Magento\Core\Controller\Varien\Action\Context" type="Magento\Backend\Controller\Context" /> <preference for="Magento\UrlInterface" type="Magento\Backend\Model\Url" /> <preference for="Magento\Backend\Model\Auth\StorageInterface" type="Magento\Backend\Model\Auth\Session" /> <preference for="Magento\Backend\Model\Config\Structure\SearchInterface" type="Magento\Backend\Model\Config\Structure" /> <preference for="Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface" type="Magento\Backend\Model\Config\Backend\File\RequestData" /> - <preference for="Magento\Acl\Resource\ProviderInterface" type="Magento\Acl\Resource\Provider"/> + <preference for="Magento\Acl\Resource\ProviderInterface" type="Magento\Acl\Resource\Provider" /> + <preference for="Magento\App\DefaultPathInterface" type="Magento\Backend\App\DefaultPath" /> + <type name="Magento\Backend\Model\Auth\Session"> + <param name="backendUrl"> + <instance type="Magento\Backend\Model\Url\Proxy" /> + </param> + </type> <type name="Magento\Acl\Resource\Config\Reader\Filesystem"> <param name="converter"> <instance type="Magento\Acl\Resource\Config\Converter\Dom"/> @@ -101,4 +108,20 @@ <value>adminhtml</value> </param> </type> + <type name="Magento\App\RouterList"> + <param name="routerList"> + <value> + <admin> + <instance>Magento\Backend\App\Router\DefaultRouter</instance> + <disable type="bool">false</disable> + <sortOrder>10</sortOrder> + </admin> + <default> + <instance>Magento\App\Router\DefaultRouter</instance> + <disable type="bool">false</disable> + <sortOrder>100</sortOrder> + </default> + </value> + </param> + </type> </config> diff --git a/app/code/Magento/Backend/etc/adminhtml/menu.xml b/app/code/Magento/Backend/etc/adminhtml/menu.xml new file mode 100644 index 0000000000000000000000000000000000000000..126f3323af44dcb12117ddac35203b9933647c0f --- /dev/null +++ b/app/code/Magento/Backend/etc/adminhtml/menu.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Backend + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <menu> + <add id="Magento_Adminhtml::system_design_schedule" title="Schedule" module="Magento_Adminhtml" sortOrder="30" parent="Magento_Adminhtml::system_design" action="adminhtml/system_design" resource="Magento_Adminhtml::schedule"/> + <add id="Magento_Adminhtml::system_currency" title="Currency" module="Magento_Adminhtml" sortOrder="30" parent="Magento_Adminhtml::stores" action="adminhtml/system_currency" resource="Magento_CurrencySymbol::system_currency"/> + <add id="Magento_Adminhtml::system_email_template" title="Email Templates" module="Magento_Adminhtml" sortOrder="10" parent="Magento_Adminhtml::marketing_communications" action="adminhtml/system_email_template" resource="Magento_Adminhtml::email_template"/> + <add id="Magento_Adminhtml::system_variable" title="Custom Variables" module="Magento_Adminhtml" sortOrder="20" parent="Magento_Adminhtml::system_other_settings" action="adminhtml/system_variable" resource="Magento_Adminhtml::variable"/> + <add id="Magento_Adminhtml::system_store" title="All Stores" module="Magento_Core" sortOrder="10" parent="Magento_Adminhtml::stores_settings" action="adminhtml/system_store/" resource="Magento_Adminhtml::store"/> + <add id="Magento_Adminhtml::system_config" title="Configuration" module="Magento_Adminhtml" sortOrder="20" parent="Magento_Adminhtml::stores_settings" action="adminhtml/system_config" resource="Magento_Adminhtml::config"/> + </menu> +</config> diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index a0a9149973e53c8e720140622012891356358e0b..ad993575d845903f387e1c19f46cedd4b67a665a 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -223,12 +223,12 @@ <field id="file" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>System Log File Name</label> <backend_model>Magento\Backend\Model\Config\Backend\Filename</backend_model> - <comment>Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log</comment> + <comment>Logging from \Magento\Logger. File is located in {{base_dir}}/var/log</comment> </field> <field id="exception_file" translate="label comment" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Exceptions Log File Name</label> <backend_model>Magento\Backend\Model\Config\Backend\Filename</backend_model> - <comment>Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log</comment> + <comment>Logging from \Magento\Logger. File is located in {{base_dir}}/var/log</comment> </field> </group> <group id="js" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Backend/etc/di.xml b/app/code/Magento/Backend/etc/di.xml index dc0a768235b6b6eb054d1bc9c645d38e67fd1d2f..d29d52fcbcd149331ccfbb7c6c85cf0026d3cc02 100644 --- a/app/code/Magento/Backend/etc/di.xml +++ b/app/code/Magento/Backend/etc/di.xml @@ -31,6 +31,7 @@ <value> <adminhtml> <frontNameResolver>Magento\Backend\App\Area\FrontNameResolver</frontNameResolver> + <router>admin</router> </adminhtml> </value> </param> @@ -40,22 +41,10 @@ <instance type="Magento\Core\Model\Translate\Proxy" /> </param> </type> - <type name="Magento\Backend\Controller\Router\DefaultRouter"> - <param name="controllerFactory"> - <instance type="Magento\Backend\Controller\Factory" /> - </param> - <param name="areaCode"> - <value>adminhtml</value> - </param> - <param name="baseController"> - <value>Magento\Backend\Controller\AbstractAction</value> - </param> + <type name="Magento\Backend\App\Router\DefaultRouter"> <param name="routerId"> <value>admin</value> </param> - <param name="defaultRouteId"> - <value>adminhtml</value> - </param> </type> <type name="Magento\Backend\Controller\Adminhtml\System\Config\Save"> <param name="cache"> @@ -65,26 +54,12 @@ <type name="Magento\Backend\Model\Menu\Config"> <param name="menuDirector"><instance type="Magento\Backend\Model\Menu\Director\Director"/></param> </type> - <type name="Magento\App\RouterList"> - <param name="routerList"> - <value> - <admin> - <instance>Magento\Backend\Controller\Router\DefaultRouter</instance> - <disable type="bool">false</disable> - <sortOrder>10</sortOrder> - </admin> - </value> - </param> - </type> <type name="Magento\Backend\App\Area\FrontNameResolver"> <param name="defaultFrontName"> <value type="argument">Magento\Backend\App\Area\FrontNameResolver::PARAM_BACKEND_FRONT_NAME</value> </param> </type> <type name="Magento\Backend\Helper\Data"> - <param name="app"> - <instance type="Magento\Core\Model\AppInterface" /> - </param> <param name="backendUrl"> <instance type="Magento\Backend\Model\Url\Proxy" /> </param> @@ -111,10 +86,36 @@ <param name="authSession"> <instance type="Magento\Backend\Model\Auth\Session\Proxy" /> </param> + <param name="areaCode"> + <value>adminhtml</value> + </param> + </type> + <type name="Magento\Core\Model\Url"> + <param name="areaCode"> + <value>frontend</value> + </param> </type> <type name="Magento\Backend\Helper\Dashboard\Data"> <param name="installDate"> <value type="argument">Magento\App\State::PARAM_INSTALL_DATE</value> </param> </type> + <type name="Magento\Backend\Controller\Adminhtml\Index"> + <param name="searchModules"> + <value> + <products> + <class>Magento\Adminhtml\Model\Search\Catalog</class> + <acl>Magento_Catalog::catalog</acl> + </products> + <customers> + <class>Magento\Adminhtml\Model\Search\Customer</class> + <acl>Magento_Customer::customer</acl> + </customers> + <sales> + <class>Magento\Adminhtml\Model\Search\Order</class> + <acl>Magento_Sales::sales</acl> + </sales> + </value> + </param> + </type> </config> diff --git a/app/code/Magento/Backend/view/adminhtml/admin/login.phtml b/app/code/Magento/Backend/view/adminhtml/admin/login.phtml index 1ff8ecd7fc51694fdc84b0b866029e12d6366a82..1c295f207b9d90aca692cce40ba9ec6b9e38f439 100644 --- a/app/code/Magento/Backend/view/adminhtml/admin/login.phtml +++ b/app/code/Magento/Backend/view/adminhtml/admin/login.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/admin/login_buttons.phtml b/app/code/Magento/Backend/view/adminhtml/admin/login_buttons.phtml index c6586d097f30803aebf367eaa1751cad21a9257b..963349ca5c3a1e060fb847ee6e984e1c63156c15 100644 --- a/app/code/Magento/Backend/view/adminhtml/admin/login_buttons.phtml +++ b/app/code/Magento/Backend/view/adminhtml/admin/login_buttons.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/graph.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/graph.phtml index 61439c7256d96e80f9049ec535ba0dbc65dadc9f..bf2b87365a28e23bdad0c929409119d7e0ed93f8 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/graph.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/graph.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/graph/disabled.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/graph/disabled.phtml index b8650bb083b8ef3588e52e951656d5a73d1e58f3..76e644395d4c6a5ec7824f1d86ec1fb7980f2d0a 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/graph/disabled.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/graph/disabled.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/grid.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/grid.phtml index d96f5489a361e0c0a1d0327bd73d07a42d4106ae..be72203356e454b817085e6cb8701c465bec657b 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/grid.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/index.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/index.phtml index c6f41fc3817d82d78d909760da1b2cf0f961b77e..cd89eac74d197ea9e90a50c099b4f334c014da23 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/index.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/index.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/salebar.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/salebar.phtml index 76ada03d5af8d5ef4b4e814b08f63e9a06a2cf2b..2ec69fc81f5dfbdd605d025a52356585bc329936 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/salebar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/salebar.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/searches.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/searches.phtml index 1eb3405169fc05785e84b3b41ec089351ed48b0b..03a7ea8c38ce7dcb715fef8b93f4788febce477d 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/searches.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/searches.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/store/switcher.phtml index 578893f6c347cda2ab6954aa9231a38e202ccc1d..9585f0d28e75c12b8c6124cd1aba1b16b88e2ee5 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/store/switcher.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/totalbar.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/totalbar.phtml index 647a23c79f9d99f352f3d05787cfa3228ed1fcce..fc3f2b27293e478e03c9c26abeb99d9463e24bcb 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/totalbar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/totalbar.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_index.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_index.xml index 723228f23f8c2227397c1469cc6a63dbd62f7f12..eaa1fda5499f83af79156b7a4b69a43cb1178822 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_index.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_index.xml @@ -28,6 +28,6 @@ <update handle="adminhtml_cache_block"/> <referenceContainer name="content"> <block class="Magento\Adminhtml\Block\Cache" name="adminhtml.cache.container"/> - <block class="Magento\Adminhtml\Block\Cache\Additional" name="cache.additional" template="system/cache/additional.phtml"/> + <block class="Magento\Adminhtml\Block\Cache\Additional" name="cache.additional" template="Magento_Backend::system/cache/additional.phtml"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_account_index.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_account_index.xml similarity index 91% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_account_index.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_account_index.xml index bf2e43f899c43e48ba05bddfc7ec203eb07080b3..6cd7c77ef01ae6f67010dbd27f5e611a4dff4a0c 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_account_index.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_account_index.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\System\Account\Edit" name="adminhtml.system.account.edit"/> + <block class="Magento\Backend\Block\System\Account\Edit" name="adminhtml.system.account.edit"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_backup_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_backup_block.xml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_backup_block.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_backup_block.xml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_backup_grid.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_backup_grid.xml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_backup_grid.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_backup_grid.xml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_backup_index.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_backup_index.xml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_backup_index.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_backup_index.xml diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml index 180d7d7390e8e6cf5f98c8be27c8db7591afb7fa..0c1c259cc62cf9f0848ee384fc5e4fefbf73e018 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml @@ -32,9 +32,9 @@ </block> </referenceBlock> <referenceContainer name="js"> - <block class="Magento\Adminhtml\Block\System\Shipping\Ups" template="Magento_Adminhtml::system/shipping/ups.phtml"/> - <block class="Magento\Backend\Block\Template" template="system/config/js.phtml"/> - <block class="Magento\Backend\Block\Template" template="Magento_Adminhtml::system/shipping/applicable_country.phtml"/> + <block class="Magento\Backend\Block\System\Shipping\Ups" template="Magento_Backend::system/shipping/ups.phtml"/> + <block class="Magento\Backend\Block\Template" template="Magento_Backend::system/config/js.phtml"/> + <block class="Magento\Backend\Block\Template" template="Magento_Backend::system/shipping/applicable_country.phtml"/> </referenceContainer> <referenceContainer name="left"> <block class="Magento\Backend\Block\System\Config\Tabs" name="adminhtml.system.config.tabs" before="-"/> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_design_grid.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_grid.xml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_design_grid.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_grid.xml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_design_grid_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_grid_block.xml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_design_grid_block.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_grid_block.xml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_design_index.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_index.xml similarity index 91% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_design_index.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_index.xml index fa12086f7582fb8b733b04e095b39c4cd438c974..cc04ea783bf3a16fd4441d7adf2c0734faa89105 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_design_index.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_design_index.xml @@ -27,6 +27,6 @@ <update handle="formkey"/> <update handle="adminhtml_system_design_grid_block"/> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\System\Design" name="adminhtml.system.design.container"/> + <block class="Magento\Backend\Block\System\Design" name="adminhtml.system.design.container"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_email_template_grid.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_email_template_grid.xml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_email_template_grid.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_email_template_grid.xml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_email_template_grid_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_email_template_grid_block.xml similarity index 96% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_email_template_grid_block.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_email_template_grid_block.xml index b7d0ddb332227eb7cacd2222515f88a393496b7c..66fe5a010da4a32ec9a45aab3da38220787f2c0c 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_email_template_grid_block.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_email_template_grid_block.xml @@ -83,8 +83,8 @@ <arguments> <argument name="header" xsi:type="string" translate="true">Template Type</argument> <argument name="index" xsi:type="string">template_type</argument> - <argument name="filter" xsi:type="string">Magento\Adminhtml\Block\System\Email\Template\Grid\Filter\Type</argument> - <argument name="renderer" xsi:type="string">Magento\Adminhtml\Block\System\Email\Template\Grid\Renderer\Type</argument> + <argument name="filter" xsi:type="string">Magento\Backend\Block\System\Email\Template\Grid\Filter\Type</argument> + <argument name="renderer" xsi:type="string">Magento\Backend\Block\System\Email\Template\Grid\Renderer\Type</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="action"> @@ -94,7 +94,7 @@ <argument name="sortable" xsi:type="string">0</argument> <argument name="filter" xsi:type="string">0</argument> <argument name="width" xsi:type="string">100px</argument> - <argument name="renderer" xsi:type="string">Magento\Adminhtml\Block\System\Email\Template\Grid\Renderer\Action</argument> + <argument name="renderer" xsi:type="string">Magento\Backend\Block\System\Email\Template\Grid\Renderer\Action</argument> </arguments> </block> </block> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_email_template_index.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_email_template_index.xml similarity index 90% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_email_template_index.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_email_template_index.xml index 8535c616836224e04e94429c1380014fe460b3fb..9fc97306f6acbfc019ea18b8a41a365f9577374f 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_email_template_index.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_email_template_index.xml @@ -26,6 +26,6 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="adminhtml_system_email_template_grid_block"/> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\System\Email\Template" name="adminhtml.system.email.template.container"/> + <block class="Magento\Backend\Block\System\Email\Template" name="adminhtml.system.email.template.container"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/systemPreview.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_preview.xml similarity index 85% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/systemPreview.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_preview.xml index a41326033d52df7b7843977709acf6f546d7e76a..3e8595af2dfd003faf5af487c209fca1fb24a9b8 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/systemPreview.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_preview.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Core\Block\Template" name="root" output="1" template="Magento_Adminhtml::system/email/template/preview.phtml"> - <block class="Magento\Adminhtml\Block\System\Email\Template\Preview" name="content" as="content"/> + <block class="Magento\Core\Block\Template" name="root" output="1" template="Magento_Backend::system/email/template/preview.phtml"> + <block class="Magento\Backend\Block\System\Email\Template\Preview" name="content" as="content"/> </block> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_store_grid_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_store_grid_block.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml index b6b9e7d3686eb713de66ec1323d3a2123ccb7606..2923080143540f62791bde8c49a5ea410855b5af 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_store_grid_block.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml @@ -41,7 +41,7 @@ <argument name="align" xsi:type="string">left</argument> <argument name="index" xsi:type="string">name</argument> <argument name="filter_index" xsi:type="string">main_table.name</argument> - <argument name="renderer" xsi:type="string">Magento\Adminhtml\Block\System\Store\Grid\Render\Website</argument> + <argument name="renderer" xsi:type="string">Magento\Backend\Block\System\Store\Grid\Render\Website</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="group_title"> @@ -50,7 +50,7 @@ <argument name="align" xsi:type="string">left</argument> <argument name="index" xsi:type="string">group_title</argument> <argument name="filter_index" xsi:type="string">group_table.name</argument> - <argument name="renderer" xsi:type="string">Magento\Adminhtml\Block\System\Store\Grid\Render\Group</argument> + <argument name="renderer" xsi:type="string">Magento\Backend\Block\System\Store\Grid\Render\Group</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="store_title"> @@ -59,7 +59,7 @@ <argument name="align" xsi:type="string">left</argument> <argument name="index" xsi:type="string">store_title</argument> <argument name="filter_index" xsi:type="string">store_table.name</argument> - <argument name="renderer" xsi:type="string">Magento\Adminhtml\Block\System\Store\Grid\Render\Store</argument> + <argument name="renderer" xsi:type="string">Magento\Backend\Block\System\Store\Grid\Render\Store</argument> </arguments> </block> </block> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_store_index.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_index.xml similarity index 91% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_store_index.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_index.xml index 2fcbcc237b282108409ac2c6da668b821b31f7bc..5ac0e0da916c2d0b3326587c6eac5e4de3dbd955 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_store_index.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_index.xml @@ -27,6 +27,6 @@ <update handle="formkey"/> <update handle="adminhtml_system_store_grid_block"/> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\System\Store\Store" name="adminhtml.system.store.container"/> + <block class="Magento\Backend\Block\System\Store\Store" name="adminhtml.system.store.container"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_variable_grid_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_variable_grid_block.xml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_variable_grid_block.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_variable_grid_block.xml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_variable_index.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_variable_index.xml similarity index 91% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_variable_index.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_variable_index.xml index 53ffa9dce3c03f19e1b9860114139f67100eb820..35d0345082a1a4333dbed36f026f432f948334af 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_system_variable_index.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_variable_index.xml @@ -26,6 +26,6 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="adminhtml_system_variable_grid_block"/> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\System\Variable" name="adminhtml.system.variable.grid.container"/> + <block class="Magento\Backend\Block\System\Variable" name="adminhtml.system.variable.grid.container"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Backend/view/adminhtml/menu.phtml b/app/code/Magento/Backend/view/adminhtml/menu.phtml index 8c86cb11f071cb4c2703176aebfe1338a395b071..999f15e016ab36e0f53f30495aca88ee3c0eef2a 100644 --- a/app/code/Magento/Backend/view/adminhtml/menu.phtml +++ b/app/code/Magento/Backend/view/adminhtml/menu.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/store/switcher.phtml index 3b07817032339f54025d00f7c5e29ab64b54b37e..8cf7b5874445151dbf52936f31dd6965c6d1f06c 100644 --- a/app/code/Magento/Backend/view/adminhtml/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/store/switcher.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/store/switcher/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/store/switcher/form/renderer/fieldset.phtml index a894c993279106d7f44ef5c528e2a1ce7e95684e..d3f0cf7ca11e0b8759f7942f8536e457a7cc52e1 100644 --- a/app/code/Magento/Backend/view/adminhtml/store/switcher/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/store/switcher/form/renderer/fieldset.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/store/switcher/form/renderer/fieldset/element.phtml b/app/code/Magento/Backend/view/adminhtml/store/switcher/form/renderer/fieldset/element.phtml index fa3a845000558a56d5c3cb0fa93f3ebff090dc23..de056cb824e2292385221d1d3224f600d194984d 100644 --- a/app/code/Magento/Backend/view/adminhtml/store/switcher/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/store/switcher/form/renderer/fieldset/element.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/autocomplete.phtml b/app/code/Magento/Backend/view/adminhtml/system/autocomplete.phtml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/system/autocomplete.phtml rename to app/code/Magento/Backend/view/adminhtml/system/autocomplete.phtml index c8812b8ddbc36738b6f26fc1c9b158238345c1ba..45088e85dc05bded95a2c156608ac4ea577213ba 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/autocomplete.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/autocomplete.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/cache/additional.phtml b/app/code/Magento/Backend/view/adminhtml/system/cache/additional.phtml similarity index 98% rename from app/code/Magento/Adminhtml/view/adminhtml/system/cache/additional.phtml rename to app/code/Magento/Backend/view/adminhtml/system/cache/additional.phtml index c96ac544f3a17ec16072f44e34ccfedae146579a..f4ebb44d9921df94acc6fa2f1aa5fc3574813806 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/cache/additional.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/cache/additional.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/cache/edit.phtml b/app/code/Magento/Backend/view/adminhtml/system/cache/edit.phtml similarity index 99% rename from app/code/Magento/Adminhtml/view/adminhtml/system/cache/edit.phtml rename to app/code/Magento/Backend/view/adminhtml/system/cache/edit.phtml index 3cfe5d47586981cc8cc7464117dc6ddcb2fd1c2a..e29662420de49d8bb9d962efc93c02e8edf5bdfa 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/cache/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/cache/edit.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/system/config/edit.phtml b/app/code/Magento/Backend/view/adminhtml/system/config/edit.phtml index eda5ad2b33d6f2b05bbc7c69de471622ab3332fe..7a86604835f80a049c8be42705d82b2b00f056f4 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/config/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/config/edit.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/system/config/form/field/array.phtml b/app/code/Magento/Backend/view/adminhtml/system/config/form/field/array.phtml index f6c19c2ae8a1ff590152eebde1ba26dd88223741..7be4103d396fd49d43184fc3ee0b07f0590f28f3 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/config/form/field/array.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/config/form/field/array.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/system/config/js.phtml b/app/code/Magento/Backend/view/adminhtml/system/config/js.phtml index 85234baccffa5b6f711f88ae9b3aa7c1a6445595..32bd506bc595a2630ab5712b53e186f8998bab4d 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/config/js.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/config/js.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/system/config/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/system/config/switcher.phtml index 0f8670887ad57ddf32ac96018057ca2361891cea..6d93a8c0deb4cd00b4b2f7cfe2988c721062219c 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/config/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/config/switcher.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/system/config/system/storage/media/synchronize.phtml b/app/code/Magento/Backend/view/adminhtml/system/config/system/storage/media/synchronize.phtml index cfc087aa50f0dbf69b0c40a1023a7dea49d33b23..f450da745e7c627ec6c7b2deb09ab92c546eefdd 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/config/system/storage/media/synchronize.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/config/system/storage/media/synchronize.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/system/config/tabs.phtml b/app/code/Magento/Backend/view/adminhtml/system/config/tabs.phtml index a4e193cbfb74f023d99d4de7f442133e7720d08c..0df4889ee25f15093ec740749964422c793de7ae 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/config/tabs.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/config/tabs.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/design/edit.phtml b/app/code/Magento/Backend/view/adminhtml/system/design/edit.phtml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/system/design/edit.phtml rename to app/code/Magento/Backend/view/adminhtml/system/design/edit.phtml index a1fe5885e83a765d735f6140fdeb4e9b093b803e..b6a98334bcfefd9482df794a3803cd33defb17e5 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/design/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/design/edit.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/design/index.phtml b/app/code/Magento/Backend/view/adminhtml/system/design/index.phtml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/system/design/index.phtml rename to app/code/Magento/Backend/view/adminhtml/system/design/index.phtml index 20b3ab283ff7ca5cc73114cb503157409a804937..609b0428e54d7ef17ec081a2bf0a0ce50b0eb43b 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/design/index.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/design/index.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/email/template/edit.phtml b/app/code/Magento/Backend/view/adminhtml/system/email/template/edit.phtml similarity index 99% rename from app/code/Magento/Adminhtml/view/adminhtml/system/email/template/edit.phtml rename to app/code/Magento/Backend/view/adminhtml/system/email/template/edit.phtml index 29aa9f74669ab3766dfd518e7b7bf88a8b10cde9..bb574a0262374a9be75fb60ea2e973f48a86ba67 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/email/template/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/email/template/edit.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/email/template/list.phtml b/app/code/Magento/Backend/view/adminhtml/system/email/template/list.phtml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/system/email/template/list.phtml rename to app/code/Magento/Backend/view/adminhtml/system/email/template/list.phtml index 13b521b7a0e7ca701c8c7157f3c101e3a9e9b79f..cddb9e6a45b23cb0b8b6af0af53df7547c0fa7ea 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/email/template/list.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/email/template/list.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/email/template/preview.phtml b/app/code/Magento/Backend/view/adminhtml/system/email/template/preview.phtml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/system/email/template/preview.phtml rename to app/code/Magento/Backend/view/adminhtml/system/email/template/preview.phtml index e5cf6f527cf4dc9fc037d3b4cc4fefbbe1376c0c..4d76822f61cff9b40af119f330a6927c088c471b 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/email/template/preview.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/email/template/preview.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/info.phtml b/app/code/Magento/Backend/view/adminhtml/system/info.phtml similarity index 99% rename from app/code/Magento/Adminhtml/view/adminhtml/system/info.phtml rename to app/code/Magento/Backend/view/adminhtml/system/info.phtml index 9effc802f309739be9dfe24e471ffb4b92759035..755bfc65c01baff0f30c763aef4357a05cfb56aa 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/info.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/info.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/search.phtml b/app/code/Magento/Backend/view/adminhtml/system/search.phtml similarity index 98% rename from app/code/Magento/Adminhtml/view/adminhtml/system/search.phtml rename to app/code/Magento/Backend/view/adminhtml/system/search.phtml index 146aaf1568b2fb764ff97358e6c46d1c504f3344..ab6b55b82065efedb9fbed76fd9cc14d0b259762 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/search.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/search.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/shipping/applicable_country.phtml b/app/code/Magento/Backend/view/adminhtml/system/shipping/applicable_country.phtml similarity index 99% rename from app/code/Magento/Adminhtml/view/adminhtml/system/shipping/applicable_country.phtml rename to app/code/Magento/Backend/view/adminhtml/system/shipping/applicable_country.phtml index d64fcebf5a4b8db00966dd69fde8a3d8cb1e94fe..e39627a853145701ab37483b599e70da70d01219 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/shipping/applicable_country.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/shipping/applicable_country.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/shipping/ups.phtml b/app/code/Magento/Backend/view/adminhtml/system/shipping/ups.phtml similarity index 98% rename from app/code/Magento/Adminhtml/view/adminhtml/system/shipping/ups.phtml rename to app/code/Magento/Backend/view/adminhtml/system/shipping/ups.phtml index 9f126621f94d39da281e8fc69cd6461a2207a730..f1137d7749efc053047527077968a2072abade07 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/shipping/ups.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/shipping/ups.phtml @@ -19,13 +19,13 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ /** @var $upsModel \Magento\Usa\Model\Shipping\Carrier\Ups */ -/** @var $this \Magento\Adminhtml\Block\System\Shipping\Ups */ +/** @var $this \Magento\Backend\Block\System\Shipping\Ups */ $upsModel = $this->getShippingModel(); $orShipArr = $upsModel->getCode('originShipment'); $defShipArr = $upsModel->getCode('method'); @@ -125,7 +125,7 @@ if (!$storeCode && $websiteCode) { while (freeMethod.length > 0) { freeMethod.remove(0); } - freeMethod.insert(new Element('option', {value:''}).update('<?php echo $_coreHelper->escapeHtml(__('None')); ?>')); + freeMethod.insert(new Element('option', {value:''}).update('<?php echo $this->escapeHtml(__('None')); ?>')); var code, option; for (code in originShipment) { diff --git a/app/code/Magento/Adminhtml/view/adminhtml/system/variable/js.phtml b/app/code/Magento/Backend/view/adminhtml/system/variable/js.phtml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/system/variable/js.phtml rename to app/code/Magento/Backend/view/adminhtml/system/variable/js.phtml index 1a62371a4e8110cbfa715fadd91aa2b5bbdfc608..a79768440c2311b4180045594424ff8d752f3567 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/system/variable/js.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/variable/js.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Adminhtml/view/adminhtml/variables.js b/app/code/Magento/Backend/view/adminhtml/variables.js similarity index 99% rename from app/code/Magento/Adminhtml/view/adminhtml/variables.js rename to app/code/Magento/Backend/view/adminhtml/variables.js index ec3910f6a4a2bdd880cded0370840509824ede57..9c3510969e8c5b692d81000278956433c972ef29 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/variables.js +++ b/app/code/Magento/Backend/view/adminhtml/variables.js @@ -18,7 +18,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/accordion.phtml b/app/code/Magento/Backend/view/adminhtml/widget/accordion.phtml index 18b3f319a3c30503427e4fabff515fe0529d2662..4c68414e32d7fc5b91abccfcfff9054228f81d5e 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/accordion.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/accordion.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/breadcrumbs.phtml b/app/code/Magento/Backend/view/adminhtml/widget/breadcrumbs.phtml index 15358a51f5c81b5d4061516517a6c5c31ebb24ee..5b8fc46ff8012be8c1e4ba4f20b7766e2bc0a985 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/breadcrumbs.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/breadcrumbs.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/button.phtml b/app/code/Magento/Backend/view/adminhtml/widget/button.phtml index 1461c40ae28cdc9ef5b4819ae1768934fb9271a3..0e0bf1a04792300fde2dde832fe8ad38b7e7d34d 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/button.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/button.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/button/split.phtml b/app/code/Magento/Backend/view/adminhtml/widget/button/split.phtml index 3a67b3d3476e8c5fefacc36a1e78f004eb079862..8b43ca435889b853b14f44c004053333fd146f03 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/button/split.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/button/split.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/form.phtml b/app/code/Magento/Backend/view/adminhtml/widget/form.phtml index f1802e5b6794dfe27cca07a0425860e307c89fa1..73bb46142285eaae260b54daa2e67c6080d4c483 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/form.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/form.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/form/container.phtml b/app/code/Magento/Backend/view/adminhtml/widget/form/container.phtml index 0bb7288fa66e2efb9b07703abeaf9957212d8c8c..06dea809bbf6871dff4376421b8528e16a74a16b 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/form/container.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/form/container.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/form/element.phtml b/app/code/Magento/Backend/view/adminhtml/widget/form/element.phtml index a3f8b42ab2f44668fa02d3f552e2fe51aa93e642..84c8320fa4afa3b55cc0743eda31f7a9faa134a8 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/form/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/form/element.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/form/element/gallery.phtml b/app/code/Magento/Backend/view/adminhtml/widget/form/element/gallery.phtml index 0a0bdc5a52be65fafbf47a66da9fd35f2c79d1b9..96fc328dc420b994b4336698377e7370bfb21270 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/form/element/gallery.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/form/element/gallery.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/element.phtml b/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/element.phtml index 08dc7bbc6c627859b0eef9cb2eb3c3464da83f16..340d274205dfd47276984817e9a6188726617426 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/element.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/fieldset.phtml index 89784770557d7751614df2f4c6c023927b021412..be8867d54b883173f10dd483e355324db5f35637 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/fieldset.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/fieldset/element.phtml b/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/fieldset/element.phtml index 0d492de8baeed7b2a49d73f44e52843d5874626e..c4291154930b4e7aad5ad038dc71ea0aeeb3739f 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/form/renderer/fieldset/element.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/widget/grid.phtml index 727a39dce188881f56c9caa2d84e481249ad6d11..91e7ae02746cbc6335e52f5200c63ed110071819 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/grid.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/grid/column_set.phtml b/app/code/Magento/Backend/view/adminhtml/widget/grid/column_set.phtml index c260dc7fe75ee7787c8c4eb7fd7e94dc053c4956..e4beb76cdc8d2fd743f488dabee254e667c7572a 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/grid/column_set.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/grid/column_set.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/grid/container.phtml b/app/code/Magento/Backend/view/adminhtml/widget/grid/container.phtml index f0dc11cb27519a5632d935b4a5fd83231845213d..8dadffa049351f21f1e196df5ecc7e5ba60cbdf5 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/grid/container.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/grid/container.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/grid/container/empty.phtml b/app/code/Magento/Backend/view/adminhtml/widget/grid/container/empty.phtml index 6ddced0e90573bef890aa359e6fca739a69f8812..355df9e3c463d9d5fb2a619b11032ec339cac280 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/grid/container/empty.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/grid/container/empty.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/grid/export.phtml b/app/code/Magento/Backend/view/adminhtml/widget/grid/export.phtml index d2059761f16cdc3eb4dfa7fa0a32f906aa28a996..c6b92415be518c020ed542e933d4f4056a4c11ce 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/grid/export.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/grid/export.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/widget/grid/extended.phtml index 4d227bb14f095c1a0c69e31afd963124fdaf28d2..2f8e7658414349422da1a4258a4fcd42e9714bae 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/grid/extended.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/grid/massaction.phtml b/app/code/Magento/Backend/view/adminhtml/widget/grid/massaction.phtml index 23dbbbe4172521610d1b8337c790cbfec8a9ca20..58df14a4cb454856e8ae42fc6476c680193ae3cb 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/grid/massaction.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/grid/massaction.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/grid/massaction_extended.phtml b/app/code/Magento/Backend/view/adminhtml/widget/grid/massaction_extended.phtml index e620961e1503a5fe50f65d556007d40c03d60b1a..19c4e9ed10ca07626a26f8d456162b18924102c3 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/grid/massaction_extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/grid/massaction_extended.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/grid/serializer.phtml b/app/code/Magento/Backend/view/adminhtml/widget/grid/serializer.phtml index 011d651c4d64974b3612a1d46102453d2bad5a57..b539315a1f251df1afda8be66e2299d1ca487381 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/grid/serializer.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/grid/serializer.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/tabs.phtml b/app/code/Magento/Backend/view/adminhtml/widget/tabs.phtml index cdac584d4193c4cb16b1babf1c86a066481a945d..7e1a8fc447d6c4f6e1f20bc1e8715c16f5b3f8bc 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/tabs.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/tabs.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backend/view/adminhtml/widget/view/container.phtml b/app/code/Magento/Backend/view/adminhtml/widget/view/container.phtml index e429e86ce92e43224aab10107f43fe8c05b2d6ba..55ea032b1eb2127532a2bc038065aab6c5cf03c6 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/view/container.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/view/container.phtml @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default + * @package Magento_Backend * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Backup/Model/Backup.php b/app/code/Magento/Backup/Model/Backup.php index cb54b4202543f8d40b1594a9f158240a2800ddc7..5f18b3b5aa074030078d58d0e454d69d4a881423 100644 --- a/app/code/Magento/Backup/Model/Backup.php +++ b/app/code/Magento/Backup/Model/Backup.php @@ -63,13 +63,6 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa */ protected $_helper; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * Locale model * @@ -85,24 +78,27 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa protected $_backendAuthSession; /** - * Construct - * - * @param \Magento\Core\Helper\Data $coreData + * @var \Magento\Encryption\EncryptorInterface + */ + protected $_encryptor; + + /** * @param \Magento\Backup\Helper\Data $helper * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Backend\Model\Auth\Session $authSession + * @param \Magento\Encryption\EncryptorInterface $encryptor * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Backup\Helper\Data $helper, \Magento\Core\Model\LocaleInterface $locale, \Magento\Backend\Model\Auth\Session $authSession, + \Magento\Encryption\EncryptorInterface $encryptor, $data = array() ) { + $this->_encryptor = $encryptor; parent::__construct($data); - $this->_coreData = $coreData; $adapter = new \Magento\Filesystem\Adapter\Zlib(self::COMPRESS_RATE); $this->_filesystem = new \Magento\Filesystem($adapter); $this->_filesystem->setIsAllowCreateDirectories(true); @@ -427,7 +423,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa public function validateUserPassword($password) { $userPasswordHash = $this->_backendAuthSession->getUser()->getPassword(); - return $this->_coreData->validateHash($password, $userPasswordHash); + return $this->_encryptor->validateHash($password, $userPasswordHash); } /** diff --git a/app/code/Magento/Backup/Model/Config/Backend/Cron.php b/app/code/Magento/Backup/Model/Config/Backend/Cron.php index 401ee8e598862c5b3632fb51b5f76906f441a0e8..783b49ebb6e97fdae8b2b6e94980106956b3f317 100644 --- a/app/code/Magento/Backup/Model/Config/Backend/Cron.php +++ b/app/code/Magento/Backup/Model/Config/Backend/Cron.php @@ -44,8 +44,11 @@ class Cron extends \Magento\Core\Model\Config\Value protected $_configValueFactory; /** - * Construct - * + * @var string + */ + protected $_runModelPath = ''; + + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\StoreManager $storeManager @@ -53,6 +56,7 @@ class Cron extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection + * @param string $runModelPath * @param array $data */ public function __construct( @@ -63,11 +67,12 @@ class Cron extends \Magento\Core\Model\Config\Value \Magento\Core\Model\Config\ValueFactory $configValueFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, + $runModelPath = '', array $data = array() ) { - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); - + $this->_runModelPath = $runModelPath; $this->_configValueFactory = $configValueFactory; + parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); } /** @@ -107,7 +112,7 @@ class Cron extends \Magento\Core\Model\Config\Value $this->_configValueFactory->create() ->load(self::CRON_MODEL_PATH, 'path') - ->setValue((string) $this->_config->getNode(self::CRON_MODEL_PATH)) + ->setValue($this->_runModelPath) ->setPath(self::CRON_MODEL_PATH) ->save(); } catch (\Exception $e) { diff --git a/app/code/Magento/Backup/Model/Db.php b/app/code/Magento/Backup/Model/Db.php index 1c5a9ac85f744f795f4e4571e3f74b4f320274d5..202f77918d9c99578a051a4478fbafcc233b817b 100644 --- a/app/code/Magento/Backup/Model/Db.php +++ b/app/code/Magento/Backup/Model/Db.php @@ -54,15 +54,15 @@ class Db implements \Magento\Backup\Db\BackupDbInterface /** * Core resource model * - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource = null; /** * @param \Magento\Backup\Model\Resource\Db $resourceDb - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ - public function __construct(\Magento\Backup\Model\Resource\Db $resourceDb, \Magento\Core\Model\Resource $resource) + public function __construct(\Magento\Backup\Model\Resource\Db $resourceDb, \Magento\App\Resource $resource) { $this->_resourceDb = $resourceDb; $this->_resource = $resource; diff --git a/app/code/Magento/Backup/Model/Observer.php b/app/code/Magento/Backup/Model/Observer.php index 91a4524a4683bcb817fca46ae342c9108542f365..7f3fdd2ba17c360119ef63ed77f393a8a00a25c4 100644 --- a/app/code/Magento/Backup/Model/Observer.php +++ b/app/code/Magento/Backup/Model/Observer.php @@ -61,7 +61,7 @@ class Observer protected $_coreRegistry = null; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -87,7 +87,7 @@ class Observer /** * @param \Magento\Backup\Helper\Data $backupData * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\App\Dir $dir * @param \Magento\Backup\Factory $backupFactory @@ -95,7 +95,7 @@ class Observer public function __construct( \Magento\Backup\Helper\Data $backupData, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\App\Dir $dir, \Magento\Backup\Factory $backupFactory diff --git a/app/code/Magento/Backup/Model/Resource/Db.php b/app/code/Magento/Backup/Model/Resource/Db.php index 86129fda31866373cfcacb07a81762044b060d0d..c00debc37dd861d7daa87629f968ee6d11ee10df 100644 --- a/app/code/Magento/Backup/Model/Resource/Db.php +++ b/app/code/Magento/Backup/Model/Resource/Db.php @@ -55,11 +55,11 @@ class Db * Initialize Backup DB resource model * * @param \Magento\Backup\Model\Resource\HelperFactory $resHelperFactory - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Backup\Model\Resource\HelperFactory $resHelperFactory, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_resourceHelper = $resHelperFactory->create(); $this->_write = $resource->getConnection('backup_write'); diff --git a/app/code/Magento/Backup/Model/Resource/Helper.php b/app/code/Magento/Backup/Model/Resource/Helper.php index edf243edd901078ed36a609a46e480dba6ee7b6f..0a4f396e08d6311967e57b3b0b01ad236e7079ba 100644 --- a/app/code/Magento/Backup/Model/Resource/Helper.php +++ b/app/code/Magento/Backup/Model/Resource/Helper.php @@ -44,12 +44,12 @@ class Helper extends \Magento\Core\Model\Resource\Helper protected $_coreDate; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Date $coreDate * @param $modulePrefix */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\Date $coreDate, $modulePrefix ) { diff --git a/app/code/Magento/Backup/etc/di.xml b/app/code/Magento/Backup/etc/di.xml index 559ece9be751584ec2aa6767035cedfe6b0810f6..7f96cb3ea3abe190af30498b7140e275dfe0851d 100644 --- a/app/code/Magento/Backup/etc/di.xml +++ b/app/code/Magento/Backup/etc/di.xml @@ -26,10 +26,10 @@ <config> <type name="Magento\Backup\Db\BackupFactory"> <param name="backupInstanceName"> - <value>\Magento\Backup\Model\Backup</value> + <value>Magento\Backup\Model\Backup</value> </param> <param name="backupDbInstanceName"> - <value>\Magento\Backup\Model\Db</value> + <value>Magento\Backup\Model\Db</value> </param> </type> </config> \ No newline at end of file diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php index a76795eea79ee8118f7623256db46010008853b8..df74c4341ae8437973cbd0b2cd1b250a46331ead 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php @@ -24,18 +24,60 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Bundle\Block\Adminhtml\Sales\Order\Items; /** * Adminhtml sales order item renderer - * - * @category Magento - * @package Magento_Bundle - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Bundle\Block\Adminhtml\Sales\Order\Items; - class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRenderer { + /** + * Filter manager + * + * @var \Magento\Filter\FilterManager + */ + protected $filter; + + /** + * @param \Magento\Catalog\Model\ProductFactory $productFactory + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Filter\FilterManager $filter + * @param array $data + */ + public function __construct( + \Magento\Catalog\Model\ProductFactory $productFactory, + \Magento\Core\Helper\Data $coreData, + \Magento\Backend\Block\Template\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Filter\FilterManager $filter, + array $data = array() + ) { + $this->filter = $filter; + parent::__construct($productFactory, $coreData, $context, $registry, $data); + } + + /** + * Truncate string + * + * @param string $value + * @param int $length + * @param string $etc + * @param string &$remainder + * @param bool $breakWords + * @return string + */ + public function truncateString($value, $length = 80, $etc = '...', &$remainder = '', $breakWords = true) + { + return $this->filter->truncate($value, array( + 'length' => $length, + 'etc' => $etc, + 'remainder' => $remainder, + 'breakWords' => $breakWords + )); + } + /** * Getting all available childs for Invoice, Shipmen or Creditmemo item * @@ -44,41 +86,48 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend */ public function getChilds($item) { - $_itemsArray = array(); + $itemsArray = array(); if ($item instanceof \Magento\Sales\Model\Order\Invoice\Item) { - $_items = $item->getInvoice()->getAllItems(); + $items = $item->getInvoice()->getAllItems(); } else if ($item instanceof \Magento\Sales\Model\Order\Shipment\Item) { - $_items = $item->getShipment()->getAllItems(); + $items = $item->getShipment()->getAllItems(); } else if ($item instanceof \Magento\Sales\Model\Order\Creditmemo\Item) { - $_items = $item->getCreditmemo()->getAllItems(); + $items = $item->getCreditmemo()->getAllItems(); } - if ($_items) { - foreach ($_items as $_item) { - if ($parentItem = $_item->getOrderItem()->getParentItem()) { - $_itemsArray[$parentItem->getId()][$_item->getOrderItemId()] = $_item; + if ($items) { + foreach ($items as $value) { + $parentItem = $value->getOrderItem()->getParentItem(); + if ($parentItem) { + $itemsArray[$parentItem->getId()][$value->getOrderItemId()] = $value; } else { - $_itemsArray[$_item->getOrderItem()->getId()][$_item->getOrderItemId()] = $_item; + $itemsArray[$value->getOrderItem()->getId()][$value->getOrderItemId()] = $value; } } } - if (isset($_itemsArray[$item->getOrderItem()->getId()])) { - return $_itemsArray[$item->getOrderItem()->getId()]; + if (isset($itemsArray[$item->getOrderItem()->getId()])) { + return $itemsArray[$item->getOrderItem()->getId()]; } else { return null; } } + /** + * @param null $item + * @return bool + */ public function isShipmentSeparately($item = null) { if ($item) { if ($item->getOrderItem()) { $item = $item->getOrderItem(); } - if ($parentItem = $item->getParentItem()) { - if ($options = $parentItem->getProductOptions()) { + $parentItem = $item->getParentItem(); + if ($parentItem) { + $options = $parentItem->getProductOptions(); + if ($options) { if (isset($options['shipment_type']) && $options['shipment_type'] == \Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY ) { @@ -88,7 +137,8 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend } } } else { - if ($options = $item->getProductOptions()) { + $options = $item->getProductOptions(); + if ($options) { if (isset($options['shipment_type']) && $options['shipment_type'] == \Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY ) { @@ -100,7 +150,8 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend } } - if ($options = $this->getOrderItem()->getProductOptions()) { + $options = $this->getOrderItem()->getProductOptions(); + if ($options) { if (isset($options['shipment_type']) && $options['shipment_type'] == \Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY ) { @@ -110,14 +161,20 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend return false; } + /** + * @param null $item + * @return bool + */ public function isChildCalculated($item = null) { if ($item) { if ($item->getOrderItem()) { $item = $item->getOrderItem(); } - if ($parentItem = $item->getParentItem()) { - if ($options = $parentItem->getProductOptions()) { + $parentItem = $item->getParentItem(); + if ($parentItem) { + $options = $parentItem->getProductOptions(); + if ($options) { if (isset($options['product_calculations']) && $options['product_calculations'] == \Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD ) { @@ -127,7 +184,8 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend } } } else { - if ($options = $item->getProductOptions()) { + $options = $item->getProductOptions(); + if ($options) { if (isset($options['product_calculations']) && $options['product_calculations'] == \Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD ) { @@ -139,7 +197,8 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend } } - if ($options = $this->getOrderItem()->getProductOptions()) { + $options = $this->getOrderItem()->getProductOptions(); + if ($options) { if (isset($options['product_calculations']) && $options['product_calculations'] == \Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD ) { @@ -149,7 +208,8 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend return false; } - public function getSelectionAttributes($item) { + public function getSelectionAttributes($item) + { if ($item instanceof \Magento\Sales\Model\Order\Item) { $options = $item->getProductOptions(); } else { @@ -164,8 +224,8 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend public function getOrderOptions($item = null) { $result = array(); - - if ($options = $this->getOrderItem()->getProductOptions()) { + $options = $this->getOrderItem()->getProductOptions(); + if ($options) { if (isset($options['options'])) { $result = array_merge($result, $options['options']); } @@ -192,22 +252,29 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend { $result = $this->escapeHtml($item->getName()); if (!$this->isShipmentSeparately($item)) { - if ($attributes = $this->getSelectionAttributes($item)) { + $attributes = $this->getSelectionAttributes($item); + if ($attributes) { $result = sprintf('%d', $attributes['qty']) . ' x ' . $result; } } if (!$this->isChildCalculated($item)) { - if ($attributes = $this->getSelectionAttributes($item)) { + $attributes = $this->getSelectionAttributes($item); + if ($attributes) { $result .= " " . $this->getOrderItem()->getOrder()->formatPrice($attributes['price']); } } return $result; } + /** + * @param object $item + * @return bool + */ public function canShowPriceInfo($item) { if (($item->getOrderItem()->getParentItem() && $this->isChildCalculated()) - || (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())) { + || (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated()) + ) { return true; } return false; diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php index 37fb5143aaa5dca65af355c396b410a90a70de7d..8a232551c3d5e65e8a1a3d6965afaf465815838d 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php @@ -24,24 +24,71 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Bundle\Block\Adminhtml\Sales\Order\View\Items; /** * Adminhtml sales order item renderer - * - * @category Magento - * @package Magento_Bundle - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Bundle\Block\Adminhtml\Sales\Order\View\Items; - -class Renderer - extends \Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer +class Renderer extends \Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer { + /** + * Core string + * + * @var \Magento\Filter\FilterManager + */ + protected $filter; + + /** + * @param \Magento\Catalog\Model\ProductFactory $productFactory + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Filter\FilterManager $filter + * @param array $data + */ + public function __construct( + \Magento\Catalog\Model\ProductFactory $productFactory, + \Magento\Core\Helper\Data $coreData, + \Magento\Backend\Block\Template\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Filter\FilterManager $filter, + array $data = array() + ) { + $this->filter = $filter; + parent::__construct($productFactory, $coreData, $context, $registry, $data); + } + + /** + * Truncate string + * + * @param string $value + * @param int $length + * @param string $etc + * @param string &$remainder + * @param bool $breakWords + * @return string + */ + public function truncateString($value, $length = 80, $etc = '...', &$remainder = '', $breakWords = true) + { + return $this->filter->truncate($value, array( + 'length' => $length, + 'etc' => $etc, + 'remainder' => $remainder, + 'breakWords' => $breakWords + )); + } + + /** + * @param null|object $item + * @return bool + */ public function isShipmentSeparately($item = null) { if ($item) { - if ($parentItem = $item->getParentItem()) { - if ($options = $parentItem->getProductOptions()) { + $parentItem = $item->getParentItem(); + if ($parentItem) { + $options = $parentItem->getProductOptions(); + if ($options) { if (isset($options['shipment_type']) && $options['shipment_type'] == \Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY ) { @@ -51,7 +98,8 @@ class Renderer } } } else { - if ($options = $item->getProductOptions()) { + $options = $item->getProductOptions(); + if ($options) { if (isset($options['shipment_type']) && $options['shipment_type'] == \Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY ) { @@ -63,7 +111,8 @@ class Renderer } } - if ($options = $this->getOrderItem()->getProductOptions()) { + $options = $this->getOrderItem()->getProductOptions(); + if ($options) { if (isset($options['shipment_type']) && $options['shipment_type'] == \Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY ) { @@ -73,11 +122,17 @@ class Renderer return false; } + /** + * @param null|object $item + * @return bool + */ public function isChildCalculated($item = null) { if ($item) { - if ($parentItem = $item->getParentItem()) { - if ($options = $parentItem->getProductOptions()) { + $parentItem = $item->getParentItem(); + if ($parentItem) { + $options = $parentItem->getProductOptions(); + if ($options) { if (isset($options['product_calculations']) && $options['product_calculations'] == \Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD ) { @@ -87,7 +142,8 @@ class Renderer } } } else { - if ($options = $item->getProductOptions()) { + $options = $item->getProductOptions(); + if ($options) { if (isset($options['product_calculations']) && $options['product_calculations'] == \Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD ) { @@ -99,7 +155,8 @@ class Renderer } } - if ($options = $this->getItem()->getProductOptions()) { + $options = $this->getItem()->getProductOptions(); + if ($options) { if (isset($options['product_calculations']) && $options['product_calculations'] == \Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD ) { @@ -109,7 +166,8 @@ class Renderer return false; } - public function getSelectionAttributes($item) { + public function getSelectionAttributes($item) + { if ($item instanceof \Magento\Sales\Model\Order\Item) { $options = $item->getProductOptions(); } else { @@ -121,10 +179,14 @@ class Renderer return null; } + /** + * @return array + */ public function getOrderOptions() { $result = array(); - if ($options = $this->getItem()->getProductOptions()) { + $options = $this->getItem()->getProductOptions(); + if ($options) { if (isset($options['options'])) { $result = array_merge($result, $options['options']); } @@ -138,26 +200,37 @@ class Renderer return $result; } + /** + * @param object $item + * @return string + */ public function getValueHtml($item) { $result = $this->escapeHtml($item->getName()); if (!$this->isShipmentSeparately($item)) { - if ($attributes = $this->getSelectionAttributes($item)) { + $attributes = $this->getSelectionAttributes($item); + if ($attributes) { $result = sprintf('%d', $attributes['qty']) . ' x ' . $result; } } if (!$this->isChildCalculated($item)) { - if ($attributes = $this->getSelectionAttributes($item)) { + $attributes = $this->getSelectionAttributes($item); + if ($attributes) { $result .= " " . $this->getItem()->getOrder()->formatPrice($attributes['price']); } } return $result; } + /** + * @param object $item + * @return bool + */ public function canShowPriceInfo($item) { if (($item->getParentItem() && $this->isChildCalculated()) - || (!$item->getParentItem() && !$this->isChildCalculated())) { + || (!$item->getParentItem() && !$this->isChildCalculated()) + ) { return true; } return false; diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php index 552f2f40f8d5240c0de13149567c6e78724ad0b0..e1a517d51e4513bc38cf8bba614816f0e3a7163f 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php @@ -41,26 +41,40 @@ class Price extends \Magento\Catalog\Block\Product\Price protected $_taxCalc; /** - * @param \Magento\Tax\Model\Calculation $taxCalc + * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Core\Model\StoreManager $storeManager + * @param \Magento\Stdlib\String $string + * @param \Magento\Math\Random $mathRandom + * @param \Magento\Tax\Model\Calculation $taxCalc * @param array $data */ public function __construct( - \Magento\Tax\Model\Calculation $taxCalc, + \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Tax\Helper\Data $taxData, \Magento\Core\Helper\Data $coreData, \Magento\Core\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\Core\Model\StoreManager $storeManager, + \Magento\Stdlib\String $string, + \Magento\Math\Random $mathRandom, + \Magento\Tax\Model\Calculation $taxCalc, array $data = array() ) { - parent::__construct($storeManager, $catalogData, $taxData, $coreData, $context, $registry, $data); + parent::__construct( + $storeManager, + $catalogData, + $taxData, + $coreData, + $context, + $registry, + $string, + $mathRandom, + $data + ); $this->_taxCalc = $taxCalc; } diff --git a/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php b/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php index 519e44c7ab08a924377b41079b6ae4a00b3aabd3..8cdd59bb70929844791a33f45e3eca7964b01c0f 100644 --- a/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php +++ b/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php @@ -50,18 +50,26 @@ class Configuration extends \Magento\Core\Helper\AbstractHelper */ protected $_ctlgProdConfigur = null; + /** + * @var \Magento\Escaper + */ + protected $_escaper; + /** * @param \Magento\Catalog\Helper\Product\Configuration $ctlgProdConfigur * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Helper\Context $context + * @param \Magento\Escaper $escaper */ public function __construct( \Magento\Catalog\Helper\Product\Configuration $ctlgProdConfigur, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\Context $context + \Magento\Core\Helper\Context $context, + \Magento\Escaper $escaper ) { $this->_ctlgProdConfigur = $ctlgProdConfigur; $this->_coreData = $coreData; + $this->_escaper = $escaper; parent::__construct($context); } @@ -155,7 +163,7 @@ class Configuration extends \Magento\Core\Helper\AbstractHelper foreach ($bundleSelections as $bundleSelection) { $qty = $this->getSelectionQty($product, $bundleSelection->getSelectionId()) * 1; if ($qty) { - $option['value'][] = $qty . ' x ' . $this->escapeHtml($bundleSelection->getName()) + $option['value'][] = $qty . ' x ' . $this->_escaper->escapeHtml($bundleSelection->getName()) . ' ' . $this->_coreData->currency( $this->getSelectionFinalPrice($item, $bundleSelection) ); diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index 9ff53ebcd0058eed276344921dc6a05bc7e5ec16..8cb10c5d352c21a166430dda1c87f94c2e8baec5 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -152,7 +152,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Catalog\Helper\Product $catalogProduct * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Bundle\Model\SelectionFactory $bundleModelSelection @@ -176,7 +176,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\Core\Helper\File\Storage\Database $fileStorageDb, \Magento\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Catalog\Helper\Product $catalogProduct, \Magento\Catalog\Helper\Data $catalogData, \Magento\Bundle\Model\SelectionFactory $bundleModelSelection, diff --git a/app/code/Magento/Bundle/Model/Resource/Bundle.php b/app/code/Magento/Bundle/Model/Resource/Bundle.php index e7398833f4cd699fe07a80c6941a30e9122c1f6c..6831f8ca5f652a5e0b63c9e9bf9cf2baec6989b5 100644 --- a/app/code/Magento/Bundle/Model/Resource/Bundle.php +++ b/app/code/Magento/Bundle/Model/Resource/Bundle.php @@ -45,11 +45,11 @@ class Bundle extends \Magento\Core\Model\Resource\Db\AbstractDb * Class constructor * * @param \Magento\Catalog\Model\Resource\Product\Relation $productRelation - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Catalog\Model\Resource\Product\Relation $productRelation, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { parent::__construct($resource); $this->_productRelation = $productRelation; diff --git a/app/code/Magento/Bundle/Model/Resource/Price/Index.php b/app/code/Magento/Bundle/Model/Resource/Price/Index.php index 4c3e2c27c32889ff07387c402ed42289badee918..bb7665791fa23e91a9e38dafb17956779ae4bc1a 100644 --- a/app/code/Magento/Bundle/Model/Resource/Price/Index.php +++ b/app/code/Magento/Bundle/Model/Resource/Price/Index.php @@ -98,7 +98,7 @@ class Index extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\Customer\Model\GroupFactory $customerGroup * @param \Magento\Catalog\Model\Config $config * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -107,7 +107,7 @@ class Index extends \Magento\Core\Model\Resource\Db\AbstractDb \Magento\Customer\Model\GroupFactory $customerGroup, \Magento\Catalog\Model\Config $config, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_eventManager = $eventManager; parent::__construct($resource); diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php index e08d8e0e98db0934bd99a40e932de8f5413646ea..21d611a3e53528291e2d8410ed66e9a73223d4c8 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -38,12 +38,12 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte /** * Core string * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -53,7 +53,7 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, @@ -62,7 +62,7 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte \Magento\Core\Model\Resource\AbstractResource $resource = null, array $data = array() ) { - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($taxData, $context, $registry, $coreDir, $resource, $resourceCollection, $data); } @@ -83,7 +83,6 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte $leftBound = 35; $rightBound = 565; - $stringHelper = $this->_coreString; foreach ($items as $_item) { $x = $leftBound; $line = array(); @@ -108,7 +107,7 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte if ($_prevOptionId != $attributes['option_id']) { $line[0] = array( 'font' => 'italic', - 'text' => $this->_coreString->strSplit($attributes['option_label'], 38, true, true), + 'text' => $this->string->split($attributes['option_label'], 38, true, true), 'feed' => $x ); @@ -132,7 +131,7 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte } $line[] = array( - 'text' => $this->_coreString->strSplit($name, 35, true, true), + 'text' => $this->string->split($name, 35, true, true), 'feed' => $feed ); @@ -141,7 +140,7 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte // draw SKUs if (!$_item->getOrderItem()->getParentItem()) { $text = array(); - foreach ($this->_coreString->strSplit($item->getSku(), 17) as $part) { + foreach ($this->string->split($item->getSku(), 17) as $part) { $text[] = $part; } $line[] = array( @@ -221,7 +220,7 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte foreach ($options['options'] as $option) { $lines = array(); $lines[][] = array( - 'text' => $this->_coreString->strSplit(strip_tags($option['label']), 40, true, true), + 'text' => $this->string->split(strip_tags($option['label']), 40, true, true), 'font' => 'italic', 'feed' => $leftBound ); @@ -233,7 +232,7 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte : strip_tags($option['value']); $values = explode(', ', $_printValue); foreach ($values as $value) { - foreach ($this->_coreString->strSplit($value, 30, true, true) as $_value) { + foreach ($this->string->split($value, 30, true, true) as $_value) { $text[] = $_value; } } diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php index 929957b8ff858eadb3a40f9b18aa67459a607767..1bacf99654c774ea2d1dd283c016e9330255a65a 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php @@ -36,14 +36,12 @@ namespace Magento\Bundle\Model\Sales\Order\Pdf\Items; class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems { /** - * Core string - * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $coreString * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -53,7 +51,7 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $coreString, \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, @@ -62,7 +60,7 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems \Magento\Core\Model\Resource\AbstractResource $resource = null, array $data = array() ) { - $this->_coreString = $coreString; + $this->string = $coreString; parent::__construct($taxData, $context, $registry, $coreDir, $resource, $resourceCollection, $data); } @@ -83,7 +81,6 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems $_prevOptionId = ''; $drawItems = array(); - $stringHelper = $this->_coreString; foreach ($items as $_item) { $line = array(); @@ -106,7 +103,7 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems if ($_prevOptionId != $attributes['option_id']) { $line[0] = array( 'font' => 'italic', - 'text' => $this->_coreString->strSplit($attributes['option_label'], 45, true, true), + 'text' => $this->string->split($attributes['option_label'], 45, true, true), 'feed' => 35 ); @@ -130,14 +127,14 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems $name = $_item->getName(); } $line[] = array( - 'text' => $this->_coreString->strSplit($name, 35, true, true), + 'text' => $this->string->split($name, 35, true, true), 'feed' => $feed ); // draw SKUs if (!$_item->getOrderItem()->getParentItem()) { $text = array(); - foreach ($this->_coreString->strSplit($item->getSku(), 17) as $part) { + foreach ($this->string->split($item->getSku(), 17) as $part) { $text[] = $part; } $line[] = array( @@ -188,7 +185,7 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems foreach ($options['options'] as $option) { $lines = array(); $lines[][] = array( - 'text' => $this->_coreString->strSplit(strip_tags($option['label']), 40, true, true), + 'text' => $this->string->split(strip_tags($option['label']), 40, true, true), 'font' => 'italic', 'feed' => 35 ); @@ -200,7 +197,7 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems : strip_tags($option['value']); $values = explode(', ', $_printValue); foreach ($values as $value) { - foreach ($this->_coreString->strSplit($value, 30, true, true) as $_value) { + foreach ($this->string->split($value, 30, true, true) as $_value) { $text[] = $_value; } } diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php index 4a0a376c34a225596883eb9d3e1f8b3c2ee26492..b03adadf349329af56b9e66b9f1706afc24c0e74 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php @@ -36,14 +36,12 @@ namespace Magento\Bundle\Model\Sales\Order\Pdf\Items; class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems { /** - * Core string - * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -53,7 +51,7 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, @@ -62,7 +60,7 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems \Magento\Core\Model\Resource\AbstractResource $resource = null, array $data = array() ) { - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($taxData, $context, $registry, $coreDir, $resource, $resourceCollection, $data); } @@ -84,7 +82,6 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems $_prevOptionId = ''; $drawItems = array(); - $stringHelper = $this->_coreString; foreach ($items as $_item) { $line = array(); @@ -107,7 +104,7 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems if ($_prevOptionId != $attributes['option_id']) { $line[0] = array( 'font' => 'italic', - 'text' => $this->_coreString->strSplit($attributes['option_label'], 60, true, true), + 'text' => $this->string->split($attributes['option_label'], 60, true, true), 'feed' => 60 ); @@ -150,7 +147,7 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems $name = $_item->getName(); } $text = array(); - foreach ($stringHelper->strSplit($name, 60, true, true) as $part) { + foreach ($this->string->split($name, 60, true, true) as $part) { $text[] = $part; } $line[] = array( @@ -160,7 +157,7 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems // draw SKUs $text = array(); - foreach ($this->_coreString->strSplit($_item->getSku(), 25) as $part) { + foreach ($this->string->split($_item->getSku(), 25) as $part) { $text[] = $part; } $line[] = array( @@ -178,7 +175,7 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems foreach ($options['options'] as $option) { $lines = array(); $lines[][] = array( - 'text' => $stringHelper->strSplit(strip_tags($option['label']), 70, true, true), + 'text' => $this->string->split(strip_tags($option['label']), 70, true, true), 'font' => 'italic', 'feed' => 60 ); @@ -190,7 +187,7 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems : strip_tags($option['value']); $values = explode(', ', $_printValue); foreach ($values as $value) { - foreach ($stringHelper->strSplit($value, 50, true, true) as $_value) { + foreach ($this->string->split($value, 50, true, true) as $_value) { $text[] = $_value; } } diff --git a/app/code/Magento/Bundle/etc/di.xml b/app/code/Magento/Bundle/etc/di.xml index c98e3d4a334c98eb24eef24a72eaed9b93e85b7b..6dd47bd6dd746ef9041763bf9704091260b63440 100644 --- a/app/code/Magento/Bundle/etc/di.xml +++ b/app/code/Magento/Bundle/etc/di.xml @@ -34,7 +34,7 @@ </value> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <bundle_setup>Magento\Catalog\Model\Resource\Setup</bundle_setup> diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_customer_wishlist.xml b/app/code/Magento/Bundle/view/adminhtml/layout/customer_index_wishlist.xml similarity index 100% rename from app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_customer_wishlist.xml rename to app/code/Magento/Bundle/view/adminhtml/layout/customer_index_wishlist.xml diff --git a/app/code/Magento/Bundle/view/adminhtml/sales/creditmemo/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/sales/creditmemo/create/items/renderer.phtml index 6387e62d3e604dfbf41a8eb695e4ef5dcf544928..228f2eece75c6e84a84b2040a1ac40ad05186386 100644 --- a/app/code/Magento/Bundle/view/adminhtml/sales/creditmemo/create/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/sales/creditmemo/create/items/renderer.phtml @@ -382,7 +382,7 @@ <?php if (isset($option['custom_view']) && $option['custom_view']): ?> <?php echo $option['value'];?> <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\String')->truncate($option['value'], 55, '', $_remainder);?> + <?php echo $this->truncateString($option['value'], 55, '', $_remainder);?> <?php if ($_remainder):?> ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span> <script type="text/javascript"> diff --git a/app/code/Magento/Bundle/view/adminhtml/sales/creditmemo/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/sales/creditmemo/view/items/renderer.phtml index 6330ddf82e3fbc19e99da256c53b4ff7550b6f35..c12a3a1358b3f4a92943eb59719f0bc15e3fbc13 100644 --- a/app/code/Magento/Bundle/view/adminhtml/sales/creditmemo/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/sales/creditmemo/view/items/renderer.phtml @@ -313,7 +313,7 @@ <?php if (isset($option['custom_view']) && $option['custom_view']): ?> <?php echo $option['value'];?> <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\String')->truncate($option['value'], 55, '', $_remainder);?> + <?php echo $this->truncateString($option['value'], 55, '', $_remainder);?> <?php if ($_remainder):?> ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span> <script type="text/javascript"> diff --git a/app/code/Magento/Bundle/view/adminhtml/sales/invoice/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/sales/invoice/create/items/renderer.phtml index 1daffcefc4bbe5102ee72966f64dcbd88207c511..21a7d32c3b47f9bcb3d0d6d88f906c10579f0351 100644 --- a/app/code/Magento/Bundle/view/adminhtml/sales/invoice/create/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/sales/invoice/create/items/renderer.phtml @@ -372,7 +372,7 @@ <?php if (isset($option['custom_view']) && $option['custom_view']): ?> <?php echo $option['value'];?> <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\String')->truncate($option['value'], 55, '', $_remainder);?> + <?php echo $this->truncateString($option['value'], 55, '', $_remainder);?> <?php if ($_remainder):?> ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span> <script type="text/javascript"> diff --git a/app/code/Magento/Bundle/view/adminhtml/sales/invoice/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/sales/invoice/view/items/renderer.phtml index e21f4ba65e4550c98bcdbd6cb4e3ac40b059062a..235b1857b4bfd33252beb4bc5347e7f707d1d1f5 100644 --- a/app/code/Magento/Bundle/view/adminhtml/sales/invoice/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/sales/invoice/view/items/renderer.phtml @@ -317,7 +317,7 @@ <?php if (isset($option['custom_view']) && $option['custom_view']): ?> <?php echo $option['value'];?> <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\String')->truncate($option['value'], 55, '', $_remainder);?> + <?php echo $this->truncateString($option['value'], 55, '', $_remainder);?> <?php if ($_remainder):?> ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span> <script type="text/javascript"> diff --git a/app/code/Magento/Bundle/view/adminhtml/sales/order/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/sales/order/view/items/renderer.phtml index 1380cab66e392508452de7066d3d0f2954a9a84d..406b6d2ea0521969f52d26d03102117fb038e232 100644 --- a/app/code/Magento/Bundle/view/adminhtml/sales/order/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/sales/order/view/items/renderer.phtml @@ -385,7 +385,7 @@ <?php if (isset($option['custom_view']) && $option['custom_view']): ?> <?php echo $option['value'];?> <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\String')->truncate($option['value'], 55, '', $_remainder);?> + <?php echo $this->truncateString($option['value'], 55, '', $_remainder);?> <?php if ($_remainder):?> ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span> <script type="text/javascript"> diff --git a/app/code/Magento/Bundle/view/adminhtml/sales/shipment/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/sales/shipment/create/items/renderer.phtml index 3e1702bd78d9f5fcd40ff2485590afefdc772b53..16896c91b383cd1c29540a7ed38abbea48f2c3ad 100644 --- a/app/code/Magento/Bundle/view/adminhtml/sales/shipment/create/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/sales/shipment/create/items/renderer.phtml @@ -95,7 +95,7 @@ <?php if (isset($option['custom_view']) && $option['custom_view']): ?> <?php echo $option['value'];?> <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\String')->truncate($option['value'], 55, '', $_remainder);?> + <?php echo $this->truncateString($option['value'], 55, '', $_remainder);?> <?php if ($_remainder):?> ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span> <script type="text/javascript"> diff --git a/app/code/Magento/Bundle/view/adminhtml/sales/shipment/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/sales/shipment/view/items/renderer.phtml index 5041044899404f3143882a6d6c19c1a66e926c94..822eff8d7a43abf909edc9965f0c1b4507fbefc7 100644 --- a/app/code/Magento/Bundle/view/adminhtml/sales/shipment/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/sales/shipment/view/items/renderer.phtml @@ -94,7 +94,7 @@ <?php if (isset($option['custom_view']) && $option['custom_view']): ?> <?php echo $option['value'];?> <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\String')->truncate($option['value'], 55, '', $_remainder);?> + <?php echo $this->truncateString($option['value'], 55, '', $_remainder);?> <?php if ($_remainder):?> ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span> <script type="text/javascript"> diff --git a/app/code/Magento/Bundle/view/frontend/sales/order/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/sales/order/items/renderer.phtml index 43411a9b28bf1c6e3f78d33e824cbfef88243f51..f474b7a616d17f33a3dc17eaf2d1df0e6e9350e1 100644 --- a/app/code/Magento/Bundle/view/frontend/sales/order/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/sales/order/items/renderer.phtml @@ -23,6 +23,8 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> <?php $parentItem = $this->getItem() ?> <?php $items = array_merge(array($parentItem), $parentItem->getChildrenItems()); ?> @@ -59,7 +61,7 @@ <?php else: ?> <td><div class="option-value"><?php echo $this->getValueHtml($_item)?></div></td> <?php endif; ?> - <td><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($_item->getSku())) ?></td> + <td><?php echo $this->prepareSku($_item->getSku()) ?></td> <td class="a-right"> <?php if (!$_item->getParentItem()): ?> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> diff --git a/app/code/Magento/Captcha/Helper/Data.php b/app/code/Magento/Captcha/Helper/Data.php index 8661550acaba7a7f6095d8ce000d0e93ece21002..e045e0d151ab5aa237513b47d634dc998fefed4f 100644 --- a/app/code/Magento/Captcha/Helper/Data.php +++ b/app/code/Magento/Captcha/Helper/Data.php @@ -124,7 +124,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper public function getCaptcha($formId) { if (!array_key_exists($formId, $this->_captcha)) { - $captchaType = ucfirst($this->getConfigNode('type')); + $captchaType = ucfirst($this->getConfig('type')); if (!$captchaType) { $captchaType = self::DEFAULT_CAPTCHA_TYPE; } @@ -138,13 +138,13 @@ class Data extends \Magento\Core\Helper\AbstractHelper } /** - * Returns value of the node with respect to current area (frontend or backend) + * Returns config value * * @param string $key The last part of XML_PATH_$area_CAPTCHA_ constant (case insensitive) * @param \Magento\Core\Model\Store $store * @return \Magento\Core\Model\Config\Element */ - public function getConfigNode($key, $store = null) + public function getConfig($key, $store = null) { $store = $this->_storeManager->getStore($store); $areaCode = $store->isAdmin() ? 'admin' : 'customer'; diff --git a/app/code/Magento/Captcha/Model/DefaultModel.php b/app/code/Magento/Captcha/Model/DefaultModel.php index 41dd30761331785076588163bb186cdfafcac835..5768f5ce64c43a3ad81f58583f7f4b2a16264656 100644 --- a/app/code/Magento/Captcha/Model/DefaultModel.php +++ b/app/code/Magento/Captcha/Model/DefaultModel.php @@ -158,7 +158,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model */ public function isShownToLoggedInUser() { - $forms = (array)$this->_captchaData->getConfigNode('shown_to_logged_in_user'); + $forms = (array)$this->_captchaData->getConfig('shown_to_logged_in_user'); foreach ($forms as $formId => $isShownToLoggedIn) { if ($isShownToLoggedIn && $this->_formId == $formId) { return true; @@ -185,7 +185,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model */ protected function _getAllowedAttemptsForSameLogin() { - return (int)$this->_captchaData->getConfigNode('failed_attempts_login'); + return (int)$this->_captchaData->getConfig('failed_attempts_login'); } /** @@ -195,7 +195,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model */ protected function _getAllowedAttemptsFromSameIp() { - return (int)$this->_captchaData->getConfigNode('failed_attempts_ip'); + return (int)$this->_captchaData->getConfig('failed_attempts_ip'); } /** @@ -241,7 +241,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model */ public function isCaseSensitive() { - return (string)$this->_captchaData->getConfigNode('case_sensitive'); + return (string)$this->_captchaData->getConfig('case_sensitive'); } /** @@ -251,7 +251,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model */ public function getFont() { - $font = (string)$this->_captchaData->getConfigNode('font'); + $font = (string)$this->_captchaData->getConfig('font'); $fonts = $this->_captchaData->getFonts(); if (isset($fonts[$font])) { @@ -276,7 +276,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model * as "timeout" configuration parameter specifies timeout in minutes - we multiply it on 60 to set * expiration in seconds */ - $this->_expiration = (int)$this->_captchaData->getConfigNode('timeout') * 60; + $this->_expiration = (int)$this->_captchaData->getConfig('timeout') * 60; } return $this->_expiration; } @@ -383,7 +383,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model */ protected function _getSymbols() { - return str_split((string)$this->_captchaData->getConfigNode('symbols')); + return str_split((string)$this->_captchaData->getConfig('symbols')); } /** @@ -395,7 +395,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model { $from = 0; $to = 0; - $length = (string)$this->_captchaData->getConfigNode('length'); + $length = (string)$this->_captchaData->getConfig('length'); if (!is_numeric($length)) { if (preg_match('/(\d+)-(\d+)/', $length, $matches)) { $from = (int)$matches[1]; @@ -421,17 +421,17 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model */ protected function _isShowAlways() { - if ((string)$this->_captchaData->getConfigNode('mode') == \Magento\Captcha\Helper\Data::MODE_ALWAYS) { + if ((string)$this->_captchaData->getConfig('mode') == \Magento\Captcha\Helper\Data::MODE_ALWAYS) { return true; } - if ((string)$this->_captchaData->getConfigNode('mode') == \Magento\Captcha\Helper\Data::MODE_AFTER_FAIL + if ((string)$this->_captchaData->getConfig('mode') == \Magento\Captcha\Helper\Data::MODE_AFTER_FAIL && $this->_getAllowedAttemptsForSameLogin() == 0 ) { return true; } - $alwaysFor = $this->_captchaData->getConfigNode('always_for'); + $alwaysFor = $this->_captchaData->getConfig('always_for'); foreach ($alwaysFor as $nodeFormId => $isAlwaysFor) { if ($isAlwaysFor && $this->_formId == $nodeFormId) { return true; @@ -448,7 +448,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model */ protected function _isEnabled() { - return (string)$this->_captchaData->getConfigNode('enable'); + return (string)$this->_captchaData->getConfig('enable'); } /** @@ -460,7 +460,7 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model */ protected function _getTargetForms() { - $formsString = (string)$this->_captchaData->getConfigNode('forms'); + $formsString = (string)$this->_captchaData->getConfig('forms'); return explode(',', $formsString); } diff --git a/app/code/Magento/Captcha/Model/Observer.php b/app/code/Magento/Captcha/Model/Observer.php index 48f518076336c041421f86a6f352fa5aebd5ed5e..225083f4a26029f35ecb86ed321cbf9639c94bfd 100644 --- a/app/code/Magento/Captcha/Model/Observer.php +++ b/app/code/Magento/Captcha/Model/Observer.php @@ -364,7 +364,7 @@ class Observer public function deleteExpiredImages() { foreach ($this->_storeManager->getWebsites(true) as $website) { - $expire = time() - $this->_helper->getConfigNode('timeout', $website->getDefaultStore()) * 60; + $expire = time() - $this->_helper->getConfig('timeout', $website->getDefaultStore()) * 60; $imageDirectory = $this->_helper->getImgDir($website); foreach ($this->_filesystem->getNestedKeys($imageDirectory) as $filePath) { if ($this->_filesystem->isFile($filePath) diff --git a/app/code/Magento/Captcha/Model/Resource/Log.php b/app/code/Magento/Captcha/Model/Resource/Log.php index d5587c12a139a4c55d111ce067771dc596595328..48e6017e8f503f1555bb7ad2ee5dde31a09f1d75 100644 --- a/app/code/Magento/Captcha/Model/Resource/Log.php +++ b/app/code/Magento/Captcha/Model/Resource/Log.php @@ -53,24 +53,22 @@ class Log extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_coreDate; /** - * Core http - * - * @var \Magento\Core\Helper\Http + * @var \Magento\HTTP\PhpEnvironment\RemoteAddress */ - protected $_coreHttp = null; + protected $_remoteAddress; /** + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Date $coreDate - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress */ public function __construct( - \Magento\Core\Model\Date $coreDate, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource, + \Magento\Core\Model\Date $coreDate, + \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress ) { $this->_coreDate = $coreDate; - $this->_coreHttp = $coreHttp; + $this->_remoteAddress = $remoteAddress; parent::__construct($resource); } @@ -101,7 +99,7 @@ class Log extends \Magento\Core\Model\Resource\Db\AbstractDb array('count' => new \Zend_Db_Expr('count+1'), 'updated_at') ); } - $ip = $this->_coreHttp->getRemoteAddr(); + $ip = $this->_remoteAddress->getRemoteAddress(); if ($ip != null) { $this->_getWriteAdapter()->insertOnDuplicate( $this->getMainTable(), @@ -129,7 +127,7 @@ class Log extends \Magento\Core\Model\Resource\Db\AbstractDb array('type = ?' => self::TYPE_LOGIN, 'value = ?' => $login) ); } - $ip = $this->_coreHttp->getRemoteAddr(); + $ip = $this->_remoteAddress->getRemoteAddress(); if ($ip != null) { $this->_getWriteAdapter()->delete( $this->getMainTable(), array('type = ?' => self::TYPE_REMOTE_ADDRESS, 'value = ?' => $ip) @@ -146,7 +144,7 @@ class Log extends \Magento\Core\Model\Resource\Db\AbstractDb */ public function countAttemptsByRemoteAddress() { - $ip = $this->_coreHttp->getRemoteAddr(); + $ip = $this->_remoteAddress->getRemoteAddress(); if (!$ip) { return 0; } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php index c71a6c30662057f0337e10d23338410f1872b58a..cc5e2ffd7faa8e678dbca3a1c6caffddbf5b86d3 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php @@ -42,7 +42,7 @@ class Image extends \Magento\Data\Form\Element\Image /** * @param \Magento\Core\Model\StoreManager $storeManager - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\UrlInterface $urlBuilder @@ -50,14 +50,14 @@ class Image extends \Magento\Data\Form\Element\Image */ public function __construct( \Magento\Core\Model\StoreManager $storeManager, - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\UrlInterface $urlBuilder, $attributes = array() ) { $this->_storeManager = $storeManager; - parent::__construct($coreData, $factoryElement, $factoryCollection, $urlBuilder, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $urlBuilder, $attributes); } protected function _getUrl() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php index e20d2c53550147c5bd05f4bbf9bd43a08a79ad21..4b5167e61b5d4658fb9e86fda967f5370923ef4a 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php @@ -44,7 +44,7 @@ class Attributes extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -52,7 +52,7 @@ class Attributes extends \Magento\Backend\Block\Widget\Form\Generic public function __construct( \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php index b32ebd400dc60a4acd53f70da2344cfda0f497b1..4883895df1c2236fc02239674caeede3c52bd109 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php @@ -80,7 +80,7 @@ class Chooser extends \Magento\Catalog\Block\Adminhtml\Category\Tree */ public function prepareElementHtml(\Magento\Data\Form\Element\AbstractElement $element) { - $uniqId = $this->_coreData->uniqHash($element->getId()); + $uniqId = $this->mathRandom->getUniqueHash($element->getId()); $sourceUrl = $this->getUrl('catalog/category_widget/chooser', array('uniq_id' => $uniqId, 'use_massaction' => false)); $chooser = $this->getLayout()->createBlock('Magento\Widget\Block\Adminhtml\Widget\Chooser') diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php index 4feec79d6c2c5a710861a03318b26952b4224f03..eeac9b35bfced4420dd6817428790235efa650c6 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php @@ -62,7 +62,7 @@ class Wysiwyg extends \Magento\Data\Form\Element\Textarea /** * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @param \Magento\View\LayoutInterface $layout - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Core\Model\ModuleManager $moduleManager @@ -72,7 +72,7 @@ class Wysiwyg extends \Magento\Data\Form\Element\Textarea public function __construct( \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, \Magento\View\LayoutInterface $layout, - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Core\Model\ModuleManager $moduleManager, @@ -83,7 +83,7 @@ class Wysiwyg extends \Magento\Data\Form\Element\Textarea $this->_layout = $layout; $this->_moduleManager = $moduleManager; $this->_backendData = $backendData; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php index 86ef938b6eda185c0ceb4359f0116e019ec831cf..1f7482f935bc04612a8576fac9e7efc8036e472a 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php @@ -44,7 +44,7 @@ class Content /** * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -52,7 +52,7 @@ class Content public function __construct( \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php index cbf29a0c2667b8d12dc8d0c98db57a5802841450..2201dece316de755ccf0bc3eff1a7b9021b1ae96 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php @@ -53,7 +53,7 @@ class Advanced * @param \Magento\Backend\Model\Config\Source\Yesno $yesNo * @param \Magento\Eav\Helper\Data $eavData * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -62,7 +62,7 @@ class Advanced \Magento\Backend\Model\Config\Source\Yesno $yesNo, \Magento\Eav\Helper\Data $eavData, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php index a15da363cd4561e0afca144d33a8a8b55a07cb76..c9cf6f1571e7c42a1534a1202bae434de6f17860 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php @@ -45,7 +45,7 @@ class Front /** * @param \Magento\Backend\Model\Config\Source\Yesno $yesNo * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -53,7 +53,7 @@ class Front public function __construct( \Magento\Backend\Model\Config\Source\Yesno $yesNo, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php index 2c039061c8cd23b946544c20b633da2de5ce7fb1..97c20a3d2b5f95876761905e63a947f24fecb71c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php @@ -146,7 +146,7 @@ class Main extends \Magento\Backend\Block\Template $this->addChild('delete_button', 'Magento\Adminhtml\Block\Widget\Button', array( 'label' => __('Delete Attribute Set'), - 'onclick' => 'deleteConfirm(\''. $this->jsQuoteEscape(__('You are about to delete all products in this set. Are you sure you want to delete this attribute set?')) . '\', \'' . $this->getUrl('catalog/*/delete', array('id' => $setId)) . '\')', + 'onclick' => 'deleteConfirm(\''. $this->escapeJsQuote(__('You are about to delete all products in this set. Are you sure you want to delete this attribute set?')) . '\', \'' . $this->getUrl('catalog/*/delete', array('id' => $setId)) . '\')', 'class' => 'delete' )); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php index 12ad387b0f26f09b94d72dc12972d0420a29c4ce..e283eb0ff0984a6ce727360321b6e07e6a13ec48 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php @@ -43,7 +43,7 @@ class Formgroup /** * @param \Magento\Eav\Model\Entity\TypeFactory $typeFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -51,7 +51,7 @@ class Formgroup public function __construct( \Magento\Eav\Model\Entity\TypeFactory $typeFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php index 69d2bf4b5f69bd4f2524835f19dc7b49cefe78e9..b7d1f94d04d7455bbca42e122cb32c0832d5d25e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formset.php @@ -37,7 +37,7 @@ class Formset /** * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -45,7 +45,7 @@ class Formset public function __construct( \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main/Filter.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main/Filter.php index ce9e145ef50ec4cf5f33cc9b7cb70061ff3a9dd4..31f542e8be672a6320b51b7c57eb49936b701816 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main/Filter.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main/Filter.php @@ -43,7 +43,7 @@ class Filter /** * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -51,7 +51,7 @@ class Filter public function __construct( \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php index ae66f85c5af251ab5bffa421ad518c136b904e5f..63a3b96a4427e5b64571a91a631ad247134ce4c7 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php @@ -46,7 +46,7 @@ class Attributes /** * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -54,7 +54,7 @@ class Attributes public function __construct( \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php index 5ac86bb6807f93a6e1cd4d806600651ffa9544e3..4045d0db1f74090cd52dfc9b14754d6fdf93fe01 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php @@ -40,7 +40,7 @@ class NewCategory extends \Magento\Backend\Block\Widget\Form\Generic { /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context @@ -48,7 +48,7 @@ class NewCategory extends \Magento\Backend\Block\Widget\Form\Generic */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php index 2ac94ea56cd5d73ad8f07078b8c28ce747164484..d00d21075d6c0ffbb0ffa7a518fe806e32023668 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php @@ -49,7 +49,7 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form /** * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context @@ -58,7 +58,7 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form */ public function __construct( \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Catalog\Helper\Data $catalogData, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Simple.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Simple.php index 23e124308d35943265659433885e444556896e6f..0f7993bcc1f84a3193ebb31c495353c319ce4a3d 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Simple.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/Simple.php @@ -51,7 +51,7 @@ class Simple /** * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context @@ -61,7 +61,7 @@ class Simple public function __construct( \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Catalog\Helper\Data $catalogData, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php index e4be2cfc6cba0e8ec851452750305cd5bff0503f..192a12d363ff4b3e9ca8d62aada25757193b729a 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Settings.php @@ -43,7 +43,7 @@ class Settings extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Catalog\Model\Product\Type\Configurable $configurableType * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -51,7 +51,7 @@ class Settings extends \Magento\Backend\Block\Widget\Form\Generic public function __construct( \Magento\Catalog\Model\Product\Type\Configurable $configurableType, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Frontend/Product/Watermark.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Frontend/Product/Watermark.php index b7d9166ed12fcf933bc47ae58c419a7f82e03d19..e0fe599ae81151b49cf41456e49cbd373c256725 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Frontend/Product/Watermark.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Frontend/Product/Watermark.php @@ -37,18 +37,11 @@ class Watermark extends \Magento\Backend\Block\AbstractBlock implements \Magento\Data\Form\Element\Renderer\RendererInterface { - const XML_PATH_IMAGE_TYPES = 'global/catalog/product/media/image_types'; - /** * @var \Magento\Data\Form\Element\Factory */ protected $_elementFactory; - /** - * @var \Magento\Core\Model\Config - */ - protected $_coreConfig; - /** * @var \Magento\Backend\Block\System\Config\Form\Field */ @@ -59,12 +52,17 @@ class Watermark */ protected $_watermarkPosition; + /** + * @var array + */ + protected $_imageTypes; + /** * @param \Magento\Catalog\Model\Config\Source\Watermark\Position $watermarkPosition * @param \Magento\Backend\Block\System\Config\Form\Field $formField * @param \Magento\Data\Form\Element\Factory $elementFactory * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Config $coreConfig + * @param array $imageTypes * @param array $data */ public function __construct( @@ -72,22 +70,20 @@ class Watermark \Magento\Backend\Block\System\Config\Form\Field $formField, \Magento\Data\Form\Element\Factory $elementFactory, \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Config $coreConfig, + array $imageTypes = array(), array $data = array() ) { $this->_watermarkPosition = $watermarkPosition; $this->_formField = $formField; $this->_elementFactory = $elementFactory; - $this->_coreConfig = $coreConfig; + $this->_imageTypes = $imageTypes; parent::__construct($context, $data); } public function render(\Magento\Data\Form\Element\AbstractElement $element) { $html = $this->_getHeaderHtml($element); - $attributes = $this->_coreConfig->getNode(self::XML_PATH_IMAGE_TYPES)->asArray(); - - foreach ($attributes as $key => $attribute) { + foreach ($this->_imageTypes as $key => $attribute) { /** * Watermark size field */ diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php index d260a037828b24796b276d024863e0da6a9581c5..0f2efca739db768e15599b81952f34cb7a908287 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php @@ -63,7 +63,7 @@ class BaseImage extends \Magento\Data\Form\Element\AbstractElement protected $_viewUrl; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Core\Model\View\UrlFactory $coreViewUrlFactory @@ -73,7 +73,7 @@ class BaseImage extends \Magento\Data\Form\Element\AbstractElement * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Core\Model\View\UrlFactory $coreViewUrlFactory, @@ -82,7 +82,7 @@ class BaseImage extends \Magento\Data\Form\Element\AbstractElement \Magento\File\Size $fileConfig, array $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->_viewUrl = $coreViewUrlFactory->create(); $this->_url = $backendUrlFactory->create(); @@ -108,8 +108,8 @@ class BaseImage extends \Magento\Data\Form\Element\AbstractElement */ public function getElementHtml() { - $htmlId = $this->_coreData->escapeHtml($this->getHtmlId()); - $uploadUrl = $this->_coreData->escapeHtml($this->_getUploadUrl()); + $htmlId = $this->_escaper->escapeHtml($this->getHtmlId()); + $uploadUrl = $this->_escaper->escapeHtml($this->_getUploadUrl()); $spacerImage = $this->_viewUrl->getViewFileUrl('images/spacer.gif'); $imagePlaceholderText = __('Click here or drag and drop to add images'); $deleteImageText = __('Delete image'); 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 ecb2feb2f32f262c9bfb8bb4389b2a5486eb4729..aa83f6051fe1cde8e9acd3a5092f626f24aaea6e 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,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Block\Adminhtml\Product\Helper\Form; + /** * Product form category field helper - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Block\Adminhtml\Product\Helper\Form; - class Category extends \Magento\Data\Form\Element\Multiselect { /** @@ -45,34 +41,42 @@ class Category extends \Magento\Data\Form\Element\Multiselect * * @var \Magento\Backend\Helper\Data */ - protected $_backendData = null; + protected $_backendData; /** * @var \Magento\Catalog\Model\Resource\Category\CollectionFactory */ protected $_collectionFactory; + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreData; + /** * @param \Magento\Catalog\Model\Resource\Category\CollectionFactory $collectionFactory - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\View\LayoutInterface $layout + * @param \Magento\Core\Helper\Data $coreData * @param array $attributes */ public function __construct( \Magento\Catalog\Model\Resource\Category\CollectionFactory $collectionFactory, - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Backend\Helper\Data $backendData, \Magento\View\LayoutInterface $layout, + \Magento\Core\Helper\Data $coreData, array $attributes = array() ) { $this->_collectionFactory = $collectionFactory; $this->_backendData = $backendData; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + $this->_coreData = $coreData; + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->_layout = $layout; } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php index a36f42c88c3df8a0986ccd15b3a2a5b0f264a6b6..45bb07ea552e7bd3aa371378401bfa6f63bb3be9 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php @@ -49,7 +49,7 @@ class Gallery extends \Magento\Data\Form\Element\AbstractElement /** * @param \Magento\View\LayoutInterface $layout * @param \Magento\Core\Model\StoreManager $storeManager - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes @@ -57,14 +57,14 @@ class Gallery extends \Magento\Data\Form\Element\AbstractElement public function __construct( \Magento\View\LayoutInterface $layout, \Magento\Core\Model\StoreManager $storeManager, - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { $this->_layout = $layout; $this->_storeManager = $storeManager; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); } public function getElementHtml() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php index afc3be7f61847cf731a171fd31bb71ec5a879e89..d3c52d75425f406aa6c12162aaa2d20cb01f6a6d 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php @@ -55,7 +55,7 @@ class Price extends \Magento\Data\Form\Element\Text /** * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Tax\Helper\Data $taxData @@ -64,7 +64,7 @@ class Price extends \Magento\Data\Form\Element\Text public function __construct( \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\LocaleInterface $locale, - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Tax\Helper\Data $taxData, @@ -73,7 +73,7 @@ class Price extends \Magento\Data\Form\Element\Text $this->_locale = $locale; $this->_storeManager = $storeManager; $this->_taxData = $taxData; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); } protected function _construct() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php index 4aa16d4d3edc33b4a806aef0367f5c4bc6b6448e..75cab01e27d2aae66e9a52a5e1eb0d24569367df 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php @@ -52,14 +52,14 @@ class Weight extends \Magento\Data\Form\Element\Text protected $_helper; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Catalog\Helper\Product $helper * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Catalog\Helper\Product $helper, @@ -71,7 +71,7 @@ class Weight extends \Magento\Data\Form\Element\Text ->setLabel($this->_helper->getTypeSwitcherControlLabel()); $attributes['class'] = 'validate-number validate-zero-or-greater validate-number-range number-range-0-99999999.9999'; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Price.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Price.php index 221bf94db684ac59b974d10105a9a44566c30ac8..4d772208382d3b7e9a660a8f366d87bf9b1155b5 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Price.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Price.php @@ -35,27 +35,6 @@ namespace Magento\Catalog\Block\Adminhtml\Product; class Price extends \Magento\Catalog\Block\Product\Price { - /** - * @param \Magento\Core\Model\StoreManager $storeManager - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Block\Template\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param array $data - */ - public function __construct( - \Magento\Core\Model\StoreManager $storeManager, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Tax\Helper\Data $taxData, - \Magento\Core\Helper\Data $coreData, - \Magento\Core\Block\Template\Context $context, - \Magento\Core\Model\Registry $registry, - array $data = array() - ) { - parent::__construct($storeManager, $catalogData, $taxData, $coreData, $context, $registry, $data); - } - /** * @param null|string|bool|int|\Magento\Core\Model\Store $storeId * @return bool|\Magento\Core\Model\Website diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php index 2cd46b3c388e11b67a2da96cd982e093c2eadfa2..72fee2023700a48304069f6e424ebc2de01d6d60 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php @@ -104,7 +104,7 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid */ public function prepareElementHtml(\Magento\Data\Form\Element\AbstractElement $element) { - $uniqId = $this->_coreData->uniqHash($element->getId()); + $uniqId = $this->mathRandom->getUniqueHash($element->getId()); $sourceUrl = $this->getUrl('catalog/product_widget/chooser', array( 'uniq_id' => $uniqId, 'use_massaction' => false, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php index a78b72bbfffd0e147087c0240647137c8fdb6555..739307f67232a3fbebce281d2f49da2d929c923f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php @@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -52,7 +52,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic public function __construct( \Magento\Core\Model\System\Store $systemStore, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Product/NewProduct.php b/app/code/Magento/Catalog/Block/Product/NewProduct.php index 80a84054e0762b0e638cae8bcb66056fe2f39a18..2c969295854b51679c3cb8b92b28b51370e50a34 100644 --- a/app/code/Magento/Catalog/Block/Product/NewProduct.php +++ b/app/code/Magento/Catalog/Block/Product/NewProduct.php @@ -156,11 +156,11 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct { $todayStartOfDayDate = $this->_locale->date() ->setTime('00:00:00') - ->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + ->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); $todayEndOfDayDate = $this->_locale->date() ->setTime('23:59:59') - ->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + ->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); /** @var $collection \Magento\Catalog\Model\Resource\Product\Collection */ $collection = $this->_productCollectionFactory->create(); diff --git a/app/code/Magento/Catalog/Block/Product/Price.php b/app/code/Magento/Catalog/Block/Product/Price.php index 6af76f675fb66f2bb60d5e4a6db86654b828a04c..dd7f339d96967d0c810729b67acd8f6642701fb8 100644 --- a/app/code/Magento/Catalog/Block/Product/Price.php +++ b/app/code/Magento/Catalog/Block/Product/Price.php @@ -66,6 +66,16 @@ class Price extends \Magento\Core\Block\Template */ protected $_storeManager; + /** + * @var \Magento\Stdlib\String + */ + protected $string; + + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + /** * Construct * @@ -75,6 +85,8 @@ class Price extends \Magento\Core\Block\Template * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Stdlib\String $string + * @param \Magento\Math\Random $mathRandom * @param array $data */ public function __construct( @@ -84,12 +96,16 @@ class Price extends \Magento\Core\Block\Template \Magento\Core\Helper\Data $coreData, \Magento\Core\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Stdlib\String $string, + \Magento\Math\Random $mathRandom, array $data = array() ) { $this->_storeManager = $storeManager; $this->_coreRegistry = $registry; $this->_catalogData = $catalogData; $this->_taxData = $taxData; + $this->string = $string; + $this->mathRandom = $mathRandom; parent::__construct($coreData, $context, $data); } @@ -222,4 +238,27 @@ class Price extends \Magento\Core\Block\Template $html = $this->hasRealPriceHtml() ? $this->getRealPriceHtml() : $product->getRealPriceHtml(); return $this->_coreData->jsonEncode($html); } + + /** + * Prepare SKU + * + * @param string $sku + * @return string + */ + public function prepareSku($sku) + { + return $this->escapeHtml($this->string->splitInjection($sku)); + } + + /** + * Get random string + * + * @param int $length + * @param string|null $chars + * @return string + */ + public function getRandomString($length, $chars = null) + { + return $this->mathRandom->getRandomString($length, $chars); + } } diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index f04170d4588dcc0ce531baa0db00cc3390148dcb..1f3cbbde28f037dddf19b8c850ba558a1ea8f5a8 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -24,17 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Block\Product; /** * Product View block - * - * @category Magento - * @package Magento_Catalog - * @module Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Block\Product; - class View extends \Magento\Catalog\Block\Product\AbstractProduct { /** @@ -45,11 +39,11 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct protected $_mapRenderer = 'msrp_item'; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * Tax calculation @@ -81,7 +75,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Tax\Model\Calculation $taxCalculation * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Helper\Data $coreData @@ -95,7 +89,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Core\Model\LocaleInterface $locale, \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Core\Helper\Data $coreData, @@ -105,7 +99,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $this->_productFactory = $productFactory; $this->_locale = $locale; $this->_taxCalculation = $taxCalculation; - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($storeManager, $catalogConfig, $coreRegistry, $taxData, $catalogData, $coreData, $context, $data); } @@ -136,7 +130,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct if ($description) { $headBlock->setDescription( ($description) ); } else { - $headBlock->setDescription($this->_coreString->substr($product->getDescription(), 0, 255)); + $headBlock->setDescription($this->string->substr($product->getDescription(), 0, 255)); } //@todo: move canonical link to separate block if ($this->helper('Magento\Catalog\Helper\Product')->canUseCanonicalTag() diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php index 064a24529f867516af7c1dddc57c91443ba3d760..61a0934b9653defac1454f4927589366379f156d 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php @@ -423,7 +423,7 @@ class Category extends \Magento\Backend\Controller\Adminhtml\Action $this->getResponse()->setBody($e->getMessage()); } catch (\Exception $e){ $this->getResponse()->setBody(__('There was a category move error %1', $e)); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php index 8af183bf159e3bfc6a1dbb9d70a9b1e7d3ea5317..9a7d1518d3f33c6a30d3215a644b210115b94e04 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php @@ -91,7 +91,7 @@ class Product extends \Magento\Backend\Controller\Adminhtml\Action $product->load($productId); } catch (\Exception $e) { $product->setTypeId(\Magento\Catalog\Model\Product\Type::DEFAULT_TYPE); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } @@ -885,8 +885,8 @@ class Product extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addSuccess(__('You saved the product.')); if ($product->getSku() != $originalSku) { $this->_getSession()->addNotice(__('SKU for product %1 has been changed to %2.', - $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($product->getName()), - $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($product->getSku())) + $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName()), + $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getSku())) ); } @@ -905,7 +905,7 @@ class Product extends \Magento\Backend\Controller\Adminhtml\Action ->setProductData($data); $redirectBack = true; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError($e->getMessage()); $redirectBack = true; } @@ -952,7 +952,7 @@ class Product extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addSuccess(__('You duplicated the product.')); $this->_redirect('catalog/*/edit', array('_current'=>true, 'id'=>$newProduct->getId())); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError($e->getMessage()); $this->_redirect('catalog/*/edit', array('_current'=>true)); } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php index d9eebd7f87eb9b710dc4eb6cd21f44d100028c4e..b52ae646b1fea84af7a8199c569afabcb89dff8d 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php @@ -88,7 +88,7 @@ class Attribute extends \Magento\Backend\Controller\Adminhtml\Action 'date_format' => $dateFormat )); $filterInternal = new \Zend_Filter_NormalizedToLocalized(array( - 'date_format' => \Magento\Date::DATE_INTERNAL_FORMAT + 'date_format' => \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT )); $value = $filterInternal->filter($filterInput->filter($value)); } else { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php index 9ea11f33d7662ef1c22b3e2d74abf7b9b2d79ea6..30bfb070fbaf9379a44150fa9022ad2ec3fdaf2f 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php @@ -193,7 +193,7 @@ class Attribute extends \Magento\Backend\Controller\Adminhtml\Action $attributeSet = $this->_objectManager->create('Magento\Eav\Model\Entity\Attribute\Set'); $attributeSet->setEntityTypeId($this->_entityTypeId)->load($setName, 'attribute_set_name'); if ($attributeSet->getId()) { - $setName = $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($setName); + $setName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($setName); $this->_getSession()->addError( __('Attribute Set with name \'%1\' already exists.', $setName) ); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php index b40a8ccbb1e9bbf2cb16dad188c4cf2ab8789754..5049846135668461e19fc360a2b1079ef6d70e51 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php @@ -41,7 +41,7 @@ class Set extends \Magento\Backend\Controller\Adminhtml\Action * * @var \Magento\Core\Model\Registry */ - protected $_coreRegistry = null; + protected $_coreRegistry; /** * @param \Magento\Backend\Controller\Context $context @@ -130,13 +130,13 @@ class Set extends \Magento\Backend\Controller\Adminhtml\Action $model = $this->_objectManager->create('Magento\Eav\Model\Entity\Attribute\Set') ->setEntityTypeId($entityTypeId); - /** @var $helper \Magento\Adminhtml\Helper\Data */ - $helper = $this->_objectManager->get('Magento\Adminhtml\Helper\Data'); + /** @var $filterManager \Magento\Filter\FilterManager */ + $filterManager = $this->_objectManager->get('Magento\Filter\FilterManager'); try { if ($isNewSet) { //filter html tags - $name = $helper->stripTags($this->getRequest()->getParam('attribute_set_name')); + $name = $filterManager->stripTags($this->getRequest()->getParam('attribute_set_name')); $model->setAttributeSetName(trim($name)); } else { if ($attributeSetId) { @@ -149,7 +149,7 @@ class Set extends \Magento\Backend\Controller\Adminhtml\Action ->jsonDecode($this->getRequest()->getPost('data')); //filter html tags - $data['attribute_set_name'] = $helper->stripTags($data['attribute_set_name']); + $data['attribute_set_name'] = $filterManager->stripTags($data['attribute_set_name']); $model->organizeData($data); } diff --git a/app/code/Magento/Catalog/Controller/Category.php b/app/code/Magento/Catalog/Controller/Category.php index 6a8c95c82a7d672c8f56c099ba26b36f293ab171..5666b5a7879e74b27a5b35ddd70a059bcad32aa0 100644 --- a/app/code/Magento/Catalog/Controller/Category.php +++ b/app/code/Magento/Catalog/Controller/Category.php @@ -127,7 +127,7 @@ class Category extends \Magento\Core\Controller\Front\Action ) ); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); return false; } diff --git a/app/code/Magento/Catalog/Controller/Product.php b/app/code/Magento/Catalog/Controller/Product.php index 44346a3df0e2c066e17c6c9e65e6866336ff9850..b28bf4a5513f4c2eaf2b047fb3e47eaff95793ee 100644 --- a/app/code/Magento/Catalog/Controller/Product.php +++ b/app/code/Magento/Catalog/Controller/Product.php @@ -87,7 +87,7 @@ class Product $this->_forward('noRoute'); } } else { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_forward('noRoute'); } } diff --git a/app/code/Magento/Catalog/Controller/Product/Compare.php b/app/code/Magento/Catalog/Controller/Product/Compare.php index 774cc36cd9a34280c1e2f0e4df332a6d1b0b8cdb..5350c991094969ae76b638fc3b54de7ad3fe1842 100644 --- a/app/code/Magento/Catalog/Controller/Product/Compare.php +++ b/app/code/Magento/Catalog/Controller/Product/Compare.php @@ -191,7 +191,7 @@ class Compare extends \Magento\Core\Controller\Front\Action if ($product->getId()/* && !$product->isSuper()*/) { $this->_catalogProductCompareList->addProduct($product); - $productName = $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($product->getName()); + $productName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName()); $this->_catalogSession->addSuccess( __('You added product %1 to the comparison list.', $productName) ); @@ -234,7 +234,7 @@ class Compare extends \Magento\Core\Controller\Front\Action $helper = $this->_objectManager->get('Magento\Catalog\Helper\Product\Compare'); if ($item->getId()) { $item->delete(); - $productName = $helper->escapeHtml($product->getName()); + $productName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName()); $this->_catalogSession->addSuccess( __('You removed product %1 from the comparison list.', $productName) ); diff --git a/app/code/Magento/Catalog/Helper/Catalog.php b/app/code/Magento/Catalog/Helper/Catalog.php index 4a47c7440139b6a195e5f9c4d95843f16e25038e..81ff721c7f9531a1594b92c582b8705b0391f4d4 100644 --- a/app/code/Magento/Catalog/Helper/Catalog.php +++ b/app/code/Magento/Catalog/Helper/Catalog.php @@ -35,6 +35,14 @@ namespace Magento\Catalog\Helper; class Catalog extends \Magento\Core\Helper\AbstractHelper { + /** + * Config path to valid file paths + */ + const XML_PATH_PUBLIC_FILES_VALID_PATHS = 'general/file/public_files_valid_paths'; + + /** + * Config path to sitemap valid paths + */ const XML_PATH_SITEMAP_VALID_PATHS = 'general/file/sitemap_generate_valid_paths'; /** @@ -57,13 +65,6 @@ class Catalog extends \Magento\Core\Helper\AbstractHelper * @var \Magento\Core\Model\Store\Config */ protected $_coreStoreConfig; - - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; /** * @param \Magento\Core\Helper\Data $coreData @@ -75,7 +76,6 @@ class Catalog extends \Magento\Core\Helper\AbstractHelper \Magento\Core\Helper\Context $context, \Magento\Core\Model\Store\Config $coreStoreConfig ) { - $this->_coreData = $coreData; $this->_coreStoreConfig = $coreStoreConfig; parent::__construct($context); } @@ -133,7 +133,7 @@ class Catalog extends \Magento\Core\Helper\AbstractHelper { return array_merge( $this->_coreStoreConfig->getConfig(self::XML_PATH_SITEMAP_VALID_PATHS), - $this->_coreData->getPublicFilesValidPath() + $this->_coreStoreConfig->getConfig(self::XML_PATH_PUBLIC_FILES_VALID_PATHS) ); } } diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php index ecadc54f73e5b87642b99127cbed16e5ce35aeda..1184ad2eb566f327c8e740e165ce20a88c7b196f 100644 --- a/app/code/Magento/Catalog/Helper/Data.php +++ b/app/code/Magento/Catalog/Helper/Data.php @@ -75,12 +75,13 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ protected $_storeId = null; - /** Core registry + /** + * Core registry * * @var \Magento\Core\Model\Registry */ protected $_coreRegistry = null; - + /** * Catalog product * @@ -96,17 +97,15 @@ class Data extends \Magento\Core\Helper\AbstractHelper protected $_catalogCategory = null; /** - * Core string - * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * @var string */ protected $_templateFilterModel; - + /** * Catalog session * @@ -149,6 +148,11 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ protected $_templateFilterFactory; + /** + * @var \Magento\Escaper + */ + protected $_escaper; + /** * Construct * @@ -157,13 +161,14 @@ class Data extends \Magento\Core\Helper\AbstractHelper * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Session $catalogSession - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Catalog\Helper\Category $catalogCategory * @param \Magento\Catalog\Helper\Product $catalogProduct * @param \Magento\Core\Helper\Context $context * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory + * @param \Magento\Escaper $escaper * @param $templateFilterModel */ public function __construct( @@ -172,13 +177,14 @@ class Data extends \Magento\Core\Helper\AbstractHelper \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Session $catalogSession, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Catalog\Helper\Category $catalogCategory, \Magento\Catalog\Helper\Product $catalogProduct, \Magento\Core\Helper\Context $context, \Magento\Core\Model\Registry $coreRegistry, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory, + \Magento\Escaper $escaper, $templateFilterModel ) { $this->_eavAttributeFactory = $eavAttributeFactory; @@ -187,12 +193,13 @@ class Data extends \Magento\Core\Helper\AbstractHelper $this->_storeManager = $storeManager; $this->_catalogSession = $catalogSession; $this->_templateFilterFactory = $templateFilterFactory; - $this->_coreString = $coreString; + $this->string = $string; $this->_catalogCategory = $catalogCategory; $this->_catalogProduct = $catalogProduct; $this->_coreStoreConfig = $coreStoreConfig; $this->_coreRegistry = $coreRegistry; $this->_templateFilterModel = $templateFilterModel; + $this->_escaper = $escaper; parent::__construct($context); } @@ -320,7 +327,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function splitSku($sku, $length = 30) { - return $this->_coreString->strSplit($sku, $length, true, false, '[\-\s]'); + return $this->string->split($sku, $length, true, false, '[\-\s]'); } /** @@ -449,7 +456,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function getMsrpExplanationMessage() { - return $this->escapeHtml( + return $this->_escaper->escapeHtml( $this->_coreStoreConfig->getConfig(self::XML_PATH_MSRP_EXPLANATION_MESSAGE, $this->_storeId), array('b','br','strong','i','u', 'p', 'span') ); @@ -462,7 +469,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function getMsrpExplanationMessageWhatsThis() { - return $this->escapeHtml( + return $this->_escaper->escapeHtml( $this->_coreStoreConfig->getConfig(self::XML_PATH_MSRP_EXPLANATION_MESSAGE_WHATS_THIS, $this->_storeId), array('b','br','strong','i','u', 'p', 'span') ); diff --git a/app/code/Magento/Catalog/Helper/Output.php b/app/code/Magento/Catalog/Helper/Output.php index 51c259bb523adfc02e8b68e1b962899a4de20725..5aa52bcf820ffc02786b9b2ad8d0c4642e376c2f 100644 --- a/app/code/Magento/Catalog/Helper/Output.php +++ b/app/code/Magento/Catalog/Helper/Output.php @@ -56,20 +56,28 @@ class Output extends \Magento\Core\Helper\AbstractHelper */ protected $_eavConfig; + /** + * @var \Magento\Escaper + */ + protected $_escaper; + /** * Construct * * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Helper\Context $context + * @param \Magento\Escaper $escaper */ public function __construct( \Magento\Eav\Model\Config $eavConfig, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Helper\Context $context + \Magento\Core\Helper\Context $context, + \Magento\Escaper $escaper ) { $this->_eavConfig = $eavConfig; $this->_catalogData = $catalogData; + $this->_escaper = $escaper; parent::__construct($context); } @@ -148,7 +156,7 @@ class Output extends \Magento\Core\Helper\AbstractHelper if ($attribute && $attribute->getId() && ($attribute->getFrontendInput() != 'media_image') && (!$attribute->getIsHtmlAllowedOnFront() && !$attribute->getIsWysiwygEnabled())) { if ($attribute->getFrontendInput() != 'price') { - $attributeHtml = $this->escapeHtml($attributeHtml); + $attributeHtml = $this->_escaper->escapeHtml($attributeHtml); } if ($attribute->getFrontendInput() == 'textarea') { $attributeHtml = nl2br($attributeHtml); @@ -182,7 +190,7 @@ class Output extends \Magento\Core\Helper\AbstractHelper if ($attribute && ($attribute->getFrontendInput() != 'image') && (!$attribute->getIsHtmlAllowedOnFront() && !$attribute->getIsWysiwygEnabled())) { - $attributeHtml = $this->escapeHtml($attributeHtml); + $attributeHtml = $this->_escaper->escapeHtml($attributeHtml); } if ($attribute->getIsHtmlAllowedOnFront() && $attribute->getIsWysiwygEnabled()) { if ($this->_catalogData->isUrlDirectivesParsingAllowed()) { diff --git a/app/code/Magento/Catalog/Helper/Product.php b/app/code/Magento/Catalog/Helper/Product.php index 66a2db4375dad36c78aa2fea24c8e56e59784475..35799827b193e4cce92ef3180470b40f45993738 100644 --- a/app/code/Magento/Catalog/Helper/Product.php +++ b/app/code/Magento/Catalog/Helper/Product.php @@ -101,7 +101,7 @@ class Product extends \Magento\Core\Helper\Url protected $_coreConfig; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; diff --git a/app/code/Magento/Catalog/Helper/Product/Configuration.php b/app/code/Magento/Catalog/Helper/Product/Configuration.php index 4ce24d1353a71d1de10c5c2476ba15d095aa089b..07bf007fbddb145da5ffd3a626670ba35224f29c 100644 --- a/app/code/Magento/Catalog/Helper/Product/Configuration.php +++ b/app/code/Magento/Catalog/Helper/Product/Configuration.php @@ -40,11 +40,12 @@ class Configuration extends \Magento\Core\Helper\AbstractHelper protected $_config; /** - * Core string + * Filter manager * - * @var \Magento\Core\Helper\String + * @var \Magento\Filter\FilterManager */ - protected $_coreString = null; + protected $filter; + /** * Product option factory @@ -54,22 +55,30 @@ class Configuration extends \Magento\Core\Helper\AbstractHelper protected $_productOptionFactory; /** - * Construct + * Magento string lib * + * @var \Magento\Stdlib\String + */ + protected $string; + + /** * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Filter\FilterManager $filter * @param \Magento\Core\Helper\Context $context * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $config + * @param \Magento\Stdlib\String $string */ public function __construct( \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, - \Magento\Core\Helper\String $coreString, + \Magento\Filter\FilterManager $filter, \Magento\Core\Helper\Context $context, - \Magento\Catalog\Model\ProductTypes\ConfigInterface $config + \Magento\Catalog\Model\ProductTypes\ConfigInterface $config, + \Magento\Stdlib\String $string ) { $this->_productOptionFactory = $productOptionFactory; - $this->_coreString = $coreString; + $this->filter = $filter; $this->_config = $config; + $this->string = $string; parent::__construct($context); } @@ -205,9 +214,9 @@ class Configuration extends \Magento\Core\Helper\AbstractHelper switch ($typeId) { case \Magento\Catalog\Model\Product\Type\Configurable::TYPE_CODE: return $this->getConfigurableOptions($item); - break; case \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE: return $this->getGroupedOptions($item); + default: break; } return $this->getCustomOptions($item); @@ -276,23 +285,22 @@ class Configuration extends \Magento\Core\Helper\AbstractHelper } // Truncate standard view - $result = array(); if (is_array($optionValue)) { - $_truncatedValue = implode("\n", $optionValue); - $_truncatedValue = nl2br($_truncatedValue); - return array('value' => $_truncatedValue); + $truncatedValue = implode("\n", $optionValue); + $truncatedValue = nl2br($truncatedValue); + return array('value' => $truncatedValue); } else { if ($maxLength) { - $_truncatedValue = $this->_coreString->truncate($optionValue, $maxLength, ''); + $truncatedValue = $this->filter->truncate($optionValue, array('length' => $maxLength, 'etc' => '')); } else { - $_truncatedValue = $optionValue; + $truncatedValue = $optionValue; } - $_truncatedValue = nl2br($_truncatedValue); + $truncatedValue = nl2br($truncatedValue); } - $result = array('value' => $_truncatedValue); + $result = array('value' => $truncatedValue); - if ($maxLength && ($this->_coreString->strlen($optionValue) > $maxLength)) { + if ($maxLength && ($this->string->strlen($optionValue) > $maxLength)) { $result['value'] = $result['value'] . $cutReplacer; $optionValue = nl2br($optionValue); $result['full_view'] = $optionValue; diff --git a/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php b/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php index 1d4ce6d2813116e986e0fbad666d98912774f0ca..c6bcb4f01a9e02d57ac9cbf6e1c17073ce366e87 100644 --- a/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php +++ b/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php @@ -69,37 +69,32 @@ class Attribute extends \Magento\Backend\Helper\Data /** * @param \Magento\Core\Helper\Context $context - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Config\Primary $primaryConfig - * @param \Magento\App\RouterList $routerList + * @param \Magento\App\Route\Config $routeConfig * @param \Magento\Core\Model\AppInterface $app * @param \Magento\Backend\Model\Url $backendUrl * @param \Magento\Backend\Model\Auth $auth * @param \Magento\Backend\App\Area\FrontNameResolver $frontNameResolver + * @param \Magento\Math\Random $mathRandom * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Backend\Model\Session $session * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productsFactory */ public function __construct( \Magento\Core\Helper\Context $context, - \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Config\Primary $primaryConfig, - \Magento\App\RouterList $routerList, + \Magento\App\Route\Config $routeConfig, \Magento\Core\Model\AppInterface $app, \Magento\Backend\Model\Url $backendUrl, \Magento\Backend\Model\Auth $auth, \Magento\Backend\App\Area\FrontNameResolver $frontNameResolver, + \Magento\Math\Random $mathRandom, \Magento\Eav\Model\Config $eavConfig, \Magento\Backend\Model\Session $session, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productsFactory ) { - $this->_eavConfig = $eavConfig; $this->_session = $session; $this->_productsFactory = $productsFactory; - parent::__construct( - $context, $coreData, $primaryConfig, $routerList, $app, $backendUrl, $auth, $frontNameResolver - ); + parent::__construct($context, $routeConfig, $app, $backendUrl, $auth, $frontNameResolver, $mathRandom); } /** diff --git a/app/code/Magento/Catalog/Helper/Product/Flat.php b/app/code/Magento/Catalog/Helper/Product/Flat.php index 212ed6cfad4f15f2e6d33cfa646584366b783855..43b6888ecc11c95d5ac1095dc2db0fecbde3dc3e 100644 --- a/app/code/Magento/Catalog/Helper/Product/Flat.php +++ b/app/code/Magento/Catalog/Helper/Product/Flat.php @@ -96,10 +96,6 @@ class Flat extends \Magento\Catalog\Helper\Flat\AbstractFlat * Construct * * @param \Magento\Index\Model\ProcessFactory $processFactory - - * - * Constructor - * @param \Magento\Index\Model\ProcessFactory $processFactory * @param \Magento\Core\Helper\Context $context * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Catalog\Model\Product\Flat\Flag $flatFlag @@ -116,7 +112,7 @@ class Flat extends \Magento\Catalog\Helper\Flat\AbstractFlat ) { $this->_coreStoreConfig = $coreStoreConfig; parent::__construct($processFactory, $context); - $this->_flagObject = $flatFlag; + $this->_flagObject = $flatFlag->loadSelf(); $this->_addFilterableAttrs = intval($addFilterableAttrs); $this->_addChildData = intval($addChildData); } @@ -128,9 +124,6 @@ class Flat extends \Magento\Catalog\Helper\Flat\AbstractFlat */ public function getFlag() { - if (is_null($this->_flagObject)) { - $this->_flagObject->loadSelf(); - } return $this->_flagObject; } diff --git a/app/code/Magento/Catalog/Helper/Product/Url.php b/app/code/Magento/Catalog/Helper/Product/Url.php index 934b3c5cd16352fdd4bb8df3967d95e39e904ebc..ed198dc39e86ae3c595443aaf1f9ee188f9faa15 100644 --- a/app/code/Magento/Catalog/Helper/Product/Url.php +++ b/app/code/Magento/Catalog/Helper/Product/Url.php @@ -138,7 +138,7 @@ class Url extends \Magento\Core\Helper\Url { $string = strtr($string, $this->getConvertTable()); return '"libiconv"' == ICONV_IMPL - ? iconv(\Magento\Core\Helper\String::ICONV_CHARSET, 'ascii//ignore//translit', $string) + ? iconv(\Magento\Stdlib\String::ICONV_CHARSET, 'ascii//ignore//translit', $string) : $string; } } diff --git a/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php b/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php index fe7b554af08ed3f9caa336ea3e64d777a6ed7e98..d7c7a6c3111fa633ec9068c153fc642ec9d3f3cf 100644 --- a/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php +++ b/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php @@ -52,11 +52,11 @@ class Customlayoutupdate extends \Magento\Eav\Model\Entity\Attribute\Backend\Abs * Construct * * @param \Magento\Adminhtml\Model\LayoutUpdate\ValidatorFactory $layoutUpdateValidatorFactory - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function __construct( \Magento\Adminhtml\Model\LayoutUpdate\ValidatorFactory $layoutUpdateValidatorFactory, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { $this->_layoutUpdateValidatorFactory = $layoutUpdateValidatorFactory; parent::__construct($logger); diff --git a/app/code/Magento/Catalog/Model/Attribute/Config/SchemaLocator.php b/app/code/Magento/Catalog/Model/Attribute/Config/SchemaLocator.php index 3bb4ad8ed12f3d3ccd876953a9f43cf8da5b2d5f..dfe49589e7bc7e1c750f3c6395e4fc9daa26c778 100644 --- a/app/code/Magento/Catalog/Model/Attribute/Config/SchemaLocator.php +++ b/app/code/Magento/Catalog/Model/Attribute/Config/SchemaLocator.php @@ -35,9 +35,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface private $_schema; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Catalog') . '/catalog_attributes.xsd'; } diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index bb70f6ef4d0419a9884a5b886b569848280e3aba..bda04ca32e754454da792f4e035b6f8d8e05168a 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -121,9 +121,9 @@ class Category extends \Magento\Catalog\Model\AbstractModel /** * Core data * - * @var \Magento\Core\Helper\Data + * @var \Magento\Filter\FilterManager */ - protected $_coreData = null; + protected $filter; /** * Core event manager proxy @@ -199,6 +199,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel * @param \Magento\Catalog\Helper\Category\Flat $catalogCategoryFlat * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Filter\FilterManager $filter * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -221,6 +222,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel \Magento\Catalog\Helper\Category\Flat $catalogCategoryFlat, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Filter\FilterManager $filter, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -234,7 +236,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel $this->_catalogConfig = $catalogConfig; $this->_indexIndexer = $indexIndexer; $this->_eventManager = $eventManager; - $this->_coreData = $coreData; + $this->filter = $filter; $this->_catalogCategoryFlat = $catalogCategoryFlat; $this->_treeModel = $categoryTreeResource; parent::__construct($storeManager, $context, $registry, $resource, $resourceCollection, $data); @@ -305,6 +307,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel * @param int $parentId new parent category id * @param int $afterCategoryId category id after which we have put current category * @return \Magento\Catalog\Model\Category + * @throws \Magento\Core\Exception|\Exception */ public function move($parentId, $afterCategoryId) { @@ -399,6 +402,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel * Retrieve all customer attributes * * @todo Use with Flat Resource + * @param bool $noDesignAttributes * @return array */ public function getAttributes($noDesignAttributes = false) @@ -408,7 +412,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel ->getSortedAttributes(); if ($noDesignAttributes){ - foreach ($result as $k=>$a){ + foreach ($result as $k => $a){ if (in_array($k, $this->_designAttributes)) { unset($result[$k]); } @@ -522,11 +526,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel { $url = $this->_getData('url'); if (is_null($url)) { - \Magento\Profiler::start('REWRITE: '.__METHOD__, array('group' => 'REWRITE', 'method' => __METHOD__)); + \Magento\Profiler::start('REWRITE: ' . __METHOD__, array('group' => 'REWRITE', 'method' => __METHOD__)); if ($this->hasData('request_path') && $this->getRequestPath() != '') { $this->setData('url', $this->getUrlInstance()->getDirectUrl($this->getRequestPath())); - \Magento\Profiler::stop('REWRITE: '.__METHOD__); + \Magento\Profiler::stop('REWRITE: ' . __METHOD__); return $this->getData('url'); } @@ -539,11 +543,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel if ($rewrite->getId()) { $this->setData('url', $this->getUrlInstance()->getDirectUrl($rewrite->getRequestPath())); - \Magento\Profiler::stop('REWRITE: '.__METHOD__); + \Magento\Profiler::stop('REWRITE: ' . __METHOD__); return $this->getData('url'); } - \Magento\Profiler::stop('REWRITE: '.__METHOD__); + \Magento\Profiler::stop('REWRITE: ' . __METHOD__); $this->setData('url', $this->getCategoryIdUrl()); return $this->getData('url'); @@ -576,7 +580,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel */ public function formatUrlKey($str) { - $str = $this->_coreData->removeAccents($str); + $str = $this->filter->removeAccents($str); $urlKey = preg_replace('#[^0-9a-z]+#i', '-', $str); $urlKey = strtolower($urlKey); $urlKey = trim($urlKey, '-'); @@ -593,7 +597,8 @@ class Category extends \Magento\Catalog\Model\AbstractModel $url = false; $image = $this->getImage(); if ($image) { - $url = $this->_storeManager->getStore()->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_MEDIA) . 'catalog/category/' . $image; + $url = $this->_storeManager->getStore()->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_MEDIA) + . 'catalog/category/' . $image; } return $url; } diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php index c687969e5c4ba4b2ebeb58c9fe3a5a1e1a709131..222c0136f2e3efd7aca2df04a4506707c11c04db 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php @@ -58,12 +58,12 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Construct * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\App\Dir $dir * @param \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\App\Dir $dir, \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory ) { diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php index 11d8c411f6aa7e691ffd25121111d5a09ad458a8..74d7299cda577ac93b24f41264b189b167dc5454 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php @@ -46,11 +46,11 @@ class Sortby /** * Construct * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\Store\Config $coreStoreConfig */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\Store\Config $coreStoreConfig ) { $this->_coreStoreConfig = $coreStoreConfig; diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php b/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php index 3b015df49d6e3634a660528f5fbe6d961da36241..38385f7cebf0376f1839671cb73c85d5a85a2d09 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php @@ -43,20 +43,18 @@ class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter protected $_resource; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * Construct - * * @param \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $catalogLayer * @param \Magento\Catalog\Model\Resource\Layer\Filter\AttributeFactory $filterAttributeFactory - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param array $data */ public function __construct( @@ -64,11 +62,11 @@ class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $catalogLayer, \Magento\Catalog\Model\Resource\Layer\Filter\AttributeFactory $filterAttributeFactory, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, array $data = array() ) { $this->_resource = $filterAttributeFactory->create(); - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($filterItemFactory, $storeManager, $catalogLayer, $data); $this->_requestVar = 'attribute'; } @@ -144,7 +142,7 @@ class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter if (is_array($option['value'])) { continue; } - if ($this->_coreString->strlen($option['value'])) { + if ($this->string->strlen($option['value'])) { // Check filter type if ($this->_getIsFilterableAttribute($attribute) == self::OPTIONS_ONLY_WITH_RESULTS) { if (!empty($optionsCount[$option['value']])) { diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Category.php b/app/code/Magento/Catalog/Model/Layer/Filter/Category.php index b740a1e7e5a5cb39d50f4c1fbf3bf7a2c34e9c94..52930b3b25c63a27c0bd0280afa28362a680820e 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Category.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Category.php @@ -47,21 +47,21 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter * * @var \Magento\Catalog\Model\Category */ - protected $_appliedCategory = null; + protected $_appliedCategory; /** * Core data * - * @var \Magento\Core\Helper\Data + * @var \Magento\Escaper */ - protected $_coreData = null; + protected $_escaper; /** * Core registry * * @var \Magento\Core\Model\Registry */ - protected $_coreRegistry = null; + protected $_coreRegistry; /** * Category factory @@ -77,7 +77,7 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $catalogLayer * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data */ @@ -86,12 +86,12 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $catalogLayer, \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_categoryFactory = $categoryFactory; - $this->_coreData = $coreData; + $this->_escaper = $escaper; $this->_coreRegistry = $coreRegistry; parent::__construct($filterItemFactory, $storeManager, $catalogLayer, $data); $this->_requestVar = 'cat'; @@ -206,7 +206,7 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter foreach ($categories as $category) { if ($category->getIsActive() && $category->getProductCount()) { $data[] = array( - 'label' => $this->_coreData->escapeHtml($category->getName()), + 'label' => $this->_escaper->escapeHtml($category->getName()), 'value' => $category->getId(), 'count' => $category->getProductCount(), ); diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 7966229e8f9c6b300f96ee3429910e31aa0ce6bb..16ba34b0e779ee07c73969332b3029540d2b04b1 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -2068,7 +2068,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel $this->setData(array()); $this->setOrigData(); $this->_customOptions = array(); - $this->_optionInstance = null; $this->_options = array(); $this->_canAffectOptions = false; $this->_errors = array(); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php index 36f6e8bb3b0019db70b15006296a809bd0c0c3b2..9972c5f786118b4bce9d9a38d2c6eeb3dbb7f8df 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php @@ -44,7 +44,7 @@ class Groupprice /** * Construct * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -53,7 +53,7 @@ class Groupprice * @param \Magento\Core\Model\Config $config */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php index 8b458261d4bffd44fc56bc62cea8995f8c739cc5..40bc88be6ab5c69da98f2937663b84ecfbbaf3df 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php @@ -62,7 +62,7 @@ abstract class AbstractGroupprice /** * Construct * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\Type $catalogProductType @@ -70,7 +70,7 @@ abstract class AbstractGroupprice * @param \Magento\Core\Model\Config $config */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\Type $catalogProductType, diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php index 72525d680998696c60c92ca47b90af555180efa7..cda164b93eef383c6a0a524af5fb0998d1761649 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php @@ -95,7 +95,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Construct * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Catalog\Model\Resource\ProductFactory $productFactory * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb @@ -106,7 +106,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $resourceProductAttribute */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Catalog\Model\Resource\ProductFactory $productFactory, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Helper\File\Storage\Database $fileStorageDb, diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Msrp.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Msrp.php index 761c302de6f56a1711aee681c4e1c87835776de2..c2d8f7d28dcc9e3f71e566029c01cacfb358764b 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Msrp.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Msrp.php @@ -43,11 +43,11 @@ class Msrp extends \Magento\Catalog\Model\Product\Attribute\Backend\Boolean protected $_catalogData = null; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Catalog\Helper\Data $catalogData */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Catalog\Helper\Data $catalogData ) { $this->_catalogData = $catalogData; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php index a3cd655b52472b631fd6c0d6e77686be4cb40e69..e3c1a1ee7cd91cc6178938183b6e39390e8ab351 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php @@ -67,14 +67,14 @@ class Price extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Construct * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Model\Config $config */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php index 78f650bba7a27d0c1775888c17cd91cf49325614..90d7a2e72f62f622ece0ae8426ce5ce93180c86a 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php @@ -44,23 +44,21 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend const SKU_MAX_LENGTH = 64; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * Construct - * - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Logger $logger + * @param \Magento\Stdlib\String $string */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Helper\String $coreString + \Magento\Logger $logger, + \Magento\Stdlib\String $string ) { - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($logger); } @@ -73,14 +71,13 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */ public function validate($object) { - $helper = $this->_coreString; $attrCode = $this->getAttribute()->getAttributeCode(); $value = $object->getData($attrCode); if ($this->getAttribute()->getIsRequired() && $this->getAttribute()->isValueEmpty($value)) { return false; } - if ($helper->strlen($object->getSku()) > self::SKU_MAX_LENGTH) { + if ($this->string->strlen($object->getSku()) > self::SKU_MAX_LENGTH) { throw new \Magento\Core\Exception( __('SKU length should be %1 characters maximum.', self::SKU_MAX_LENGTH) ); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php index 15f97df1086ad06027c7ef3c91428e405b280287..f2d3db3d839c914cb771992c7ceb2603886a999e 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php @@ -49,12 +49,12 @@ class Startdate extends \Magento\Eav\Model\Entity\Attribute\Backend\Datetime * * @param \Magento\Core\Model\Date $date * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function __construct( \Magento\Core\Model\Date $date, \Magento\Core\Model\LocaleInterface $locale, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { $this->_date = $date; parent::__construct($logger, $locale); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php index 7b284f59833bf458a5b148088f6a943859658faf..f05bb82e2b2084038dcf19f33ac73ac24b0fbbf7 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php @@ -46,11 +46,11 @@ class Stock extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Construct * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory ) { $this->_stockItemFactory = $stockItemFactory; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php index 7c231afdcf2abbffa72d106c6cbb0e5b9adce38f..5de002872a20e0d289f8d48c0650f0d3b56ab4ab 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php @@ -47,7 +47,7 @@ class Tierprice /** * Construct * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -56,7 +56,7 @@ class Tierprice * @param \Magento\Core\Model\Config $config */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php index 6f7e829697ab96157abc5596177492320fbe0dfa..ff27e811b577fe987db2174f6b608d1260f29ee8 100644 --- a/app/code/Magento/Catalog/Model/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Option.php @@ -91,6 +91,11 @@ class Option extends \Magento\Core\Model\AbstractModel */ protected $_optionFactory; + /** + * @var \Magento\Stdlib\String + */ + protected $string; + /** * Construct * @@ -98,6 +103,7 @@ class Option extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -107,12 +113,14 @@ class Option extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory, + \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_productOptionValue = $productOptionValue; $this->_optionFactory = $optionFactory; + $this->string = $string; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -279,7 +287,9 @@ class Option extends \Magento\Core\Model\AbstractModel { $group = $this->getGroupByType($type); if (!empty($group)) { - return $this->_optionFactory->create('Magento\Catalog\Model\Product\Option\Type\\' . uc_words($group)); + return $this->_optionFactory->create( + 'Magento\Catalog\Model\Product\Option\Type\\' . $this->string->upperCaseWords($group) + ); } throw new \Magento\Core\Exception(__('The option type to get group instance is incorrect.')); } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php index b9bbe8ba5d6e71b28ee3c9eaac8d75a507f09657..e27fd34751ee7a035b04b772c429538e6e25cf0e 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php @@ -172,7 +172,7 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType } $date = new \Zend_Date($timestamp); - $result = $date->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + $result = $date->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); // Save date in internal format to avoid locale date bugs $this->_setInternalInRequest($result); @@ -201,7 +201,7 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType } elseif ($this->getOption()->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE_TIME) { $format = $this->_locale->getDateTimeFormat(\Magento\Core\Model\LocaleInterface::FORMAT_TYPE_SHORT); $result = $this->_locale - ->date($optionValue, \Magento\Date::DATETIME_INTERNAL_FORMAT, null, false)->toString($format); + ->date($optionValue, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT, null, false)->toString($format); } elseif ($this->getOption()->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_TIME) { $date = new \Zend_Date($optionValue); $result = date($this->is24hTimeFormat() ? 'H:i' : 'h:i a', $date->getTimestamp()); @@ -250,7 +250,7 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType } $date = new \Zend_Date($timestamp); - return $date->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + return $date->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index fa120dd6f16c198b91dde23449ff8749e70819a5..ed4a58fd8048f573d0f70bd999d8040a1d9e2490 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -64,11 +64,9 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType protected $_coreFileStorageDatabase = null; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Escaper */ - protected $_coreData = null; + protected $_escaper; /** * Dir @@ -98,7 +96,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * @param \Magento\UrlInterface $url * @param \Magento\App\Dir $dir * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Filesystem $filesystem @@ -110,7 +108,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType \Magento\UrlInterface $url, \Magento\App\Dir $dir, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Filesystem $filesystem, @@ -120,7 +118,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType $this->_itemOptionFactory = $itemOptionFactory; $this->_url = $url; $this->_dir = $dir; - $this->_coreData = $coreData; + $this->_escaper = $escaper; $this->_coreFileStorageDatabase = $coreFileStorageDatabase; $this->_filesystem = $filesystem; $this->_fileSize = $fileSize; @@ -627,7 +625,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType return sprintf('<a href="%s" target="_blank">%s</a> %s', $this->_getOptionDownloadUrl($urlRoute, $urlParams), - $this->_coreData->escapeHtml($title), + $this->_escaper->escapeHtml($title), $sizes ); } catch (\Exception $e) { @@ -674,7 +672,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType try { $value = unserialize($optionValue); return sprintf('%s [%d]', - $this->_coreData->escapeHtml($value['title']), + $this->_escaper->escapeHtml($value['title']), $this->getConfigurationItemOption()->getId() ); diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php index 692eb3b4551ab0abb548b9492f0deb21b7778bfd..83ac16ae1187dd515a1ace9072c43930f8270102 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php @@ -24,54 +24,46 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Model\Product\Option\Type; + /** * Catalog product option select type - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Model\Product\Option\Type; - class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType { /** * @var mixed */ - protected $_formattedOptionValue = null; + protected $_formattedOptionValue; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Escaper */ - protected $_coreData = null; + protected $_escaper; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * Construct - * * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Core\Helper\String $coreString - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Stdlib\String $string + * @param \Magento\Escaper $escaper * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param array $data */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Core\Helper\String $coreString, - \Magento\Core\Helper\Data $coreData, + \Magento\Stdlib\String $string, + \Magento\Escaper $escaper, \Magento\Core\Model\Store\Config $coreStoreConfig, array $data = array() ) { - $this->_coreString = $coreString; - $this->_coreData = $coreData; + $this->string = $string; + $this->_escaper = $escaper; parent::__construct($checkoutSession, $coreStoreConfig, $data); } @@ -128,7 +120,7 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType public function getFormattedOptionValue($optionValue) { if ($this->_formattedOptionValue === null) { - $this->_formattedOptionValue = $this->_coreData->escapeHtml( + $this->_formattedOptionValue = $this->_escaper->escapeHtml( $this->getEditableOptionValue($optionValue) ); } @@ -168,31 +160,29 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType $result = ''; if (!$this->_isSingleSelection()) { foreach (explode(',', $optionValue) as $_value) { - if ($_result = $option->getValueById($_value)) { + $_result = $option->getValueById($_value); + if ($_result) { $result .= $_result->getTitle() . ', '; } else { if ($this->getListener()) { - $this->getListener() - ->setHasError(true) - ->setMessage( - $this->_getWrongConfigurationMessage() - ); + $this->getListener()->setHasError(true)->setMessage( + $this->_getWrongConfigurationMessage() + ); $result = ''; break; } } } - $result = $this->_coreString->substr($result, 0, -2); + $result = $this->string->substr($result, 0, -2); } elseif ($this->_isSingleSelection()) { - if ($_result = $option->getValueById($optionValue)) { + $_result = $option->getValueById($optionValue); + if ($_result) { $result = $_result->getTitle(); } else { if ($this->getListener()) { - $this->getListener() - ->setHasError(true) - ->setMessage( - $this->_getWrongConfigurationMessage() - ); + $this->getListener()->setHasError(true)->setMessage( + $this->_getWrongConfigurationMessage() + ); } $result = ''; } @@ -211,19 +201,19 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ public function parseOptionValue($optionValue, $productOptionValues) { - $_values = array(); + $values = array(); if (!$this->_isSingleSelection()) { - foreach (explode(',', $optionValue) as $_value) { - $_value = trim($_value); - if (array_key_exists($_value, $productOptionValues)) { - $_values[] = $productOptionValues[$_value]; + foreach (explode(',', $optionValue) as $value) { + $value = trim($value); + if (array_key_exists($value, $productOptionValues)) { + $values[] = $productOptionValues[$value]; } } } elseif ($this->_isSingleSelection() && array_key_exists($optionValue, $productOptionValues)) { - $_values[] = $productOptionValues[$optionValue]; + $values[] = $productOptionValues[$optionValue]; } - if (count($_values)) { - return implode(',', $_values); + if (count($values)) { + return implode(',', $values); } else { return null; } @@ -257,7 +247,8 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType if (!$this->_isSingleSelection()) { foreach(explode(',', $optionValue) as $value) { - if ($_result = $option->getValueById($value)) { + $_result = $option->getValueById($value); + if ($_result) { $result += $this->_getChargableOptionPrice( $_result->getPrice(), $_result->getPriceType() == 'percent', @@ -275,7 +266,8 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType } } } elseif ($this->_isSingleSelection()) { - if ($_result = $option->getValueById($optionValue)) { + $_result = $option->getValueById($optionValue); + if ($_result) { $result = $this->_getChargableOptionPrice( $_result->getPrice(), $_result->getPriceType() == 'percent', @@ -283,11 +275,9 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType ); } else { if ($this->getListener()) { - $this->getListener() - ->setHasError(true) - ->setMessage( - $this->_getWrongConfigurationMessage() - ); + $this->getListener()->setHasError(true)->setMessage( + $this->_getWrongConfigurationMessage() + ); } } } @@ -309,30 +299,28 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType if (!$this->_isSingleSelection()) { $skus = array(); foreach(explode(',', $optionValue) as $value) { - if ($optionSku = $option->getValueById($value)) { + $optionSku = $option->getValueById($value); + if ($optionSku) { $skus[] = $optionSku->getSku(); } else { if ($this->getListener()) { - $this->getListener() - ->setHasError(true) - ->setMessage( - $this->_getWrongConfigurationMessage() - ); + $this->getListener()->setHasError(true)->setMessage( + $this->_getWrongConfigurationMessage() + ); break; } } } $result = implode($skuDelimiter, $skus); } elseif ($this->_isSingleSelection()) { - if ($result = $option->getValueById($optionValue)) { + $result = $option->getValueById($optionValue); + if ($result) { return $result->getSku(); } else { if ($this->getListener()) { - $this->getListener() - ->setHasError(true) - ->setMessage( - $this->_getWrongConfigurationMessage() - ); + $this->getListener()->setHasError(true)->setMessage( + $this->_getWrongConfigurationMessage() + ); } return ''; } @@ -350,10 +338,10 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ protected function _isSingleSelection() { - $_single = array( + $single = array( \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DROP_DOWN, \Magento\Catalog\Model\Product\Option::OPTION_TYPE_RADIO ); - return in_array($this->getOption()->getType(), $_single); + return in_array($this->getOption()->getType(), $single); } } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php index 50c629cc34f8a1c3e442c13a1603709fbd4e4890..29c7bbf4f353c64bdd655f72d5c3c0e172a209c6 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php @@ -24,49 +24,41 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Model\Product\Option\Type; + /** * Catalog product option text type - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Model\Product\Option\Type; - class Text extends \Magento\Catalog\Model\Product\Option\Type\DefaultType { /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Escaper */ - protected $_coreData = null; + protected $_escaper = null; /** - * Constructor - * * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Escaper $escaper + * @param \Magento\Stdlib\String $string * @param array $data */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Escaper $escaper, + \Magento\Stdlib\String $string, array $data = array() ) { - $this->_coreData = $coreData; - $this->_coreString = $coreString; + $this->_escaper = $escaper; + $this->string = $string; parent::__construct($checkoutSession, $coreStoreConfig, $data); } @@ -92,7 +84,7 @@ class Text extends \Magento\Catalog\Model\Product\Option\Type\DefaultType // Check maximal length limit $maxCharacters = $option->getMaxCharacters(); - if ($maxCharacters > 0 && $this->_coreString->strlen($value) > $maxCharacters) { + if ($maxCharacters > 0 && $this->string->strlen($value) > $maxCharacters) { $this->setIsValid(false); throw new \Magento\Core\Exception(__('The text is too long.')); } @@ -123,6 +115,6 @@ class Text extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ public function getFormattedOptionValue($value) { - return $this->_coreData->escapeHtml($value); + return $this->_escaper->escapeHtml($value); } } diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index d97dd402425e670fc81f21120fbf6944ccfe73fb..985f1b154f7d02f9c875d60220aa1e873f5db8f4 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -143,7 +143,7 @@ abstract class AbstractType protected $_eventManager = null; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -187,7 +187,7 @@ abstract class AbstractType * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param array $data */ public function __construct( @@ -200,7 +200,7 @@ abstract class AbstractType \Magento\Core\Helper\File\Storage\Database $fileStorageDb, \Magento\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, array $data = array() ) { $this->_productFactory = $productFactory; diff --git a/app/code/Magento/Catalog/Model/Product/Type/Configurable.php b/app/code/Magento/Catalog/Model/Product/Type/Configurable.php index d4f7ad732e9a260d6dba03b65ddaa698939690f7..2cdec88051be0ae49f456005117da25783bdc78e 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Configurable.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Configurable.php @@ -183,7 +183,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -207,7 +207,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\Core\Helper\File\Storage\Database $fileStorageDb, \Magento\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, array $data = array() ) { $this->_typeConfigurableFactory = $typeConfigurableFactory; diff --git a/app/code/Magento/Catalog/Model/Product/Type/Grouped.php b/app/code/Magento/Catalog/Model/Product/Type/Grouped.php index 4dbbc4bd44240887929c7b677015d0933db3ef09..6fc9353d9baca52078e39d128f643189468a4419 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Grouped.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Grouped.php @@ -108,7 +108,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param array $data */ public function __construct( @@ -124,7 +124,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\Core\Helper\File\Storage\Database $fileStorageDb, \Magento\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, array $data = array() ) { $this->_catalogProductLink = $catalogProductLink; diff --git a/app/code/Magento/Catalog/Model/ProductOptions/Config/SchemaLocator.php b/app/code/Magento/Catalog/Model/ProductOptions/Config/SchemaLocator.php index 682715f433a2305b1f93dfabac9152e1e3f4f7ef..fe7fae5ce5171675d20d183bb7ac18d3935f4cd8 100644 --- a/app/code/Magento/Catalog/Model/ProductOptions/Config/SchemaLocator.php +++ b/app/code/Magento/Catalog/Model/ProductOptions/Config/SchemaLocator.php @@ -40,9 +40,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $etcDir = $moduleReader->getModuleDir('etc', 'Magento_Catalog'); $this->_schema = $etcDir . DIRECTORY_SEPARATOR . 'product_options_merged.xsd'; diff --git a/app/code/Magento/Catalog/Model/ProductTypes/Config/Converter.php b/app/code/Magento/Catalog/Model/ProductTypes/Config/Converter.php index 6b99624692264bb2f1df982aef2c8b024d950dab..22673f2359a2bd4cbc086c7c4f87d29d1044b66a 100644 --- a/app/code/Magento/Catalog/Model/ProductTypes/Config/Converter.php +++ b/app/code/Magento/Catalog/Model/ProductTypes/Config/Converter.php @@ -42,14 +42,17 @@ class Converter implements \Magento\Config\ConverterInterface /** @var $typeNode DOMNode */ foreach ($types as $typeNode) { $typeName = $this->_getAttributeValue($typeNode, 'name'); + $isComposite = $this->_getAttributeValue($typeNode, 'composite', 'false'); + $isDecimal = $this->_getAttributeValue($typeNode, 'canUseQtyDecimals', 'true'); + $isQty = $this->_getAttributeValue($typeNode, 'isQty', 'false'); $data = array(); $data['name'] = $typeName; $data['label'] = $this->_getAttributeValue($typeNode, 'label', ''); $data['model'] = $this->_getAttributeValue($typeNode, 'modelInstance'); - $data['composite'] = (bool) $this->_getAttributeValue($typeNode, 'composite', false); + $data['composite'] = !empty($isComposite) && 'false' !== $isComposite; $data['index_priority'] = (int) $this->_getAttributeValue($typeNode, 'indexPriority', 0); - $data['can_use_qty_decimals'] = (bool) $this->_getAttributeValue($typeNode, 'canUseQtyDecimals', false); - $data['is_qty'] = (bool) $this->_getAttributeValue($typeNode, 'isQty', false); + $data['can_use_qty_decimals'] = !empty($isDecimal) && 'false' !== $isDecimal; + $data['is_qty'] = !empty($isQty) && 'false' !== $isQty; /** @var $childNode DOMNode */ foreach ($typeNode->childNodes as $childNode) { diff --git a/app/code/Magento/Catalog/Model/ProductTypes/Config/SchemaLocator.php b/app/code/Magento/Catalog/Model/ProductTypes/Config/SchemaLocator.php index 88f3b595aa8b624c6caf4ce4763e6e498edcbec1..71e831d56a376e7b665392467b13d345e634c246 100644 --- a/app/code/Magento/Catalog/Model/ProductTypes/Config/SchemaLocator.php +++ b/app/code/Magento/Catalog/Model/ProductTypes/Config/SchemaLocator.php @@ -40,9 +40,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $etcDir = $moduleReader->getModuleDir('etc', 'Magento_Catalog'); $this->_schema = $etcDir . DIRECTORY_SEPARATOR . 'product_types_merged.xsd'; diff --git a/app/code/Magento/Catalog/Model/Resource/AbstractResource.php b/app/code/Magento/Catalog/Model/Resource/AbstractResource.php index 8055f16033f4ddab70040a13d096f119ad9c4b8d..b663345975399ac9d279ffba610cd16ba4552830 100644 --- a/app/code/Magento/Catalog/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Catalog/Model/Resource/AbstractResource.php @@ -60,7 +60,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity * @param \Magento\Core\Model\LocaleInterface $locale @@ -71,7 +71,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity * @param array $data */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity, \Magento\Core\Model\LocaleInterface $locale, diff --git a/app/code/Magento/Catalog/Model/Resource/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Attribute.php index 2050761ae64fea3b5c41f5f7af0513c369d4859b..67f908c11ce0b56a087c089416a29a165b197aba 100644 --- a/app/code/Magento/Catalog/Model/Resource/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Attribute.php @@ -53,7 +53,7 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\App $app * @param \Magento\Eav\Model\Resource\Entity\Type $eavEntityType * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -61,7 +61,7 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute * @param array $arguments */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\App $app, \Magento\Eav\Model\Resource\Entity\Type $eavEntityType, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Catalog/Model/Resource/Category.php b/app/code/Magento/Catalog/Model/Resource/Category.php index 0c861a49f68eac7d25ba07f0493cbc389dcf72f5..6fdf136e6774dafb09e4290fcb4dc3b3123b82b0 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category.php +++ b/app/code/Magento/Catalog/Model/Resource/Category.php @@ -88,7 +88,7 @@ class Category extends \Magento\Catalog\Model\Resource\AbstractResource /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity * @param \Magento\Core\Model\LocaleInterface $locale @@ -104,7 +104,7 @@ class Category extends \Magento\Catalog\Model\Resource\AbstractResource * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity, \Magento\Core\Model\LocaleInterface $locale, diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php index 81f129748ed8f4cffce5dd470232b7fce7711d95..8e371e22e537ec22161bdc96d8d7d9b3c76f33de 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php @@ -49,7 +49,7 @@ class Collection * * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource @@ -57,7 +57,7 @@ class Collection public function __construct( \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Source/Layout.php b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Source/Layout.php index 5bd85563eca87244e92704b28aeb6aab4f7afb2c..cdf17bb3731a61f0f1a5b298335800293ba4f5df 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Source/Layout.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Source/Layout.php @@ -38,19 +38,16 @@ class Layout extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource { /** - * @var \Magento\Core\Model\Config + * @var array */ - protected $_coreConfig; + protected $_cmsLayouts; /** - * Constructor - * - * @param \Magento\Core\Model\Config $coreConfig + * @param array $cmsLayouts */ - public function __construct( - \Magento\Core\Model\Config $coreConfig - ) { - $this->_coreConfig = $coreConfig; + public function __construct(array $cmsLayouts = array()) + { + $this->_cmsLayouts = $cmsLayouts; } /** @@ -61,11 +58,10 @@ class Layout public function getAllOptions() { if (!$this->_options) { - $layouts = array(); - foreach ($this->_coreConfig->getNode('global/cms/layouts')->children() as $layoutName=>$layoutConfig) { + foreach ($this->_cmsLayouts as $layoutName => $layoutConfig) { $this->_options[] = array( - 'value'=>$layoutName, - 'label'=>(string)$layoutConfig->label + 'value' => $layoutName, + 'label' => $layoutConfig ); } array_unshift($this->_options, array('value'=>'', 'label' => __('No layout updates'))); diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php index 1d0540dd1953579c1baa2782b636e761a181c31c..503094f1168ddee4dade8c676dd34083df8e3bcc 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php @@ -157,7 +157,7 @@ class Flat extends \Magento\Index\Model\Resource\AbstractResource /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryCollectionFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -167,7 +167,7 @@ class Flat extends \Magento\Index\Model\Resource\AbstractResource * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryCollectionFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php index cbeca8bafa19b3d69bbaa553713f8512b79af9f1..149ab71dd9e01654deb9011a0f416c87a7e71ccd 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php @@ -69,7 +69,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource @@ -77,7 +77,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl public function __construct( \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Indexer/Product.php b/app/code/Magento/Catalog/Model/Resource/Category/Indexer/Product.php index abdbda5092e192420519424a1f9b92388feb65d3..cbf6bc92ffc8c503324419959d33c07a7861648f 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Indexer/Product.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Indexer/Product.php @@ -89,11 +89,11 @@ class Product extends \Magento\Index\Model\Resource\AbstractResource * Class constructor * * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_eavConfig = $eavConfig; parent::__construct($resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Tree.php b/app/code/Magento/Catalog/Model/Resource/Category/Tree.php index dce8772cc17897512cb46cb4707c627abbd4c7ec..399e73c59f3e2b7c9469699d7a6dc7c999a982ec 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Tree.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Tree.php @@ -81,7 +81,7 @@ class Tree extends \Magento\Data\Tree\Dbp protected $_storeId = null; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_coreResource; @@ -95,7 +95,7 @@ class Tree extends \Magento\Data\Tree\Dbp /** * Cache * - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; @@ -110,18 +110,18 @@ class Tree extends \Magento\Data\Tree\Dbp * Construct * * @param \Magento\Catalog\Model\Resource\Category $catalogCategory - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Catalog\Model\Attribute\Config $attributeConfig * @param \Magento\Catalog\Model\Resource\Category\Collection\Factory $collectionFactory */ public function __construct( \Magento\Catalog\Model\Resource\Category $catalogCategory, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Event\ManagerInterface $eventManager, \Magento\Catalog\Model\Attribute\Config $attributeConfig, \Magento\Catalog\Model\Resource\Category\Collection\Factory $collectionFactory @@ -398,6 +398,21 @@ class Tree extends \Magento\Data\Tree\Dbp return $this->_collection; } + /** + * Clean unneeded collection + * + * @param \Magento\Catalog\Model\Resource\Category\Collection|array $object + */ + protected function _clean($object) + { + if (is_array($object)) { + foreach ($object as $obj) { + $this->_clean($obj); + } + } + unset($object); + } + /** * Enter description here... * @@ -407,7 +422,7 @@ class Tree extends \Magento\Data\Tree\Dbp public function setCollection($collection) { if (!is_null($this->_collection)) { - destruct($this->_collection); + $this->_clean($this->_collection); } $this->_collection = $collection; return $this; diff --git a/app/code/Magento/Catalog/Model/Resource/Collection/AbstractCollection.php b/app/code/Magento/Catalog/Model/Resource/Collection/AbstractCollection.php index c4457cace2d6af2ed25638a2509ba16a8e0cdb3d..7dd01c133ec54de47ef6668b2b6f1b66cdbe9c44 100644 --- a/app/code/Magento/Catalog/Model/Resource/Collection/AbstractCollection.php +++ b/app/code/Magento/Catalog/Model/Resource/Collection/AbstractCollection.php @@ -55,11 +55,11 @@ class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCo * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory @@ -67,11 +67,11 @@ class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCo */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, diff --git a/app/code/Magento/Catalog/Model/Resource/Config.php b/app/code/Magento/Catalog/Model/Resource/Config.php index f3b71eb712ddf05d5cd362103b304d51c79e4242..15957d4c4f4ca11c665e4716860241c6329ab1a7 100644 --- a/app/code/Magento/Catalog/Model/Resource/Config.php +++ b/app/code/Magento/Catalog/Model/Resource/Config.php @@ -69,12 +69,12 @@ class Config extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; diff --git a/app/code/Magento/Catalog/Model/Resource/Helper.php b/app/code/Magento/Catalog/Model/Resource/Helper.php index f344f62ed6d75e9815addb8df7b39d36065a22fd..f20a94f52b6125dc8d571101ca0c022879c46b45 100644 --- a/app/code/Magento/Catalog/Model/Resource/Helper.php +++ b/app/code/Magento/Catalog/Model/Resource/Helper.php @@ -39,10 +39,10 @@ class Helper extends \Magento\Eav\Model\Resource\Helper /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param string $modulePrefix */ - public function __construct(\Magento\Core\Model\Resource $resource, $modulePrefix = 'Magento_Catalog') + public function __construct(\Magento\App\Resource $resource, $modulePrefix = 'Magento_Catalog') { parent::__construct($resource, $modulePrefix); } diff --git a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php index 77e22eabd43f09d8cd62a743c0a02dd94209279d..b67c27a54dfc24e3197b87efc5a9dbfc3149ded0 100644 --- a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php +++ b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php @@ -54,11 +54,11 @@ class Price extends \Magento\Core\Model\Resource\Db\AbstractDb * * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_eventManager = $eventManager; parent::__construct($resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Product.php b/app/code/Magento/Catalog/Model/Resource/Product.php index 572cc993c9b75006fcf92f2a3550bbdd6fe32710..bea631ab776ffbbc466e7c319f7654ee775503c2 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product.php +++ b/app/code/Magento/Catalog/Model/Resource/Product.php @@ -64,7 +64,7 @@ class Product extends \Magento\Catalog\Model\Resource\AbstractResource /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity * @param \Magento\Core\Model\LocaleInterface $locale @@ -79,7 +79,7 @@ class Product extends \Magento\Catalog\Model\Resource\AbstractResource * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity, \Magento\Core\Model\LocaleInterface $locale, diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php index 8add8de7aa6ebf6fd245b15153b1f5d47f035875..3a8aa9d12d3f0b57ec956c36b184a025617b0ae0 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php @@ -55,12 +55,12 @@ class Image * Construct * * @param \Magento\App\Dir $dir - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory */ public function __construct( \Magento\App\Dir $dir, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory ) { $this->_dir = $dir; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php index 926451e2d0c368896ef5e11ea370426473258607..ab653e852e2cc5ea3f3150094679dc9690543d7c 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php @@ -48,11 +48,11 @@ class Urlkey * Construct * * @param \Magento\Catalog\Model\Url $catalogUrl - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function __construct( \Magento\Catalog\Model\Url $catalogUrl, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { $this->_catalogUrl = $catalogUrl; parent::__construct($logger); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php index 8c8e3e8737979f2c6c2c57d4a38bf21302e757cd..99867d52719518bc347d35e6d11ac3c0d73c9bd7 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php @@ -49,7 +49,7 @@ class Collection * * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource @@ -57,7 +57,7 @@ class Collection public function __construct( \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php index d9317c9a798fc3a354fa5e874c86c1c6a66be100..6142b9caac26ed5c7522a4007a9da41b608908cc 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php @@ -257,15 +257,20 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl */ protected $_resourceHelper; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -277,16 +282,17 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -297,7 +303,8 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, - \Magento\Catalog\Model\Resource\Helper $resourceHelper + \Magento\Catalog\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime ) { $this->_catalogData = $catalogData; $this->_catalogProductFlat = $catalogProductFlat; @@ -307,6 +314,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl $this->_locale = $locale; $this->_customerSession = $customerSession; $this->_resourceHelper = $resourceHelper; + $this->dateTime = $dateTime; parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $coreResource, $eavEntityFactory, $resourceHelper, $universalFactory, $storeManager); } @@ -1302,7 +1310,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl $storeDate = $this->_locale->storeTimeStamp($this->getStoreId()); $conditions = 'price_rule.product_id = e.entity_id AND '; - $conditions .= "price_rule.rule_date = '".$this->getResource()->formatDate($storeDate, false)."' AND "; + $conditions .= "price_rule.rule_date = '" . $this->dateTime->formatDate($storeDate, false) . "' AND "; $conditions .= $this->getConnection()->quoteInto('price_rule.website_id = ? AND', $wId); $conditions .= $this->getConnection()->quoteInto('price_rule.customer_group_id = ?', $gId); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection/AssociatedProduct.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection/AssociatedProduct.php index caee095e4d7fd7e8db99ce649fb6b3d5a2657546..ab01778c8391edc2327a4da665d42a65c977125c 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Collection/AssociatedProduct.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection/AssociatedProduct.php @@ -58,11 +58,11 @@ class AssociatedProduct /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -74,6 +74,7 @@ class AssociatedProduct * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Registry $registryManager * @param \Magento\Catalog\Model\Product\Type\Configurable $productType * @param \Magento\Catalog\Helper\Product\Configuration $configurationHelper @@ -81,11 +82,11 @@ class AssociatedProduct */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -97,6 +98,7 @@ class AssociatedProduct \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Registry $registryManager, \Magento\Catalog\Model\Product\Type\Configurable $productType, \Magento\Catalog\Helper\Product\Configuration $configurationHelper @@ -106,7 +108,7 @@ class AssociatedProduct $this->_configurationHelper = $configurationHelper; parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $coreResource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, $catalogProductFlat, $coreStoreConfig, - $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper + $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper, $dateTime ); } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php index 7b05d36586c9e9f76de30be4a8c04823320ec8d3..8dc2d65adfc5f59e0c453d41d4c083b14b924d6b 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php @@ -74,11 +74,11 @@ class Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -90,6 +90,7 @@ class Collection * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Catalog\Model\Resource\Product\Compare\Item $catalogProductCompareItem * @param \Magento\Catalog\Helper\Product\Compare $catalogProductCompare * @@ -97,11 +98,11 @@ class Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -113,15 +114,15 @@ class Collection \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime, \Magento\Catalog\Model\Resource\Product\Compare\Item $catalogProductCompareItem, \Magento\Catalog\Helper\Product\Compare $catalogProductCompare - ) - { + ) { $this->_catalogProductCompareItem = $catalogProductCompareItem; $this->_catalogProductCompare = $catalogProductCompare; parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $coreResource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, $catalogProductFlat, - $coreStoreConfig, $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper + $coreStoreConfig, $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper, $dateTime ); } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Flat.php b/app/code/Magento/Catalog/Model/Resource/Product/Flat.php index 3008f9180aedbaeafbbe1eaf2959d047259bf1c8..297bd6e8cea6f112c7f20beade22bac995a9a7e9 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Flat.php @@ -62,12 +62,12 @@ class Flat extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_storeManager = $storeManager; $this->_catalogConfig = $catalogConfig; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Flat/Indexer.php b/app/code/Magento/Catalog/Model/Resource/Product/Flat/Indexer.php index 70c22b4337425ea04d8eab5976e3515c8c993f5f..29a2dab2aec598208eb3c31a2a922bab4e3067f4 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Flat/Indexer.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Flat/Indexer.php @@ -135,7 +135,7 @@ class Indexer extends \Magento\Index\Model\Resource\AbstractResource protected $_flatAttributeGroups; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -173,13 +173,11 @@ class Indexer extends \Magento\Index\Model\Resource\AbstractResource protected $_resourceHelper; /** - * Construct - * * @param \Magento\Catalog\Model\Resource\ConfigFactory $configFactory * @param \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource $resource - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\App\Resource $resource + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Config $eavConfig @@ -189,15 +187,15 @@ class Indexer extends \Magento\Index\Model\Resource\AbstractResource * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param $maxIndexCount * @param array $flatAttributeGroups - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Catalog\Model\Resource\ConfigFactory $configFactory, \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource $resource, - \Magento\Core\Model\Logger $logger, + \Magento\App\Resource $resource, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Config $eavConfig, diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php index 4bfe0f38ac7d61110bed6ac7c771c6e59ccae4d1..72e0478537f0c28c66ebfbc2d1669cec932e6a2b 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php @@ -46,11 +46,11 @@ abstract class AbstractIndexer extends \Magento\Index\Model\Resource\AbstractRes /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig ) { $this->_eavConfig = $eavConfig; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php index bea9186898950f6b56a5a7a757c3da1f32345f03..6ef01c2606654a954c08c8e0be3f1a0e728c5279 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php @@ -63,13 +63,13 @@ class Eav extends \Magento\Catalog\Model\Resource\Product\Indexer\AbstractIndexe * @param \Magento\Catalog\Model\Resource\Product\Indexer\Eav\DecimalFactory $eavDecimalFactory * @param \Magento\Catalog\Model\Resource\Product\Indexer\Eav\SourceFactory $eavSourceFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Catalog\Model\Resource\Product\Indexer\Eav\DecimalFactory $eavDecimalFactory, \Magento\Catalog\Model\Resource\Product\Indexer\Eav\SourceFactory $eavSourceFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_eavDecimalFactory = $eavDecimalFactory; $this->_eavSourceFactory = $eavSourceFactory; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/AbstractEav.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/AbstractEav.php index 39da61a6335d06d628d2a2dbcd4d08d7712f4130..b1c92c4a51054e02a54f69520867d4055f5944ca 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/AbstractEav.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/AbstractEav.php @@ -47,12 +47,12 @@ abstract class AbstractEav /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Event\ManagerInterface $eventManager */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Event\ManagerInterface $eventManager ) { diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Source.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Source.php index 94b16cbdf10a080ab74b7b11bc2e21493af493c8..319e342ccf3f2426890e09e948c6e6f0cc7b4a2a 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Source.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Source.php @@ -47,13 +47,13 @@ class Source /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Event\ManagerInterface $eventManager, \Magento\Catalog\Model\Resource\Helper $resourceHelper diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price.php index 1b70c2977428b61bc37a9d0363aa87297e04fe00..25fda479b9544c40a6ed3ba8be35524bef14f428 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price.php @@ -92,6 +92,11 @@ class Price extends \Magento\Index\Model\Resource\AbstractResource */ protected $_indexerPriceFactory; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * Class constructor * @@ -99,18 +104,20 @@ class Price extends \Magento\Index\Model\Resource\AbstractResource * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Catalog\Model\Product\Type $catalogProductType - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Config $config * @param \Magento\Catalog\Model\Resource\Product\Indexer\Price\Factory $indexerPriceFactory + * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\LocaleInterface $locale, \Magento\Catalog\Model\Product\Type $catalogProductType, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\Config $config, - \Magento\Catalog\Model\Resource\Product\Indexer\Price\Factory $indexerPriceFactory + \Magento\Catalog\Model\Resource\Product\Indexer\Price\Factory $indexerPriceFactory, + \Magento\Stdlib\DateTime $dateTime ) { $this->_currencyFactory = $currencyFactory; $this->_storeManager = $storeManager; @@ -118,6 +125,7 @@ class Price extends \Magento\Index\Model\Resource\AbstractResource $this->_catalogProductType = $catalogProductType; $this->_config = $config; $this->_indexerPriceFactory = $indexerPriceFactory; + $this->dateTime = $dateTime; parent::__construct($resource); } @@ -655,7 +663,7 @@ class Price extends \Magento\Index\Model\Resource\AbstractResource $timestamp = $this->_locale->storeTimeStamp($store); $data[] = array( 'website_id' => $website->getId(), - 'website_date' => $this->formatDate($timestamp, false), + 'website_date' => $this->dateTime->formatDate($timestamp, false), 'rate' => $rate ); } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php index 85338f590a0ae473c4d310d6cd8f94cbd115276f..e536b695ae0286b9e6cadd2228e54d334c54df9e 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php @@ -68,13 +68,13 @@ class DefaultPrice protected $_eventManager = null; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\Data $coreData */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Helper\Data $coreData diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Link.php b/app/code/Magento/Catalog/Model/Resource/Product/Link.php index 4562fa1291ee1e9d0ed6bf99e5f8cae3b9c040c9..2ac004f3b566508e9034cd7b0d2b089aa5c702a3 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Link.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Link.php @@ -54,11 +54,11 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb * Class constructor * * @param \Magento\Catalog\Model\Resource\Product\Relation $catalogProductRelation - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Catalog\Model\Resource\Product\Relation $catalogProductRelation, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_catalogProductRelation = $catalogProductRelation; parent::__construct($resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option.php b/app/code/Magento/Catalog/Model/Resource/Product/Option.php index dee59c83366fc5fe533dc3d9eefaf3b50f6c2c57..b2aa803203e9ec6e53f96e33ee2386f6bff35770 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option.php @@ -60,13 +60,13 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Config $config */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Config $config diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php index 06125badce53c29364d04ff3aa73f2143e575688..e7a8650a8e2dcbe0d0687c055a0cd0376c066e7d 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php @@ -53,7 +53,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $optionValueCollectionFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource @@ -62,7 +62,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $optionValueCollectionFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php index 5b5683a0a4385ef8233f09a2a43513ec4ae27bdd..7e2e8605b829388e1cee26d2ad08761403163da1 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php @@ -60,13 +60,13 @@ class Value extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Config $config */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Config $config diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Status.php b/app/code/Magento/Catalog/Model/Resource/Product/Status.php index 820b4a672a2ea9a6dc3b587e105bc24a666203b9..a99e7f75747eb4999ec84a0cf7c7796732ebbf9d 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Status.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Status.php @@ -70,13 +70,13 @@ class Status extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\Catalog\Model\Resource\Product $productResource * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product $catalogProduct - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Catalog\Model\Resource\Product $productResource, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product $catalogProduct, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_productResource = $productResource; $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable.php b/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable.php index e6f593446a4cb088f9f819f12d054042b66dec9a..7ad006c29ac99f594e43d87bb9f39de4604dfba4 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable.php @@ -47,11 +47,11 @@ class Configurable extends \Magento\Core\Model\Resource\Db\AbstractDb * Class constructor * * @param \Magento\Catalog\Model\Resource\Product\Relation $catalogProductRelation - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Catalog\Model\Resource\Product\Relation $catalogProductRelation, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_catalogProductRelation = $catalogProductRelation; parent::__construct($resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable/Attribute.php index 96594cc436a2a207bc8863a4a89312e8f7731089..43be06b240b40faf0d86033f097bc08308e09c50 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable/Attribute.php @@ -69,12 +69,12 @@ class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_storeManager = $storeManager; $this->_catalogData = $catalogData; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php index 8bcc774f8da63633be10c1a54d64554b3e66e49e..023381887b88a255ce584f851217c79977942a30 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php @@ -82,7 +82,7 @@ class Collection * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\Type\Configurable $catalogProductTypeConfigurable * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory @@ -92,7 +92,7 @@ class Collection \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\Type\Configurable $catalogProductTypeConfigurable, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Catalog\Helper\Data $catalogData, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php b/app/code/Magento/Catalog/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php index af0a033e75321fccadc5fb70c0445eb606918907..f7c9281ac2998ad2a4040e5e44f8372a0f77efe5 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php @@ -54,11 +54,11 @@ class AssociatedProductsCollection * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -70,6 +70,7 @@ class AssociatedProductsCollection * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $config * @@ -77,11 +78,11 @@ class AssociatedProductsCollection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -93,6 +94,7 @@ class AssociatedProductsCollection \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Registry $coreRegistry, \Magento\Catalog\Model\ProductTypes\ConfigInterface $config ) { @@ -100,7 +102,7 @@ class AssociatedProductsCollection $this->_config = $config; parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $coreResource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, $catalogProductFlat, $coreStoreConfig, - $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper + $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper, $dateTime ); } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Website.php b/app/code/Magento/Catalog/Model/Resource/Product/Website.php index 63ebaa6ffab70d19b1b9d68869b14357d2446486..2cc60096ae47e32e24b98a86129127480585ef4d 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Website.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Website.php @@ -55,12 +55,12 @@ class Website extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param \Magento\Catalog\Model\Resource\Product $productResource * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Catalog\Model\Resource\Product $productResource, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_productResource = $productResource; $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Catalog/Model/Resource/Setup.php b/app/code/Magento/Catalog/Model/Resource/Setup.php index 7f6195a6c7d9d5b140ce729d91586e92677c8b52..50200f13d17964e365ae405ce964f2961e13875e 100755 --- a/app/code/Magento/Catalog/Model/Resource/Setup.php +++ b/app/code/Magento/Catalog/Model/Resource/Setup.php @@ -68,7 +68,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup * Construct * * @param \Magento\Core\Model\Resource\Setup\Context $context - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory * @param string $resourceName * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory @@ -80,7 +80,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup */ public function __construct( \Magento\Core\Model\Resource\Setup\Context $context, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, $resourceName, \Magento\Catalog\Model\CategoryFactory $categoryFactory, diff --git a/app/code/Magento/Catalog/Model/Resource/Url.php b/app/code/Magento/Catalog/Model/Resource/Url.php index e75e6998dd4565ebe5656afc77ff353a0dcfb139..7f423a01a2b88ebecf7f9467b33396338c7a052b 100644 --- a/app/code/Magento/Catalog/Model/Resource/Url.php +++ b/app/code/Magento/Catalog/Model/Resource/Url.php @@ -72,7 +72,7 @@ class Url extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_rootChildrenIds = array(); /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -114,22 +114,20 @@ class Url extends \Magento\Core\Model\Resource\Db\AbstractDb } /** - * Class constructor - * * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Catalog\Model\Product $catalogProduct * @param \Magento\Catalog\Model\Category $catalogCategory - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Logger $logger + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $eavConfig, \Magento\Catalog\Model\Product $catalogProduct, \Magento\Catalog\Model\Category $catalogCategory, - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\Resource $resource + \Magento\Logger $logger, + \Magento\App\Resource $resource ) { $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; diff --git a/app/code/Magento/Catalog/Model/Template/Filter.php b/app/code/Magento/Catalog/Model/Template/Filter.php index e5a34f541f760e9c3a30f5fff17ae421f8560f34..02e9b137d21f58f1e90d3c3c5e48077072981e6d 100644 --- a/app/code/Magento/Catalog/Model/Template/Filter.php +++ b/app/code/Magento/Catalog/Model/Template/Filter.php @@ -66,15 +66,18 @@ class Filter extends \Magento\Filter\Template /** * Construct * + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\View\Url $viewUrl */ public function __construct( + \Magento\Stdlib\String $string, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\View\Url $viewUrl ) { $this->_storeManager = $storeManager; $this->_viewUrl = $viewUrl; + parent::__construct($string); } /** diff --git a/app/code/Magento/Catalog/etc/adminhtml/di.xml b/app/code/Magento/Catalog/etc/adminhtml/di.xml index 2b2384435b1f401dab99f61d15a1c709baf91818..f78dcd79a142147d8bea56bbb530610badb2f44e 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/di.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/di.xml @@ -34,4 +34,26 @@ <value>adminhtml</value> </param> </type> + <type name="Magento\Catalog\Block\Adminhtml\Product\Frontend\Product\Watermark"> + <param name="imageTypes"> + <value> + <small> + <title>Small</title> + <attribute>small_image</attribute> + </small> + <main> + <title>Main</title> + <attribute>image</attribute> + </main> + <cart> + <title>Thumbnail</title> + <attribute>thumbnail</attribute> + </cart> + <custom> + <title>Custom image</title> + <attribute>custom_image</attribute> + </custom> + </value> + </param> + </type> </config> diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 037247ce4099de4597414d1512593dc8119dfaf9..65741871b752c6b346014aad686cd4b8ec33e14f 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -109,7 +109,7 @@ <instance type="Magento\Catalog\Model\Layer\Proxy" /> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <catalog_setup>Magento\Catalog\Model\Resource\Setup</catalog_setup> diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/main.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/main.phtml index d5fa98cfb0a0505ba157194b998767e2cbfcb6c0..ddd93915bc73fe99d3a86dd75b694b802841eee4 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/main.phtml @@ -211,12 +211,12 @@ } if( editSet.SystemNodesExists(editSet.currentNode) ) { - alert('<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('This group contains system attributes. Please move system attributes to another group and try again.')) ?>'); + alert('<?php echo $this->escapeJsQuote(__('This group contains system attributes. Please move system attributes to another group and try again.')) ?>'); return; } if (editSet.ConfigurableNodeExists(editSet.currentNode)) { - alert('<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('This group contains attributes used in configurable products. Please move these attributes to another group and try again.')) ?>'); + alert('<?php echo $this->escapeJsQuote(__('This group contains attributes used in configurable products. Please move these attributes to another group and try again.')) ?>'); return; } @@ -346,7 +346,7 @@ }, failure : function(o) { - alert('<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('We\'re unable to complete this request.')) ?>'); + alert('<?php echo $this->escapeJsQuote(__('We\'re unable to complete this request.')) ?>'); }, groupBeforeMove : function(tree, nodeThis, oldParent, newParent) { @@ -361,11 +361,11 @@ rightBeforeAppend : function(tree, nodeThis, node, newParent) { if (node.attributes.is_user_defined == 0) { - alert('<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('You cannot remove system attributes from this set.')) ?>'); + alert('<?php echo $this->escapeJsQuote(__('You cannot remove system attributes from this set.')) ?>'); return false; } else if (node.attributes.is_configurable == 1) { - alert('<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('This attribute is used in configurable products. You cannot remove it from the attribute set.')) ?>'); + alert('<?php echo $this->escapeJsQuote(__('This attribute is used in configurable products. You cannot remove it from the attribute set.')) ?>'); return false; } else { @@ -380,10 +380,10 @@ } if (node.attributes.is_unassignable == 0) { - alert('<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('You cannot remove system attributes from this set.')) ?>'); + alert('<?php echo $this->escapeJsQuote(__('You cannot remove system attributes from this set.')) ?>'); return false; } else if (node.attributes.is_configurable == 1) { - alert('<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('This attribute is used in configurable products. You cannot remove it from the attribute set.')) ?>'); + alert('<?php echo $this->escapeJsQuote(__('This attribute is used in configurable products. You cannot remove it from the attribute set.')) ?>'); return false; } else { return true; diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/composite/fieldset/options/type/date.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/composite/fieldset/options/type/date.phtml index d973e79ade12f50dc0a2106d0d5f1a57e7c94002..4437cb2bee432b245b77c0fcc33e8cee1ca0470a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/composite/fieldset/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/composite/fieldset/options/type/date.phtml @@ -63,10 +63,10 @@ jQuery.validator.addMethod('validate-datetime-<?php echo $_optionId ?>', function(v) { var dateTimeParts = jQuery('.datetime-picker[id^="options_<?php echo $_optionId ?>"]'); for (var i=0; i < dateTimeParts.length; i++) { - if (dateTimeParts[i].val() == "") return false; + if (dateTimeParts[i].value == "") return false; } return true; - }, '<?php echo $this->jsQuoteEscape( __('This is a required option.') )?>'); + }, '<?php echo $this->escapeJsQuote( __('This is a required option.') )?>'); <?php else: ?> jQuery.validator.addMethod('validate-datetime-<?php echo $_optionId ?>', function(v) { var dateTimeParts = jQuery('.datetime-picker[id^="options_<?php echo $_optionId ?>"]'); @@ -82,8 +82,9 @@ } } return hasWithValue ^ hasWithNoValue; - }, '<?php echo $this->jsQuoteEscape( __('Field is not complete') )?>'); + }, '<?php echo $this->escapeJsQuote( __('Field is not complete') )?>'); <?php endif; ?> //]]> </script> -</dd> + </div> +</div> diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/group.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/group.phtml index 7cb368bb0cf1cf4de1e56fb48de28ab120a0323f..a1a0d21acdf2bf92a51d933a18cc98e099e1f575 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/group.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/group.phtml @@ -66,12 +66,12 @@ var groupPriceRowTemplate = '<tr>' + '<td<?php if (!$_showWebsite): ?> style="display:none"<?php endif; ?>>' + '<select class="<?php echo $_htmlClass; ?> required-entry" name="<?php echo $_htmlName; ?>[{{index}}][website_id]" id="group_price_row_{{index}}_website">' <?php foreach ($this->getWebsites() as $_websiteId => $_info) : ?> - + '<option value="<?php echo $_websiteId; ?>"><?php echo $this->jsQuoteEscape($this->escapeHtml($_info['name'])); ?><?php if (!empty($_info['currency'])) : ?> [<?php echo $this->escapeHtml($_info['currency']); ?>]<?php endif; ?></option>' + + '<option value="<?php echo $_websiteId; ?>"><?php echo $this->escapeJsQuote($this->escapeHtml($_info['name'])); ?><?php if (!empty($_info['currency'])) : ?> [<?php echo $this->escapeHtml($_info['currency']); ?>]<?php endif; ?></option>' <?php endforeach; ?> + '</select></td>' + '<td><select class="<?php echo $_htmlClass; ?> custgroup required-entry" name="<?php echo $_htmlName; ?>[{{index}}][cust_group]" id="group_price_row_{{index}}_cust_group">' <?php foreach ($this->getCustomerGroups() as $_groupId => $_groupName): ?> - + '<option value="<?php echo $_groupId; ?>"><?php echo $this->jsQuoteEscape($this->escapeHtml($_groupName)); ?></option>' + + '<option value="<?php echo $_groupId; ?>"><?php echo $this->escapeJsQuote($this->escapeHtml($_groupName)); ?></option>' <?php endforeach; ?> + '</select></td>' + '<td><input class="<?php echo $_htmlClass; ?> required-entry <?php echo $_priceValueValidation; ?>" type="text" name="<?php echo $_htmlName; ?>[{{index}}][price]" value="{{price}}" id="group_price_row_{{index}}_price" /></td>' diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/tier.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/tier.phtml index e65adb72e6be85adf82afcc102f1fcf8d0e87d72..93611cd05aefb036f2ff32acaf0c49bd9deeca5b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/tier.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/tier.phtml @@ -69,12 +69,12 @@ var tierPriceRowTemplate = '<tr>' + '<td class="col-websites"<?php if (!$_showWebsite): ?> style="display:none"<?php endif; ?>>' + '<select class="<?php echo $_htmlClass ?> required-entry" name="<?php echo $_htmlName ?>[{{index}}][website_id]" id="tier_price_row_{{index}}_website">' <?php foreach ($this->getWebsites() as $_websiteId => $_info): ?> - + '<option value="<?php echo $_websiteId ?>"><?php echo $this->jsQuoteEscape($this->escapeHtml($_info['name'])) ?><?php if (!empty($_info['currency'])): ?> [<?php echo $this->escapeHtml($_info['currency']) ?>]<?php endif; ?></option>' + + '<option value="<?php echo $_websiteId ?>"><?php echo $this->escapeJsQuote($this->escapeHtml($_info['name'])) ?><?php if (!empty($_info['currency'])): ?> [<?php echo $this->escapeHtml($_info['currency']) ?>]<?php endif; ?></option>' <?php endforeach ?> + '</select></td>' + '<td class="col-customer-group"><select class="<?php echo $_htmlClass ?> custgroup required-entry" name="<?php echo $_htmlName ?>[{{index}}][cust_group]" id="tier_price_row_{{index}}_cust_group">' <?php foreach ($this->getCustomerGroups() as $_groupId=>$_groupName): ?> - + '<option value="<?php echo $_groupId ?>"><?php echo $this->jsQuoteEscape($this->escapeHtml($_groupName)) ?></option>' + + '<option value="<?php echo $_groupId ?>"><?php echo $this->escapeJsQuote($this->escapeHtml($_groupName)) ?></option>' <?php endforeach ?> + '</select></td>' + '<td class="col-qty"><small class="nobr" title="<?php echo __("and above")?>"><?php echo __("and above")?></small><input class="<?php echo $_htmlClass ?> qty required-entry validate-greater-than-zero" type="text" name="<?php echo $_htmlName ?>[{{index}}][price_qty]" value="{{qty}}" id="tier_price_row_{{index}}_qty" />' diff --git a/app/code/Magento/Catalog/view/frontend/layer/state.phtml b/app/code/Magento/Catalog/view/frontend/layer/state.phtml index fca3a8d7634f04babf5646a5ae65f2073655f6ae..fa2c878309377e9312e20c7d876f167461959a40 100644 --- a/app/code/Magento/Catalog/view/frontend/layer/state.phtml +++ b/app/code/Magento/Catalog/view/frontend/layer/state.phtml @@ -28,7 +28,7 @@ /** * Category layered navigation state * - * @see \Magento\Catalog\Block\Layer\State + * @var $this \Magento\Catalog\Block\Layer\State */ ?> <?php $_filters = $this->getActiveFilters() ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/price_msrp_item.phtml b/app/code/Magento/Catalog/view/frontend/product/price_msrp_item.phtml index cdf3193eb5bb9c812794e305a32b66324bc64d16..003c3ecc19dc6af6f49bc768019654edffa3c17c 100644 --- a/app/code/Magento/Catalog/view/frontend/product/price_msrp_item.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/price_msrp_item.phtml @@ -54,7 +54,7 @@ $priceElementIdPrefix = $this->getPriceElementIdPrefix() ? $this->getPriceElemen <?php if ($_catalogHelper->isShowPriceOnGesture($_product)): ?> <?php $priceElementId = $priceElementIdPrefix . $_id . $this->getIdSuffix(); ?> <span id="<?php echo $priceElementId ?>" style="display:none"></span> - <?php $popupId = 'msrp-popup-' . $_id . $_coreHelper->getRandomString(20); ?> + <?php $popupId = 'msrp-popup-' . $_id . $this->getRandomString(20); ?> <a href="#" id="<?php echo($popupId);?>"><?php echo __('Click for price'); ?></a> <?php else: ?> @@ -63,7 +63,7 @@ $priceElementIdPrefix = $this->getPriceElementIdPrefix() ? $this->getPriceElemen </span> <?php endif; ?> - <?php $helpLinkId = 'msrp-help-' . $_id . $_coreHelper->getRandomString(20); ?> + <?php $helpLinkId = 'msrp-help-' . $_id . $this->getRandomString(20); ?> <a href="#" id="<?php echo($helpLinkId);?>"><?php echo __("What's this?"); ?></a> </div> diff --git a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php index c83762f3341a0a9caadbd93e16bdb88c705d9517..1d8d9c2fd9c04f5d0b57445647c70f5c3c0e5a5e 100644 --- a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php +++ b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php @@ -57,14 +57,14 @@ class Stock extends \Magento\Data\Form\Element\Select /** * Construct * - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Data\Form\Element\TextFactory $factoryText * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Data\Form\Element\TextFactory $factoryText, @@ -73,7 +73,7 @@ class Stock extends \Magento\Data\Form\Element\Select $this->_factoryText = $factoryText; $this->_qty = isset($attributes['qty']) ? $attributes['qty'] : $this->_createQtyElement(); unset($attributes['qty']); - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setName($attributes['name']); } diff --git a/app/code/Magento/CatalogInventory/Helper/Minsaleqty.php b/app/code/Magento/CatalogInventory/Helper/Minsaleqty.php index ac10463417f4287a5bc7d335b9bc9823ff329d41..7d36740eb0d7f59b2121f173073f82aa1ee76810 100644 --- a/app/code/Magento/CatalogInventory/Helper/Minsaleqty.php +++ b/app/code/Magento/CatalogInventory/Helper/Minsaleqty.php @@ -31,13 +31,6 @@ namespace Magento\CatalogInventory\Helper; class Minsaleqty { - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * Core store config * @@ -46,15 +39,20 @@ class Minsaleqty protected $_coreStoreConfig; /** - * @param \Magento\Core\Helper\Data $coreData + * @var \Magento\Math\Random + */ + protected $mathRandom; + + /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Math\Random $mathRandom */ public function __construct( - \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Math\Random $mathRandom ) { - $this->_coreData = $coreData; $this->_coreStoreConfig = $coreStoreConfig; + $this->mathRandom = $mathRandom; } /** @@ -144,7 +142,7 @@ class Minsaleqty { $result = array(); foreach ($value as $groupId => $qty) { - $_id = $this->_coreData->uniqHash('_'); + $_id = $this->mathRandom->getUniqueHash('_'); $result[$_id] = array( 'customer_group_id' => $groupId, 'min_sale_qty' => $this->_fixQty($qty), diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php index ee23cfa7b80e8949e0b9570dc5b7e54d62c82e4b..7474411b02d714c3678e4e94022040c0ab8e5315 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php @@ -55,13 +55,13 @@ class Stock extends \Magento\Catalog\Model\Resource\Product\Indexer\AbstractInde protected $_productType; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\CatalogInventory\Model\Resource\Indexer\StockFactory $indexerFactory * @param \Magento\Catalog\Model\Product\Type $productType */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\CatalogInventory\Model\Resource\Indexer\StockFactory $indexerFactory, \Magento\Catalog\Model\Product\Type $productType diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php index c68ea6fddbb660f4c31f051abc5ec64a988e05fd..aff991e4fa737400ef8cef3caa53c7ea69ff8f38 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php @@ -62,12 +62,12 @@ class DefaultStock /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Core\Model\Store\Config $coreStoreConfig */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Core\Model\Store\Config $coreStoreConfig ) { diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock.php index cf0ba2931947d994ff3910e402096a9917a94f1d..83de0cb2192191a1f579ed1f4a045bea53259025 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock.php @@ -99,25 +99,33 @@ class Stock extends \Magento\Core\Model\Resource\Db\AbstractDb * @var \Magento\CatalogInventory\Model\StockFactory */ protected $_stockFactory; - + + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\CatalogInventory\Model\StockFactory $stockFactory + * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\CatalogInventory\Model\StockFactory $stockFactory + \Magento\CatalogInventory\Model\StockFactory $stockFactory, + \Magento\Stdlib\DateTime $dateTime ) { parent::__construct($resource); $this->_catalogInventoryData = $catalogInventoryData; $this->_coreStoreConfig = $coreStoreConfig; $this->_stockFactory = $stockFactory; + $this->dateTime = $dateTime; } /** @@ -342,7 +350,7 @@ class Stock extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter = $this->_getWriteAdapter(); $condition = $adapter->quoteInto('(use_config_notify_stock_qty = 1 AND qty < ?)', $this->_configNotifyStockQty) . ' OR (use_config_notify_stock_qty = 0 AND qty < notify_stock_qty)'; - $currentDbTime = $adapter->quoteInto('?', $this->formatDate(true)); + $currentDbTime = $adapter->quoteInto('?', $this->dateTime->formatDate(true)); $conditionalDate = $adapter->getCheckSql($condition, $currentDbTime, 'NULL'); $value = array( diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php index d32eba40001105d8704bb496485572100ac086a5..2e920d1b6cc36d1be49592571ce98f661832fe53 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php @@ -44,11 +44,11 @@ class Item extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_coreStoreConfig; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Store\Config $coreStoreConfig */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\Store\Config $coreStoreConfig ) { $this->_coreStoreConfig = $coreStoreConfig; diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php index efa15f0d8fec702b52674f731078d9c4e3bd8629..169aac951024f9f9d97efd72c22caa0fcbfb4117 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php @@ -38,7 +38,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -46,7 +46,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php index 3cc16817a94072ebe313e67e61181e524a0c6a12..8da9c643f50c3732d2d0ecdb3421bffd5d5cbb7e 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php @@ -49,12 +49,12 @@ class Status extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\WebsiteFactory $websiteFactory */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\WebsiteFactory $websiteFactory ) { diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Stock/Item.php index 5c4c791a7c86ffa24fe4257dc822065e20a8133d..b3bb34fe97b18af18c9933ff2f97d470b83220c5 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Item.php @@ -142,13 +142,6 @@ class Item extends \Magento\Core\Model\AbstractModel */ protected $_catalogInventoryMinsaleqty; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData; - /** * Catalog inventory data * @@ -192,6 +185,11 @@ class Item extends \Magento\Core\Model\AbstractModel */ protected $_customerSession; + /** + * @var \Magento\Math\Division + */ + protected $mathDivision; + /** * Construct * @@ -201,11 +199,11 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\Math\Division $mathDivision * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -217,11 +215,11 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, - \Magento\Core\Helper\Data $coreData, \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\LocaleInterface $locale, + \Magento\Math\Division $mathDivision, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -232,11 +230,11 @@ class Item extends \Magento\Core\Model\AbstractModel $this->_indexer = $indexer; $this->_stockStatus = $stockStatus; $this->_catalogInventoryData = $catalogInventoryData; - $this->_coreData = $coreData; $this->_catalogInventoryMinsaleqty = $catalogInventoryMinsaleqty; $this->_coreStoreConfig = $coreStoreConfig; $this->_storeManager = $storeManager; $this->_locale = $locale; + $this->mathDivision = $mathDivision; } /** @@ -750,7 +748,7 @@ class Item extends \Magento\Core\Model\AbstractModel $qtyIncrements = $this->getDefaultQtyIncrements(); } - if ($qtyIncrements && ($this->_coreData->getExactDivision($qty, $qtyIncrements) != 0)) { + if ($qtyIncrements && ($this->mathDivision->getExactDivision($qty, $qtyIncrements) != 0)) { $result->setHasError(true) ->setQuoteMessage( __('Please correct the quantity for some products.') @@ -827,7 +825,7 @@ class Item extends \Magento\Core\Model\AbstractModel $this->setLowStockDate(null); if ($this->verifyNotification()) { $this->setLowStockDate($this->_locale->date(null, null, null, false) - ->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT) + ->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT) ); } diff --git a/app/code/Magento/CatalogInventory/etc/di.xml b/app/code/Magento/CatalogInventory/etc/di.xml index 00ca544b8dae5a430b3e2b56bb2d8265f550c522..36ce0cb5bc26d458b71bcb2e0527336aed031081 100644 --- a/app/code/Magento/CatalogInventory/etc/di.xml +++ b/app/code/Magento/CatalogInventory/etc/di.xml @@ -47,7 +47,7 @@ <instance type="Magento\CatalogInventory\Helper\Data\Proxy" /> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <cataloginventory_setup>Magento\Eav\Model\Entity\Setup</cataloginventory_setup> diff --git a/app/code/Magento/Adminhtml/Block/Promo/Catalog.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog.php similarity index 82% rename from app/code/Magento/Adminhtml/Block/Promo/Catalog.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog.php index f9fc07b8ba5b50863f6448bde1cdea4d7ffd5bc8..793241469e7237c078c17935c442d721f6390583 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Catalog.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,11 +29,11 @@ * * @category Magento * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo; +namespace Magento\CatalogRule\Block\Adminhtml\Promo; class Catalog extends \Magento\Backend\Block\Widget\Grid\Container { @@ -41,11 +41,12 @@ class Catalog extends \Magento\Backend\Block\Widget\Grid\Container { $this->_addButton('apply_rules', array( 'label' => __('Apply Rules'), - 'onclick' => "location.href='".$this->getUrl('adminhtml/*/applyRules')."'", + 'onclick' => "location.href='".$this->getUrl('catalog_rule/*/applyRules')."'", 'class' => 'apply', )); - $this->_controller = 'promo_catalog'; + $this->_blockGroup = 'Magento_CatalogRule'; + $this->_controller = 'adminhtml_promo_catalog'; $this->_headerText = __('Catalog Price Rules'); $this->_addButtonLabel = __('Add New Rule'); parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php index a6e4eea9d41f93a20c59293754ed86da31134a62..bfd977961fa853a3a0adbc12115fe1592ea46411 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Catalog rule edit form block */ -namespace Magento\Adminhtml\Block\Promo\Catalog; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog; class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -64,7 +64,8 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container protected function _construct() { $this->_objectId = 'id'; - $this->_controller = 'promo_catalog'; + $this->_blockGroup = 'Magento_CatalogRule'; + $this->_controller = 'adminhtml_promo_catalog'; parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Form.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Form.php similarity index 88% rename from app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Form.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Form.php index b7cef26a6c4aed6b38da369c092a8a38a867329d..34ee5a9e41de6b457d87d378e765e43bc8844c08 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Form.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Form.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * * @category Magento * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Catalog\Edit; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { @@ -49,7 +49,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $form = $this->_formFactory->create(array( 'attributes' => array( 'id' => 'edit_form', - 'action' => $this->getData('action'), + 'action' => $this->getUrl('catalog_rule/promo_catalog/save'), 'method' => 'post', )) ); diff --git a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Js.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Js.php similarity index 88% rename from app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Js.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Js.php index a8d1abfccfb3fcc630bdc9f17f57c3139eb69df0..0354db80ea33146f16ef77bcf19e324fb7e6cb38 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Js.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Js.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * description * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Catalog\Edit; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit; class Js extends \Magento\Adminhtml\Block\Template { diff --git a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Actions.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Actions.php index 9b3f0622e70d096e0c4b717547e55c8b6605a005..33a47256f2afbc98aa2eeca95bd9095ade878643 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Actions.php @@ -19,12 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab; class Actions extends \Magento\Backend\Block\Widget\Form\Generic diff --git a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php similarity index 90% rename from app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php index e6f427c74d9999f76146cbd24d7fb2f4f2dd751b..b6a95b26c6cefa4dd3d8fc33c1ad05c3a09fc576 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php @@ -19,12 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab; class Conditions extends \Magento\Backend\Block\Widget\Form\Generic @@ -44,7 +44,7 @@ class Conditions * @param \Magento\Rule\Block\Conditions $conditions * @param \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -53,7 +53,7 @@ class Conditions \Magento\Rule\Block\Conditions $conditions, \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -111,8 +111,8 @@ class Conditions $form = $this->_formFactory->create(); $form->setHtmlIdPrefix('rule_'); - $renderer = $this->_rendererFieldset->setTemplate('Magento_Adminhtml::promo/fieldset.phtml') - ->setNewChildUrl($this->getUrl('adminhtml/promo_catalog/newConditionHtml/form/rule_conditions_fieldset')); + $renderer = $this->_rendererFieldset->setTemplate('Magento_CatalogRule::promo/fieldset.phtml') + ->setNewChildUrl($this->getUrl('catalog_rule/promo_catalog/newConditionHtml/form/rule_conditions_fieldset')); $fieldset = $form->addFieldset('conditions_fieldset', array( 'legend'=>__('Conditions (leave blank for all products)')) diff --git a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php index 6f2ee7f5179ab56ae44cac9145555ef460735c14..c028300cb3cfa10e4e8bef71011176cb5e5db519 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Catalog Rule General Information Tab * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab; class Main extends \Magento\Backend\Block\Widget\Form\Generic @@ -56,7 +56,7 @@ class Main * @param \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -65,7 +65,7 @@ class Main \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup, \Magento\Core\Model\System\Store $systemStore, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -193,7 +193,7 @@ class Main 'label' => __('From Date'), 'title' => __('From Date'), 'image' => $this->getViewFileUrl('images/grid-cal.gif'), - 'input_format' => \Magento\Date::DATE_INTERNAL_FORMAT, + 'input_format' => \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT, 'date_format' => $dateFormat )); $fieldset->addField('to_date', 'date', array( @@ -201,7 +201,7 @@ class Main 'label' => __('To Date'), 'title' => __('To Date'), 'image' => $this->getViewFileUrl('images/grid-cal.gif'), - 'input_format' => \Magento\Date::DATE_INTERNAL_FORMAT, + 'input_format' => \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT, 'date_format' => $dateFormat )); diff --git a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tabs.php similarity index 90% rename from app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tabs.php index 800fb92ac83f955433251100afd6ce77be8d6fd8..0d96ff0d576eea598c6da2dcd310db4f650a856f 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tabs.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * * @category Magento * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Catalog\Edit; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit; class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs { diff --git a/app/code/Magento/Adminhtml/Block/Promo/Widget/Chooser.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Promo/Widget/Chooser.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser.php index e3e726fb109a1dc517cc384bf90b2d7e2611646d..16710323f8a5ae34982ca2732f750a4f4abd0f3a 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Widget/Chooser.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +27,7 @@ /** * Shopping cart price rule chooser */ -namespace Magento\Adminhtml\Block\Promo\Widget; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Widget; class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended { @@ -75,8 +75,8 @@ class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended */ public function prepareElementHtml(\Magento\Data\Form\Element\AbstractElement $element) { - $uniqId = $this->_coreData->uniqHash($element->getId()); - $sourceUrl = $this->getUrl('adminhtml/promo_quote/chooser', array('uniq_id' => $uniqId)); + $uniqId = $this->mathRandom->getUniqueHash($element->getId()); + $sourceUrl = $this->getUrl('catalog_rule/promo_quote/chooser', array('uniq_id' => $uniqId)); $chooser = $this->getLayout()->createBlock('Magento\Widget\Block\Adminhtml\Widget\Chooser') ->setElement($element) @@ -200,6 +200,6 @@ class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended */ public function getGridUrl() { - return $this->getUrl('adminhtml/promo_quote/chooser', array('_current' => true)); + return $this->getUrl('catalog_rule/promo_quote/chooser', array('_current' => true)); } } diff --git a/app/code/Magento/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Daterange.php similarity index 81% rename from app/code/Magento/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Daterange.php index 3f4dfc254344eead63873573c901452428b6ad59..287054dc7b3c51e32c8977b466b0cf67bd22fd61 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Daterange.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Date range promo widget chooser * Currently works without localized format */ -namespace Magento\Adminhtml\Block\Promo\Widget\Chooser; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser; class Daterange extends \Magento\Backend\Block\AbstractBlock { @@ -54,31 +54,29 @@ class Daterange extends \Magento\Backend\Block\AbstractBlock protected $_rangeDelimiter = '...'; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Data\FormFactory */ - protected $_coreData = null; + protected $_formFactory; /** - * @var \Magento\Data\Form\Factory + * @var \Magento\Math\Random */ - protected $_formFactory; + protected $mathRandom; /** - * @param \Magento\Data\Form\Factory $formFactory - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Backend\Block\Context $context + * @param \Magento\Math\Random $mathRandom * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, - \Magento\Core\Helper\Data $coreData, + \Magento\Data\FormFactory $formFactory, \Magento\Backend\Block\Context $context, + \Magento\Math\Random $mathRandom, array $data = array() ) { $this->_formFactory = $formFactory; - $this->_coreData = $coreData; + $this->mathRandom = $mathRandom; parent::__construct($context, $data); } @@ -94,7 +92,7 @@ class Daterange extends \Magento\Backend\Block\AbstractBlock return ''; } - $idSuffix = $this->_coreData->uniqHash(); + $idSuffix = $this->mathRandom->getUniqueHash(); /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(); $dateFields = array( @@ -103,7 +101,7 @@ class Daterange extends \Magento\Backend\Block\AbstractBlock ); foreach ($dateFields as $key => $label) { $form->addField("{$key}_{$idSuffix}", 'date', array( - 'format' => \Magento\Date::DATE_INTERNAL_FORMAT, // hardcoded because hardcoded values delimiter + 'format' => \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT, // hardcoded because hardcoded values delimiter 'label' => $label, 'image' => $this->getViewFileUrl('images/grid-cal.gif'), 'onchange' => "dateTimeChoose_{$idSuffix}()", // won't work through Event.observe() @@ -122,7 +120,7 @@ class Daterange extends \Magento\Backend\Block\AbstractBlock * Target element ID setter * * @param string $value - * @return \Magento\Adminhtml\Block\Promo\Widget\Chooser\Daterange + * @return \Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Daterange */ public function setTargetElementId($value) { @@ -135,7 +133,7 @@ class Daterange extends \Magento\Backend\Block\AbstractBlock * * @param string $from * @param string $to - * @return \Magento\Adminhtml\Block\Promo\Widget\Chooser\Daterange + * @return \Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Daterange */ public function setRangeValues($from, $to) { @@ -148,7 +146,7 @@ class Daterange extends \Magento\Backend\Block\AbstractBlock * Automatically attempts to split the string by delimiter * * @param string $delimitedString - * @return \Magento\Adminhtml\Block\Promo\Widget\Chooser\Daterange + * @return \Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Daterange */ public function setRangeValue($delimitedString) { @@ -164,7 +162,7 @@ class Daterange extends \Magento\Backend\Block\AbstractBlock * Range delimiter setter * * @param string $value - * @return \Magento\Adminhtml\Block\Promo\Widget\Chooser\Daterange + * @return \Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Daterange */ public function setRangeDelimiter($value) { diff --git a/app/code/Magento/Adminhtml/Block/Promo/Widget/Chooser/Sku.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/Promo/Widget/Chooser/Sku.php rename to app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php index 482a4daf4799f4c8bb91bc6d2db990a772663a89..3455e82fbe68092416094d4437eeff311068d116 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Widget/Chooser/Sku.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml sales order create search products block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Widget\Chooser; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser; class Sku extends \Magento\Backend\Block\Widget\Grid\Extended { @@ -127,7 +127,7 @@ class Sku extends \Magento\Backend\Block\Widget\Grid\Extended /** * Prepare Catalog Product Collection for attribute SKU in Promo Conditions SKU chooser * - * @return \Magento\Adminhtml\Block\Promo\Widget\Chooser\Sku + * @return \Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Sku */ protected function _prepareCollection() { @@ -143,7 +143,7 @@ class Sku extends \Magento\Backend\Block\Widget\Grid\Extended /** * Define Cooser Grid Columns and filters * - * @return \Magento\Adminhtml\Block\Promo\Widget\Chooser\Sku + * @return \Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Sku */ protected function _prepareColumns() { @@ -204,7 +204,7 @@ class Sku extends \Magento\Backend\Block\Widget\Grid\Extended public function getGridUrl() { - return $this->getUrl('adminhtml/*/chooser', array( + return $this->getUrl('catalog_rule/*/chooser', array( '_current' => true, 'current_grid_id' => $this->getId(), 'collapse' => null diff --git a/app/code/Magento/Adminhtml/Controller/Promo.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo.php similarity index 92% rename from app/code/Magento/Adminhtml/Controller/Promo.php rename to app/code/Magento/CatalogRule/Controller/Adminhtml/Promo.php index 988b3535165c9923cbc4df7ba1bf1a933bd29c78..e6b307b05f8f41cf3618fb6a1167efb288e3eb73 100644 --- a/app/code/Magento/Adminhtml/Controller/Promo.php +++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * sales admin controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller; +namespace Magento\CatalogRule\Controller\Adminhtml; class Promo extends \Magento\Backend\Controller\Adminhtml\Action { diff --git a/app/code/Magento/Adminhtml/Controller/Promo/Catalog.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php similarity index 90% rename from app/code/Magento/Adminhtml/Controller/Promo/Catalog.php rename to app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php index 8e3568f44fa14051e724926c384ae99732327c7c..67323e46926206cff4ba2e60630da3451be3ef0c 100644 --- a/app/code/Magento/Adminhtml/Controller/Promo/Catalog.php +++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,16 +28,17 @@ * Backend Catalog Price Rules controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Promo; +namespace Magento\CatalogRule\Controller\Adminhtml\Promo; class Catalog extends \Magento\Backend\Controller\Adminhtml\Action { /** * Dirty rules notice message * + * * @var string */ protected $_dirtyRulesNoticeMessage; @@ -107,7 +108,7 @@ class Catalog extends \Magento\Backend\Controller\Adminhtml\Action $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( __('This rule no longer exists.') ); - $this->_redirect('adminhtml/*'); + $this->_redirect('catalog_rule/*'); return; } } @@ -124,7 +125,7 @@ class Catalog extends \Magento\Backend\Controller\Adminhtml\Action $this->_coreRegistry->register('current_promo_catalog_rule', $model); $this->_initAction()->getLayout()->getBlock('promo_catalog_edit') - ->setData('action', $this->getUrl('adminhtml/promo_catalog/save')); + ->setData('action', $this->getUrl('catalog_rule/promo_catalog/save')); $breadcrumb = $id ? __('Edit Rule') : __('New Rule'); $this->_addBreadcrumb($breadcrumb, $breadcrumb)->renderLayout(); @@ -155,7 +156,7 @@ class Catalog extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($errorMessage); } $this->_getSession()->setPageData($data); - $this->_redirect('adminhtml/*/edit', array('id'=>$model->getId())); + $this->_redirect('catalog_rule/*/edit', array('id'=>$model->getId())); return; } @@ -180,10 +181,10 @@ class Catalog extends \Magento\Backend\Controller\Adminhtml\Action ->setState(1) ->save(); if ($this->getRequest()->getParam('back')) { - $this->_redirect('adminhtml/*/edit', array('id' => $model->getId())); + $this->_redirect('catalog_rule/*/edit', array('id' => $model->getId())); return; } - $this->_redirect('adminhtml/*/'); + $this->_redirect('catalog_rule/*/'); } return; } catch (\Magento\Core\Exception $e) { @@ -192,13 +193,13 @@ class Catalog extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError( __('An error occurred while saving the rule data. Please review the log and try again.') ); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setPageData($data); - $this->_redirect('adminhtml/*/edit', array('id' => $this->getRequest()->getParam('rule_id'))); + $this->_redirect('catalog_rule/*/edit', array('id' => $this->getRequest()->getParam('rule_id'))); return; } } - $this->_redirect('adminhtml/*/'); + $this->_redirect('catalog_rule/*/'); } public function deleteAction() @@ -215,7 +216,7 @@ class Catalog extends \Magento\Backend\Controller\Adminhtml\Action $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( __('The rule has been deleted.') ); - $this->_redirect('adminhtml/*/'); + $this->_redirect('catalog_rule/*/'); return; } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); @@ -223,15 +224,15 @@ class Catalog extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError( __('An error occurred while deleting the rule. Please review the log and try again.') ); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); - $this->_redirect('adminhtml/*/edit', array('id' => $this->getRequest()->getParam('id'))); + $this->_objectManager->get('Magento\Logger')->logException($e); + $this->_redirect('catalog_rule/*/edit', array('id' => $this->getRequest()->getParam('id'))); return; } } $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( __('Unable to find a rule to delete.') ); - $this->_redirect('adminhtml/*/'); + $this->_redirect('catalog_rule/*/'); } public function newConditionHtmlAction() @@ -261,7 +262,7 @@ class Catalog extends \Magento\Backend\Controller\Adminhtml\Action public function chooserAction() { if ($this->getRequest()->getParam('attribute') == 'sku') { - $type = 'Magento\Adminhtml\Block\Promo\Widget\Chooser\Sku'; + $type = 'Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Sku'; } if (!empty($type)) { $block = $this->getLayout()->createBlock($type); @@ -317,7 +318,7 @@ class Catalog extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Exception $e) { $this->_getSession()->addError($errorMessage); } - $this->_redirect('adminhtml/*'); + $this->_redirect('catalog_rule/*'); } protected function _isAllowed() diff --git a/app/code/Magento/Adminhtml/Controller/Promo/Widget.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php similarity index 93% rename from app/code/Magento/Adminhtml/Controller/Promo/Widget.php rename to app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php index 8ab328746ee5f58eac985f6629a8fd68e54e0236..69a377fc0cc7bf632cf087a56f9a2d8f26526a85 100644 --- a/app/code/Magento/Adminhtml/Controller/Promo/Widget.php +++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php @@ -19,12 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_CatalogRule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller\Promo; +namespace Magento\CatalogRule\Controller\Adminhtml\Promo; class Widget extends \Magento\Backend\Controller\Adminhtml\Action { @@ -59,7 +59,7 @@ class Widget extends \Magento\Backend\Controller\Adminhtml\Action switch ($request->getParam('attribute')) { case 'sku': $block = $this->getLayout()->createBlock( - 'Magento\Adminhtml\Block\Promo\Widget\Chooser\Sku', 'promo_widget_chooser_sku', + 'Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Sku', 'promo_widget_chooser_sku', array('data' => array('js_form_object' => $request->getParam('form')), )); break; @@ -141,7 +141,7 @@ class Widget extends \Magento\Backend\Controller\Adminhtml\Action $rootId = $this->_objectManager->get('Magento\Core\Model\StoreManager') ->getStore($storeId)->getRootCategoryId(); if (!in_array($rootId, $category->getPathIds())) { - $this->_redirect('adminhtml/*/', array('_current' => true, 'id' => null)); + $this->_redirect('catalog/*/', array('_current' => true, 'id' => null)); return false; } } diff --git a/app/code/Magento/CatalogRule/Model/Observer.php b/app/code/Magento/CatalogRule/Model/Observer.php index af16f9cf5839478361398ef3858b52bb8a5f6769..5d8ed38d7b08e360bb9ec43f899b095edd80ffcd 100644 --- a/app/code/Magento/CatalogRule/Model/Observer.php +++ b/app/code/Magento/CatalogRule/Model/Observer.php @@ -97,44 +97,49 @@ class Observer protected $_resourceRule; /** - * @param \Magento\CatalogRule\Model\Resource\RuleFactory $resourceRuleFactory - * @param \Magento\CatalogRule\Model\Resource\Rule $resourceRule + * @param Resource\RuleFactory $resourceRuleFactory + * @param Resource\Rule $resourceRule + * @param Resource\Rule\CollectionFactory $ruleCollFactory + * @param Rule\Product\Price $productPrice + * @param RuleFactory $ruleFactory + * @param FlagFactory $flagFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\CatalogRule\Model\RuleFactory $ruleFactory - * @param \Magento\CatalogRule\Model\Resource\Rule\CollectionFactory $ruleCollFactory - * @param \Magento\CatalogRule\Model\FlagFactory $flagFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Backend\Model\Session $backendSession - * @param \Magento\CatalogRule\Model\Rule\Product\Price $productPrice + * @param Rule\Product\Price $productPrice * @param \Magento\Core\Model\Registry $coreRegistry - * + * @param \Magento\Stdlib\DateTime $dateTime + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\CatalogRule\Model\Resource\RuleFactory $resourceRuleFactory, - \Magento\CatalogRule\Model\Resource\Rule $resourceRule, + Resource\RuleFactory $resourceRuleFactory, + Resource\Rule $resourceRule, + Resource\Rule\CollectionFactory $ruleCollFactory, + Rule\Product\Price $productPrice, + RuleFactory $ruleFactory, + FlagFactory $flagFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\LocaleInterface $locale, - \Magento\CatalogRule\Model\RuleFactory $ruleFactory, - \Magento\CatalogRule\Model\Resource\Rule\CollectionFactory $ruleCollFactory, - \Magento\CatalogRule\Model\FlagFactory $flagFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Backend\Model\Session $backendSession, \Magento\CatalogRule\Model\Rule\Product\Price $productPrice, - \Magento\Core\Model\Registry $coreRegistry + \Magento\Core\Model\Registry $coreRegistry, + \Magento\Stdlib\DateTime $dateTime ) { - $this->_resourceRule = $resourceRule; $this->_resourceRuleFactory = $resourceRuleFactory; - $this->_storeManager = $storeManager; - $this->_locale = $locale; + $this->_resourceRule = $resourceRule; + $this->_ruleCollFactory = $ruleCollFactory; + $this->_productPrice = $productPrice; $this->_ruleFactory = $ruleFactory; $this->_flagFactory = $flagFactory; - $this->_ruleCollFactory = $ruleCollFactory; + $this->_storeManager = $storeManager; + $this->_locale = $locale; $this->_customerSession = $customerSession; $this->_backendSession = $backendSession; - $this->_productPrice = $productPrice; $this->_coreRegistry = $coreRegistry; + $this->dateTime = $dateTime; } /** @@ -173,7 +178,7 @@ class Observer */ public function applyAllRules($observer) { - $this->_resourceRule->applyAllRulesForDateRange($this->_resourceRule->formatDate(mktime(0,0,0))); + $this->_resourceRule->applyAllRulesForDateRange($this->dateTime->formatDate(mktime(0,0,0))); $this->_flagFactory->create() ->loadSelf() ->setState(0) diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule.php b/app/code/Magento/CatalogRule/Model/Resource/Rule.php index 63a3ce5761488eb4ccd87374e8673c65ebf7daa2..9f37961ec2e0c3420257cc5a6648915d0adb44e3 100644 --- a/app/code/Magento/CatalogRule/Model/Resource/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Resource/Rule.php @@ -94,22 +94,29 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource protected $_storeManager; /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\ConditionFactory $conditionFactory * @param \Magento\Core\Model\Date $coreDate * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\CatalogRule\Helper\Data $catalogRuleData - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( + \Magento\App\Resource $resource, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\ConditionFactory $conditionFactory, \Magento\Core\Model\Date $coreDate, \Magento\Eav\Model\Config $eavConfig, \Magento\Event\ManagerInterface $eventManager, \Magento\CatalogRule\Helper\Data $catalogRuleData, - \Magento\Core\Model\Resource $resource + \Magento\Stdlib\DateTime $dateTime ) { $this->_storeManager = $storeManager; $this->_conditionFactory = $conditionFactory; @@ -117,6 +124,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource $this->_eavConfig = $eavConfig; $this->_eventManager = $eventManager; $this->_catalogRuleData = $catalogRuleData; + $this->dateTime = $dateTime; parent::__construct($resource); } @@ -296,8 +304,8 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource { $write = $this->_getWriteAdapter(); $conds = array(); - $cond = $write->quoteInto('rule_date between ?', $this->formatDate($fromDate)); - $cond = $write->quoteInto($cond.' and ?', $this->formatDate($toDate)); + $cond = $write->quoteInto('rule_date between ?', $this->dateTime->formatDate($fromDate)); + $cond = $write->quoteInto($cond.' and ?', $this->dateTime->formatDate($toDate)); $conds[] = $cond; if (!is_null($productId)) { $conds[] = $write->quoteInto('product_id=?', $productId); @@ -335,7 +343,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource { $write = $this->_getWriteAdapter(); $conds = array(); - $conds[] = $write->quoteInto('rule_date<?', $this->formatDate($date)); + $conds[] = $write->quoteInto('rule_date<?', $this->dateTime->formatDate($date)); if (!is_null($productId)) { $conds[] = $write->quoteInto('product_id=?', $productId); } @@ -651,9 +659,9 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource try { foreach ($arrData as $key => $data) { $productIds['product_id'] = $data['product_id']; - $arrData[$key]['rule_date'] = $this->formatDate($data['rule_date'], false); - $arrData[$key]['latest_start_date'] = $this->formatDate($data['latest_start_date'], false); - $arrData[$key]['earliest_end_date'] = $this->formatDate($data['earliest_end_date'], false); + $arrData[$key]['rule_date'] = $this->dateTime->formatDate($data['rule_date'], false); + $arrData[$key]['latest_start_date'] = $this->dateTime->formatDate($data['latest_start_date'], false); + $arrData[$key]['earliest_end_date'] = $this->dateTime->formatDate($data['earliest_end_date'], false); } $adapter->insertOnDuplicate($this->getTable('catalogrule_affected_product'), array_unique($productIds)); $adapter->insertOnDuplicate($this->getTable('catalogrule_product_price'), $arrData); @@ -705,7 +713,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource $adapter = $this->_getReadAdapter(); $select = $adapter->select() ->from($this->getTable('catalogrule_product_price'), array('product_id', 'rule_price')) - ->where('rule_date = ?', $this->formatDate($date, false)) + ->where('rule_date = ?', $this->dateTime->formatDate($date, false)) ->where('website_id = ?', $websiteId) ->where('customer_group_id = ?', $customerGroupId) ->where('product_id IN(?)', $productIds); @@ -752,7 +760,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource $read = $this->_getReadAdapter(); $select = $read->select() ->from($this->getTable('catalogrule_product_price'), '*') - ->where('rule_date=?', $this->formatDate($date, false)) + ->where('rule_date=?', $this->dateTime->formatDate($date, false)) ->where('website_id=?', $wId) ->where('product_id=?', $pId); diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php index 90281f01bbfa1572ff0f62469b579bb70479bb4c..38f1090f2164914fe531c22e58aa5faa2280ce8e 100644 --- a/app/code/Magento/CatalogRule/Model/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Rule.php @@ -24,6 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\CatalogRule\Model; /** * Catalog Rule data model @@ -55,13 +56,7 @@ * @method \Magento\CatalogRule\Model\Rule setDiscountAmount(float $value) * @method string getWebsiteIds() * @method \Magento\CatalogRule\Model\Rule setWebsiteIds(string $value) - * - * @category Magento - * @package Magento_CatalogRule - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\CatalogRule\Model; - class Rule extends \Magento\Rule\Model\AbstractModel { /** @@ -165,19 +160,24 @@ class Rule extends \Magento\Rule\Model\AbstractModel */ protected $_productCollFactory; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\CatalogRule\Model\Rule\Condition\CombineFactory $combineFactory - * @param \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollFactory + * @param Rule\Condition\CombineFactory $combineFactory + * @param Rule\Action\CollectionFactory $actionCollFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Core\Model\Resource\Iterator $resourceIterator * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\CatalogRule\Helper\Data $catalogRuleData * @param \Magento\Core\Model\Cache\TypeListInterface $cacheTypesList - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $locale @@ -185,7 +185,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param \Magento\Data\Collection\Db $resourceCollection * @param array $relatedCacheTypes * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -199,7 +199,8 @@ class Rule extends \Magento\Rule\Model\AbstractModel \Magento\Customer\Model\Session $customerSession, \Magento\CatalogRule\Helper\Data $catalogRuleData, \Magento\Core\Model\Cache\TypeListInterface $cacheTypesList, - \Magento\Data\Form\Factory $formFactory, + \Magento\Stdlib\DateTime $dateTime, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $locale, @@ -219,6 +220,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel $this->_catalogRuleData = $catalogRuleData; $this->_cacheTypesList = $cacheTypesList; $this->_relatedCacheTypes = $relatedCacheTypes; + $this->dateTime = $dateTime; parent::__construct($formFactory, $context, $registry, $locale, $resource, $resourceCollection, $data); } @@ -274,7 +276,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel public function getNow() { if (!$this->_now) { - return now(); + return $this->dateTime->now(); } return $this->_now; } diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml b/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml index 24d42fb542964c21eaca31861a8f8e1e66d13a9e..84ae05cc481d6f75852b30531bb2f34b76c9afac 100644 --- a/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml +++ b/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml @@ -28,6 +28,6 @@ <config> <menu> <add id="Magento_CatalogRule::promo" title="Promotions" module="Magento_CatalogRule" parent="Magento_Adminhtml::marketing" sortOrder="10" resource="Magento_CatalogRule::promo"/> - <add id="Magento_CatalogRule::promo_catalog" title="Catalog Price Rules" sortOrder="10" module="Magento_CatalogRule" parent="Magento_CatalogRule::promo" action="adminhtml/promo_catalog/" dependsOnModule="Magento_Catalog" resource="Magento_CatalogRule::promo_catalog"/> + <add id="Magento_CatalogRule::promo_catalog" title="Catalog Price Rules" sortOrder="10" module="Magento_CatalogRule" parent="Magento_CatalogRule::promo" action="catalog_rule/promo_catalog/" dependsOnModule="Magento_Catalog" resource="Magento_CatalogRule::promo_catalog"/> </menu> </config> diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml b/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml new file mode 100644 index 0000000000000000000000000000000000000000..d17a44e74c90761a3a53b8e3664ac505660b5a62 --- /dev/null +++ b/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <router id="admin"> + <route id="catalog_rule" frontName="catalog_rule"> + <module name="Magento_CatalogRule_Adminhtml" before="Magento_Adminhtml" /> + </route> + </router> +</config> diff --git a/app/code/Magento/CatalogRule/etc/di.xml b/app/code/Magento/CatalogRule/etc/di.xml index b0fde245ae4a6a67f6bf2db90a4c5a1a59cbb215..d206829e3da8d0ac46382773c9ee877e11b27778 100644 --- a/app/code/Magento/CatalogRule/etc/di.xml +++ b/app/code/Magento/CatalogRule/etc/di.xml @@ -41,7 +41,7 @@ <instance type="Magento\Backend\Model\Session\Proxy" /> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <catalogrule_setup>Magento\Core\Model\Resource\Setup\Generic</catalogrule_setup> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_catalog_block.xml b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_block.xml similarity index 98% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_catalog_block.xml rename to app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_block.xml index 438e9e61e458607b070bc9a18eef05b19391d595..e10dd567260f6d10c1724ca4b7cb214b39d12014 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_catalog_block.xml +++ b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_block.xml @@ -36,7 +36,7 @@ <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" name="promo.catalog.grid.columnSet" as="grid.columnSet"> <arguments> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">adminhtml/*/edit</item> + <item name="path" xsi:type="string">catalog_rule/*/edit</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="id" xsi:type="string">getRuleId</item> </item> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_catalog_edit.xml b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml similarity index 75% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_catalog_edit.xml rename to app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml index 5f348971038b4121fe52983adcba9ab35f4b03c0..17c26f871b87bb75c5e5f0c45d3643103099ac8f 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_catalog_edit.xml +++ b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml @@ -33,10 +33,10 @@ </action> </referenceBlock> <referenceContainer name="left"> - <block class="Magento\Adminhtml\Block\Promo\Catalog\Edit\Tabs" name="promo_catalog_edit_tabs"> - <block class="Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab\Main" name="promo_catalog_edit_tab_main"/> - <block class="Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab\Conditions" name="promo_catalog_edit_tab_conditions"/> - <block class="Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab\Actions" name="promo_catalog_edit_tab_actions"/> + <block class="Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tabs" name="promo_catalog_edit_tabs"> + <block class="Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Main" name="promo_catalog_edit_tab_main"/> + <block class="Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Conditions" name="promo_catalog_edit_tab_conditions"/> + <block class="Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Actions" name="promo_catalog_edit_tab_actions"/> <action method="addTab"> <argument name="name" xsi:type="string">main_section</argument> <argument name="block" xsi:type="string">promo_catalog_edit_tab_main</argument> @@ -52,9 +52,9 @@ </block> </referenceContainer> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Promo\Catalog\Edit" name="promo_catalog_edit"/> + <block class="Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit" name="promo_catalog_edit"/> </referenceContainer> <referenceContainer name="js"> - <block class="Magento\Adminhtml\Block\Promo\Catalog\Edit\Js" template="promo/js.phtml"/> + <block class="Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Js" template="promo/js.phtml"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_catalog_index.xml b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml similarity index 85% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_catalog_index.xml rename to app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml index 5c379c2bdf3d6d7af1cfee668270e474189a45ab..fbec298ca8ac634697c60f5252a3fb530a296f45 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_catalog_index.xml +++ b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml @@ -24,8 +24,8 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="adminhtml_promo_catalog_block"/> + <update handle="catalog_rule_promo_catalog_block"/> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Promo\Catalog" name="adminhtml.promo.catalog.grid.container"/> + <block class="Magento\CatalogRule\Block\Adminhtml\Promo\Catalog" name="adminhtml.promo.catalog.grid.container"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/promo/fieldset.phtml b/app/code/Magento/CatalogRule/view/adminhtml/promo/fieldset.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/promo/fieldset.phtml rename to app/code/Magento/CatalogRule/view/adminhtml/promo/fieldset.phtml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/promo/form.phtml b/app/code/Magento/CatalogRule/view/adminhtml/promo/form.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/promo/form.phtml rename to app/code/Magento/CatalogRule/view/adminhtml/promo/form.phtml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/promo/js.phtml b/app/code/Magento/CatalogRule/view/adminhtml/promo/js.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/promo/js.phtml rename to app/code/Magento/CatalogRule/view/adminhtml/promo/js.phtml diff --git a/app/code/Magento/CatalogSearch/Helper/Data.php b/app/code/Magento/CatalogSearch/Helper/Data.php index e89496d2166eb79448c22412d7226245c4d6ee50..93e59294c7777f963a45f6fb3902d3c50dd95137 100644 --- a/app/code/Magento/CatalogSearch/Helper/Data.php +++ b/app/code/Magento/CatalogSearch/Helper/Data.php @@ -24,16 +24,21 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\CatalogSearch\Helper; + /** * Catalog search helper - * - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\CatalogSearch\Helper; - class Data extends \Magento\Core\Helper\AbstractHelper { + /** + * Query variable + */ const QUERY_VAR_NAME = 'q'; + + /** + * Max query length + */ const MAX_QUERY_LEN = 200; /** @@ -72,11 +77,11 @@ class Data extends \Magento\Core\Helper\AbstractHelper protected $_engine; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * Core store config @@ -92,23 +97,39 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ protected $_queryFactory; + /** + * @var \Magento\Escaper + */ + protected $_escaper; + + /** + * @var \Magento\Filter\FilterManager + */ + protected $filter; + /** * Construct - * + * * @param \Magento\Core\Helper\Context $context - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\CatalogSearch\Model\QueryFactory $queryFactory + * @param \Magento\Escaper $escaper + * @param \Magento\Filter\FilterManager $filter */ public function __construct( \Magento\Core\Helper\Context $context, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\CatalogSearch\Model\QueryFactory $queryFactory + \Magento\CatalogSearch\Model\QueryFactory $queryFactory, + \Magento\Escaper $escaper, + \Magento\Filter\FilterManager $filter ) { - $this->_coreString = $coreString; + $this->string = $string; $this->_coreStoreConfig = $coreStoreConfig; $this->_queryFactory = $queryFactory; + $this->_escaper = $escaper; + $this->filter = $filter; parent::__construct($context); } @@ -146,7 +167,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper public function isMinQueryLength() { $minQueryLength = $this->getMinQueryLength(); - $thisQueryLength = $this->_coreString->strlen($this->getQueryText()); + $thisQueryLength = $this->string->strlen($this->getQueryText()); return !$thisQueryLength || $minQueryLength !== '' && $thisQueryLength < $minQueryLength; } @@ -162,14 +183,13 @@ class Data extends \Magento\Core\Helper\AbstractHelper if ($this->_queryText === null) { $this->_queryText = ''; } else { - /* @var $stringHelper \Magento\Core\Helper\String */ - $stringHelper = $this->_coreString; - $this->_queryText = is_array($this->_queryText) ? '' - : $stringHelper->cleanString(trim($this->_queryText)); + $this->_queryText = is_array($this->_queryText) + ? '' + : $this->string->cleanString(trim($this->_queryText)); $maxQueryLength = $this->getMaxQueryLength(); - if ($maxQueryLength !== '' && $stringHelper->strlen($this->_queryText) > $maxQueryLength) { - $this->_queryText = $stringHelper->substr($this->_queryText, 0, $maxQueryLength); + if ($maxQueryLength !== '' && $this->string->strlen($this->_queryText) > $maxQueryLength) { + $this->_queryText = $this->string->substr($this->_queryText, 0, $maxQueryLength); $this->_isMaxLength = true; } } @@ -184,7 +204,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function getEscapedQueryText() { - return $this->escapeHtml($this->getQueryText()); + return $this->_escaper->escapeHtml($this->getQueryText()); } /** @@ -252,7 +272,10 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function getMinQueryLength($store = null) { - return $this->_coreStoreConfig->getConfig(\Magento\CatalogSearch\Model\Query::XML_PATH_MIN_QUERY_LENGTH, $store); + return $this->_coreStoreConfig->getConfig( + \Magento\CatalogSearch\Model\Query::XML_PATH_MIN_QUERY_LENGTH, + $store + ); } /** @@ -263,7 +286,10 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function getMaxQueryLength($store = null) { - return $this->_coreStoreConfig->getConfig(\Magento\CatalogSearch\Model\Query::XML_PATH_MAX_QUERY_LENGTH, $store); + return $this->_coreStoreConfig->getConfig( + \Magento\CatalogSearch\Model\Query::XML_PATH_MAX_QUERY_LENGTH, + $store + ); } /** @@ -274,7 +300,10 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function getMaxQueryWords($store = null) { - return $this->_coreStoreConfig->getConfig(\Magento\CatalogSearch\Model\Query::XML_PATH_MAX_QUERY_WORDS, $store); + return $this->_coreStoreConfig->getConfig( + \Magento\CatalogSearch\Model\Query::XML_PATH_MAX_QUERY_WORDS, + $store + ); } /** @@ -320,20 +349,24 @@ class Data extends \Magento\Core\Helper\AbstractHelper public function checkNotes($store = null) { if ($this->_isMaxLength) { - $this->addNoteMessage(__('Your search query can\'t be longer than %1, so we had to shorten your query.', $this->getMaxQueryLength())); + $this->addNoteMessage( + __('Your search query can\'t be longer than %1, so we had to shorten your query.', + $this->getMaxQueryLength()) + ); } - /* @var $stringHelper \Magento\Core\Helper\String */ - $stringHelper = $this->_coreString; - - $searchType = $this->_coreStoreConfig->getConfig(\Magento\CatalogSearch\Model\Fulltext::XML_PATH_CATALOG_SEARCH_TYPE); + $searchType = $this->_coreStoreConfig + ->getConfig(\Magento\CatalogSearch\Model\Fulltext::XML_PATH_CATALOG_SEARCH_TYPE); if ($searchType == \Magento\CatalogSearch\Model\Fulltext::SEARCH_TYPE_COMBINE || $searchType == \Magento\CatalogSearch\Model\Fulltext::SEARCH_TYPE_LIKE ) { - $wordsFull = $stringHelper->splitWords($this->getQueryText(), true); - $wordsLike = $stringHelper->splitWords($this->getQueryText(), true, $this->getMaxQueryWords()); + $wordsFull = $this->filter->splitWords($this->getQueryText(), array('uniqueOnly' => true)); + $wordsLike = $this->filter->splitWords( + $this->getQueryText(), + array('uniqueOnly' => true, 'wordsQty' => $this->getMaxQueryWords()) + ); if (count($wordsFull) > count($wordsLike)) { - $wordsCut = array_map(array($this, 'escapeHtml'), array_diff($wordsFull, $wordsLike)); + $wordsCut = array_map(array($this->_escaper, 'escapeHtml'), array_diff($wordsFull, $wordsLike)); $this->addNoteMessage( __('Sorry, but the maximum word count is %1. We left out this part of your search: %2.', $this->getMaxQueryWords(), join(' ', $wordsCut)) ); @@ -356,8 +389,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper foreach ($index as $value) { if (!is_array($value)) { $_index[] = $value; - } - else { + } else { $_index = array_merge($_index, $value); } } diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php b/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php index 5d3ebe37e5894d7bd5e949d15c2aad33a7a5249d..92ea67b3e74bef6ce9e340c2a91ce3f1531e6ae9 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php @@ -53,12 +53,12 @@ class Advanced extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Event\ManagerInterface $eventManager */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Event\ManagerInterface $eventManager ) { diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php index 9ae353ae4c36d19fb3e6aacfc98e65e7758fbf95..7fda440d4cb15a18e30134884dc54e0f6c60366e 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php @@ -45,11 +45,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -61,17 +61,18 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Date $date * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -83,14 +84,14 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Date $date - ) - { + ) { $this->_date = $date; parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $coreResource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, $catalogProductFlat, $coreStoreConfig, $productOptionFactory, $catalogUrl, $locale, - $customerSession, $resourceHelper + $customerSession, $resourceHelper, $dateTime ); } diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php index 04a525732934f4856f53a866e57db0f96baa2084..e98e60c5b0175357599ca7457dc63d4e46b5a1a6 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\CatalogSearch\Model\Resource; /** * CatalogSearch Fulltext Index resource model - * - * @category Magento - * @package Magento_CatalogSearch - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\CatalogSearch\Model\Resource; - class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb { /** @@ -107,9 +102,9 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Core string * - * @var \Magento\Core\Helper\String + * @var \Magento\Filter\FilterManager */ - protected $_coreString; + protected $filter; /** * Core event manager proxy @@ -145,46 +140,52 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_engineProvider; /** - * Construct - * - * @param \Magento\Core\Model\Resource $resource + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\App\Resource $resource * @param \Magento\Catalog\Model\Product\Type $catalogProductType * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Catalog\Model\Product\Status $catalogProductStatus * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $productAttributeCollFactory - * @param \Magento\CatalogSearch\Model\Resource\EngineProvider $engineProvider + * @param EngineProvider $engineProvider * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Filter\FilterManager $filter * @param \Magento\CatalogSearch\Helper\Data $catalogSearchData * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper + * @param Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Catalog\Model\Product\Type $catalogProductType, \Magento\Eav\Model\Config $eavConfig, \Magento\Catalog\Model\Product\Status $catalogProductStatus, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $productAttributeCollFactory, \Magento\CatalogSearch\Model\Resource\EngineProvider $engineProvider, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\String $coreString, + \Magento\Filter\FilterManager $filter, \Magento\CatalogSearch\Helper\Data $catalogSearchData, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper + \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime ) { $this->_catalogProductType = $catalogProductType; $this->_eavConfig = $eavConfig; $this->_catalogProductStatus = $catalogProductStatus; $this->_productAttributeCollFactory = $productAttributeCollFactory; $this->_eventManager = $eventManager; - $this->_coreString = $coreString; + $this->filter = $filter; $this->_catalogSearchData = $catalogSearchData; $this->_coreStoreConfig = $coreStoreConfig; $this->_storeManager = $storeManager; $this->_resourceHelper = $resourceHelper; $this->_engineProvider = $engineProvider; + $this->dateTime = $dateTime; parent::__construct($resource); } @@ -467,8 +468,10 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb if ($searchType == \Magento\CatalogSearch\Model\Fulltext::SEARCH_TYPE_LIKE || $searchType == \Magento\CatalogSearch\Model\Fulltext::SEARCH_TYPE_COMBINE ) { - $words = $this->_coreString - ->splitWords($queryText, true, $query->getMaxQueryWords()); + $words = $this->filter->splitWords($queryText, array( + 'uniqueOnly' => true, + 'wordsQty' => $query->getMaxQueryWords() + )); foreach ($words as $word) { $like[] = $this->_resourceHelper->getCILike('s.data_index', $word, array('position' => 'any')); } @@ -911,9 +914,9 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_dates[$storeId] = array($dateObj, $locale->getTranslation(null, 'date', $locale)); } - if (!is_empty_date($date)) { + if (!$this->dateTime->isEmptyDate($date)) { list($dateObj, $format) = $this->_dates[$storeId]; - $dateObj->setDate($date, \Magento\Date::DATETIME_INTERNAL_FORMAT); + $dateObj->setDate($date, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); return $dateObj->toString($format); } diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php index 5449cc3cc9f8c3d42039976278da515941470587..25fbbb41914178e3499e405c436de4edb45a9c28 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php @@ -52,11 +52,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -68,6 +68,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\CatalogSearch\Helper\Data $catalogSearchData * @param \Magento\CatalogSearch\Model\Fulltext $catalogSearchFulltext * @@ -75,11 +76,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -91,16 +92,16 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime, \Magento\CatalogSearch\Helper\Data $catalogSearchData, \Magento\CatalogSearch\Model\Fulltext $catalogSearchFulltext - ) - { + ) { $this->_catalogSearchFulltext = $catalogSearchFulltext; $this->_catalogSearchData = $catalogSearchData; parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $coreResource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, $catalogProductFlat, $coreStoreConfig, $productOptionFactory, $catalogUrl, $locale, - $customerSession, $resourceHelper + $customerSession, $resourceHelper, $dateTime ); } diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php index 2b303fececd294e81f1cf3f577349faf0040ef2c..e69ac6a9650ed72894614ca45010be2a6d1e6451 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php @@ -85,7 +85,7 @@ class Engine extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\CatalogSearch\Model\Resource\Advanced\CollectionFactory $catalogSearchAdvancedCollFactory * @param \Magento\CatalogSearch\Model\Resource\Fulltext\CollectionFactory $catalogSearchFulltextCollFactory * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility @@ -95,7 +95,7 @@ class Engine extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\CatalogSearch\Model\Resource\Advanced\CollectionFactory $catalogSearchAdvancedCollFactory, \Magento\CatalogSearch\Model\Resource\Fulltext\CollectionFactory $catalogSearchFulltextCollFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Helper.php b/app/code/Magento/CatalogSearch/Model/Resource/Helper.php index 7e96a036881c68f9a8e4692496dda4744c8f64e4..d952b4908ae6fa611d87680a5e4ee980b3c29a38 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Helper.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Helper.php @@ -37,11 +37,11 @@ namespace Magento\CatalogSearch\Model\Resource; class Helper extends \Magento\Eav\Model\Resource\Helper { /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param string $modulePrefix */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, $modulePrefix = 'Magento_CatalogSearch' ) { parent::__construct($resource, $modulePrefix); diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Query.php b/app/code/Magento/CatalogSearch/Model/Resource/Query.php index be416f706f40f58d579a0c354fa6865947d9791c..c16f68cf16d748e1f7b76357e59c8f501cf93a85 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Query.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Query.php @@ -44,16 +44,22 @@ class Query extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_date; /** - * Class constructor - * - * @param \Magento\Core\Model\Resource $resource + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Date $date + * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( - \Magento\Core\Model\Resource $resource, - \Magento\Core\Model\Date $date + \Magento\App\Resource $resource, + \Magento\Core\Model\Date $date, + \Magento\Stdlib\DateTime $dateTime ) { $this->_date = $date; + $this->dateTime = $dateTime; parent::__construct($resource); } @@ -135,7 +141,7 @@ class Query extends \Magento\Core\Model\Resource\Db\AbstractDb */ public function _beforeSave(\Magento\Core\Model\AbstractModel $object) { - $object->setUpdatedAt($this->formatDate($this->_date->gmtTimestamp())); + $object->setUpdatedAt($this->dateTime->formatDate($this->_date->gmtTimestamp())); return $this; } } diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php index 487230cd6028ecd6acc47d54965c1de7f8a27167..db70925f7592822b70dc2e65ebf541afad498fd4 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php @@ -61,7 +61,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -70,7 +70,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php index 316c6498933156d677b6179a7819bb3cbe8fce06..0da7d62a20e57ebaeb0808a11dad79355a7701ef 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php @@ -50,11 +50,6 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection */ protected $_searchQuery; - /** - * @var \Magento\Core\Model\Resource - */ - protected $_resource; - /** * Attribute collection factory * @@ -64,11 +59,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -80,16 +75,16 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory - * @param \Magento\Core\Model\Resource $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $resource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -101,16 +96,15 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, - \Magento\Core\Model\Resource $resource - ) - { + \Magento\App\Resource $resource + ) { $this->_attributeCollectionFactory = $attributeCollectionFactory; - $this->_resource = $resource; parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, - $coreResource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, + $resource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, $catalogProductFlat, $coreStoreConfig, $productOptionFactory, $catalogUrl, $locale, - $customerSession, $resourceHelper + $customerSession, $resourceHelper, $dateTime ); } diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_ajax_suggest.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_ajax_suggest.xml index 18e98ef4125078ec3d7b1bbf6e6b8ae3b7dbf512..0634b0ae444504ca708224ddcd09b5ba6835a988 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_ajax_suggest.xml +++ b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_ajax_suggest.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Catalog Quick Search Form Suggestions" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\CatalogSearch\Block\Autocomplete" name="autocomplete"/> - </block> + <block class="Magento\CatalogSearch\Block\Autocomplete" name="autocomplete" output="1"/> </layout> diff --git a/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php b/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php index f915e5050c0b1c55c8635aa348eb8e1be6bd8743..d7460f27cb09be133a7bd4ff0935ae78e26251df 100644 --- a/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php +++ b/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php @@ -73,7 +73,7 @@ class Index extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Magento\Core\Exception $e) { $result['message'] = $e->getMessage(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $result['message'] = __('Validation failed.'); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); diff --git a/app/code/Magento/Centinel/Model/Config.php b/app/code/Magento/Centinel/Model/Config.php index d7d3329f8d95920989857726b61db18905c48e56..70bd0de7d9410b8f16c60d2749386839372fd834 100644 --- a/app/code/Magento/Centinel/Model/Config.php +++ b/app/code/Magento/Centinel/Model/Config.php @@ -45,13 +45,6 @@ class Config */ protected $_serviceConfigPath = 'payment_services/centinel'; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * Core store config * @@ -65,18 +58,23 @@ class Config protected $_coreConfig; /** - * @param \Magento\Core\Helper\Data $coreData + * @var \Magento\Encryption\EncryptorInterface + */ + protected $_encryptor; + + /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Config $coreConfig + * @param \Magento\Encryption\EncryptorInterface $encryptor */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Config $coreConfig + \Magento\Core\Model\Config $coreConfig, + \Magento\Encryption\EncryptorInterface $encryptor ) { - $this->_coreData = $coreData; $this->_coreStoreConfig = $coreStoreConfig; $this->_coreConfig = $coreConfig; + $this->_encryptor = $encryptor; } /** @@ -128,7 +126,7 @@ class Config */ public function getTransactionPwd() { - return $this->_coreData->decrypt($this->_getServiceConfigValue('password')); + return $this->_encryptor->decrypt($this->_getServiceConfigValue('password')); } /** diff --git a/app/code/Magento/Centinel/view/frontend/layout/centinel_index_authenticationcomplete.xml b/app/code/Magento/Centinel/view/frontend/layout/centinel_index_authenticationcomplete.xml index 09b149fe68228332f34da0c836e9177dd3d33e3d..d196a5b277e50558b8c0cb5fc198b104456d2c64 100644 --- a/app/code/Magento/Centinel/view/frontend/layout/centinel_index_authenticationcomplete.xml +++ b/app/code/Magento/Centinel/view/frontend/layout/centinel_index_authenticationcomplete.xml @@ -24,5 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Centinel\Block\Authentication\Complete" output="1" template="authentication/complete.phtml"/> + <block class="Magento\Centinel\Block\Authentication\Complete" name="root" output="1" template="authentication/complete.phtml"/> </layout> diff --git a/app/code/Magento/Centinel/view/frontend/layout/centinel_index_authenticationstart.xml b/app/code/Magento/Centinel/view/frontend/layout/centinel_index_authenticationstart.xml index 1e2ce8dc2552c5ad1d730f577b5c0ad16983897a..de9ad4a7bde1a049216ac7a4e923563313518206 100644 --- a/app/code/Magento/Centinel/view/frontend/layout/centinel_index_authenticationstart.xml +++ b/app/code/Magento/Centinel/view/frontend/layout/centinel_index_authenticationstart.xml @@ -24,5 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Centinel\Block\Authentication\Start" output="1" template="authentication/start.phtml"/> + <block class="Magento\Centinel\Block\Authentication\Start" name="root" output="1" template="authentication/start.phtml"/> </layout> diff --git a/app/code/Magento/Adminhtml/Block/Checkout/Agreement.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement.php similarity index 79% rename from app/code/Magento/Adminhtml/Block/Checkout/Agreement.php rename to app/code/Magento/Checkout/Block/Adminhtml/Agreement.php index 2aeb70fbbb0c54dc806f2542ca717eb277bad18e..9f1da0aecd8bdd661c219ca462239fe56619b26b 100644 --- a/app/code/Magento/Adminhtml/Block/Checkout/Agreement.php +++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Checkout * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,19 +28,20 @@ * Admin tax rule content block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Checkout; +namespace Magento\Checkout\Block\Adminhtml; class Agreement extends \Magento\Adminhtml\Block\Widget\Grid\Container { protected function _construct() { - $this->_controller = 'checkout_agreement'; - $this->_headerText = __('Terms and Conditions'); - $this->_addButtonLabel = __('Add New Condition'); + $this->_controller = 'adminhtml_agreement'; + $this->_blockGroup = 'Magento_Checkout'; + $this->_headerText = __('Terms and Conditions'); + $this->_addButtonLabel = __('Add New Condition'); parent::_construct(); } } diff --git a/app/code/Magento/Adminhtml/Block/Checkout/Agreement/Edit.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/Checkout/Agreement/Edit.php rename to app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php index 44e30ac5094c7f2b9c9febc7e45ac4e59ff692fa..2654b64b9c5415602c25eef82cf0174bef13a6a6 100644 --- a/app/code/Magento/Adminhtml/Block/Checkout/Agreement/Edit.php +++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit.php @@ -19,16 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Checkout * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Adminhtml tax rule Edit Container - */ - -namespace Magento\Adminhtml\Block\Checkout\Agreement; +namespace Magento\Checkout\Block\Adminhtml\Agreement; class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -62,7 +58,8 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container protected function _construct() { $this->_objectId = 'id'; - $this->_controller = 'checkout_agreement'; + $this->_controller = 'adminhtml_agreement'; + $this->_blockGroup = 'Magento_Checkout'; parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/Checkout/Agreement/Edit/Form.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Checkout/Agreement/Edit/Form.php rename to app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php index aee5eb815749dd28516bec82181fc1c1da1cd884..340071531db3b098e1c0688dc5ab47773ade6d87 100644 --- a/app/code/Magento/Adminhtml/Block/Checkout/Agreement/Edit/Form.php +++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php @@ -19,15 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Checkout * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Adminhtml Tax Rule Edit Form - */ -namespace Magento\Adminhtml\Block\Checkout\Agreement\Edit; +namespace Magento\Checkout\Block\Adminhtml\Agreement\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { @@ -39,7 +36,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -47,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic public function __construct( \Magento\Core\Model\System\Store $systemStore, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/Checkout/Agreement/Grid.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Checkout/Agreement/Grid.php rename to app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php index 599d2d53d63d83d1cbcde21cba2ed0cb4d621f7a..7b28d430ac14e1703117517591ae567c57f494bd 100644 --- a/app/code/Magento/Adminhtml/Block/Checkout/Agreement/Grid.php +++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Grid.php @@ -19,11 +19,11 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Checkout * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Checkout\Agreement; +namespace Magento\Checkout\Block\Adminhtml\Agreement; class Grid extends \Magento\Adminhtml\Block\Widget\Grid { @@ -134,7 +134,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function getRowUrl($row) { - return $this->getUrl('adminhtml/*/edit', array('id' => $row->getId())); + return $this->getUrl('checkout/*/edit', array('id' => $row->getId())); } } diff --git a/app/code/Magento/Checkout/Block/Cart/Totals.php b/app/code/Magento/Checkout/Block/Cart/Totals.php index 824698b72c103035c494b5dd05238fd3243a35a0..cae238ed8823a4344d1cbaf08670ab1acbd9c039 100644 --- a/app/code/Magento/Checkout/Block/Cart/Totals.php +++ b/app/code/Magento/Checkout/Block/Cart/Totals.php @@ -94,7 +94,7 @@ class Totals extends \Magento\Checkout\Block\Cart\AbstractCart $blockName = $code . '_total_renderer'; $block = $this->getLayout()->getBlock($blockName); if (!$block) { - $renderer = $this->_salesConfig->getTotalsRenderer('quote', 'totals', $code, 'frontend'); + $renderer = $this->_salesConfig->getTotalsRenderer('quote', 'totals', $code); if (!empty($renderer)) { $block = $renderer; } else { diff --git a/app/code/Magento/Checkout/Block/Onepage/Success.php b/app/code/Magento/Checkout/Block/Onepage/Success.php index 6f7f77ceab9a715f1844255daa6068853b5e0f69..48f6474e6b1e3e7290d9b8a494fccd1e561fb8c8 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Success.php +++ b/app/code/Magento/Checkout/Block/Onepage/Success.php @@ -72,7 +72,7 @@ class Success extends \Magento\Core\Block\Template * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Billing\AgreementFactory $agreementFactory - * @param \Magento\Sales\Model\Resource\Recurring\Profile\Collection $profileCollFactory + * @param \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory $profileCollFactory * @param \Magento\Sales\Model\Order\Config $orderConfig * @param array $data */ @@ -83,7 +83,7 @@ class Success extends \Magento\Core\Block\Template \Magento\Customer\Model\Session $customerSession, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Billing\AgreementFactory $agreementFactory, - \Magento\Sales\Model\Resource\Recurring\Profile\Collection $profileCollFactory, + \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory $profileCollFactory, \Magento\Sales\Model\Order\Config $orderConfig, array $data = array() ) { diff --git a/app/code/Magento/Adminhtml/Controller/Checkout/Agreement.php b/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php similarity index 89% rename from app/code/Magento/Adminhtml/Controller/Checkout/Agreement.php rename to app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php index fea93990fbaac7c50ee34e3d61e9f45b430f5261..8deba3850f3b0d972ad4cfa91bd944235333234b 100644 --- a/app/code/Magento/Adminhtml/Controller/Checkout/Agreement.php +++ b/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php @@ -19,19 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Checkout * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Tax rule controller - * - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Adminhtml\Controller\Checkout; +namespace Magento\Checkout\Controller\Adminhtml; class Agreement extends \Magento\Backend\Controller\Adminhtml\Action { @@ -59,7 +52,7 @@ class Agreement extends \Magento\Backend\Controller\Adminhtml\Action $this->_title(__('Terms and Conditions')); $this->_initAction() - ->_addContent($this->getLayout()->createBlock('Magento\Adminhtml\Block\Checkout\Agreement')) + ->_addContent($this->getLayout()->createBlock('Magento\Checkout\Block\Adminhtml\Agreement')) ->renderLayout(); return $this; } @@ -82,7 +75,7 @@ class Agreement extends \Magento\Backend\Controller\Adminhtml\Action $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( __('This condition no longer exists.') ); - $this->_redirect('adminhtml/*/'); + $this->_redirect('checkout/*/'); return; } } @@ -103,8 +96,8 @@ class Agreement extends \Magento\Backend\Controller\Adminhtml\Action ) ->_addContent( $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Checkout\Agreement\Edit') - ->setData('action', $this->getUrl('adminhtml/*/save')) + ->createBlock('Magento\Checkout\Block\Adminhtml\Agreement\Edit') + ->setData('action', $this->getUrl('checkout/*/save')) ) ->renderLayout(); } @@ -120,7 +113,7 @@ class Agreement extends \Magento\Backend\Controller\Adminhtml\Action $model->save(); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The condition has been saved.')); - $this->_redirect('adminhtml/*/'); + $this->_redirect('checkout/*/'); return; } catch (\Magento\Core\Exception $e) { @@ -141,14 +134,14 @@ class Agreement extends \Magento\Backend\Controller\Adminhtml\Action ->load($id); if (!$model->getId()) { $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('This condition no longer exists.')); - $this->_redirect('adminhtml/*/'); + $this->_redirect('checkout/*/'); return; } try { $model->delete(); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The condition has been deleted.')); - $this->_redirect('adminhtml/*/'); + $this->_redirect('checkout/*/'); return; } catch (\Magento\Core\Exception $e) { $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); diff --git a/app/code/Magento/Checkout/Controller/Cart.php b/app/code/Magento/Checkout/Controller/Cart.php index ebe8bfcb12c32fcccbfdc21b5de9d5998ba5a0d6..9d439f87b2abf3dcfb9fba378be8780d329f6e9b 100644 --- a/app/code/Magento/Checkout/Controller/Cart.php +++ b/app/code/Magento/Checkout/Controller/Cart.php @@ -160,7 +160,7 @@ class Cart foreach ($cart->getQuote()->getMessages() as $message) { if ($message) { // Escape HTML entities in quote message to prevent XSS - $message->setCode($this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($message->getCode())); + $message->setCode($this->_objectManager->get('Magento\Escaper')->escapeHtml($message->getCode())); $messages[] = $message; } } @@ -226,18 +226,18 @@ class Cart if (!$this->_checkoutSession->getNoCartRedirect(true)) { if (!$cart->getQuote()->getHasError()){ - $message = __('You added %1 to your shopping cart.', $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($product->getName())); + $message = __('You added %1 to your shopping cart.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName())); $this->_checkoutSession->addSuccess($message); } $this->_goBack(); } } catch (\Magento\Core\Exception $e) { if ($this->_checkoutSession->getUseNotice(true)) { - $this->_checkoutSession->addNotice($this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($e->getMessage())); + $this->_checkoutSession->addNotice($this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage())); } else { $messages = array_unique(explode("\n", $e->getMessage())); foreach ($messages as $message) { - $this->_checkoutSession->addError($this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($message)); + $this->_checkoutSession->addError($this->_objectManager->get('Magento\Escaper')->escapeHtml($message)); } } @@ -249,7 +249,7 @@ class Cart } } catch (\Exception $e) { $this->_checkoutSession->addException($e, __('We cannot add this item to your shopping cart')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_goBack(); } } @@ -275,7 +275,7 @@ class Cart } } catch (\Exception $e) { $this->_checkoutSession->addException($e, __('We cannot add this item to your shopping cart')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_goBack(); } } @@ -315,7 +315,7 @@ class Cart ); } catch (\Exception $e) { $this->_checkoutSession->addError(__('We cannot configure the product.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_goBack(); return; } @@ -368,7 +368,7 @@ class Cart ); if (!$this->_checkoutSession->getNoCartRedirect(true)) { if (!$cart->getQuote()->getHasError()){ - $message = __('%1 was updated in your shopping cart.', $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($item->getProduct()->getName())); + $message = __('%1 was updated in your shopping cart.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($item->getProduct()->getName())); $this->_checkoutSession->addSuccess($message); } $this->_goBack(); @@ -391,7 +391,7 @@ class Cart } } catch (\Exception $e) { $this->_checkoutSession->addException($e, __('We cannot update the item.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_goBack(); } $this->_redirect('*/*'); @@ -445,10 +445,10 @@ class Cart } $this->_checkoutSession->setCartWasUpdated(true); } catch (\Magento\Core\Exception $e) { - $this->_checkoutSession->addError($this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($e->getMessage())); + $this->_checkoutSession->addError($this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage())); } catch (\Exception $e) { $this->_checkoutSession->addException($e, __('We cannot update the shopping cart.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } @@ -479,7 +479,7 @@ class Cart ->save(); } catch (\Exception $e) { $this->_checkoutSession->addError(__('We cannot remove the item.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } $this->_redirectReferer($this->_objectManager->create('Magento\UrlInterface')->getUrl('*/*')); @@ -552,11 +552,11 @@ class Cart if ($codeLength) { if ($isCodeLengthValid && $couponCode == $this->_getQuote()->getCouponCode()) { $this->_checkoutSession->addSuccess( - __('The coupon code "%1" was applied.', $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($couponCode)) + __('The coupon code "%1" was applied.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($couponCode)) ); } else { $this->_checkoutSession->addError( - __('The coupon code "%1" is not valid.', $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($couponCode)) + __('The coupon code "%1" is not valid.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($couponCode)) ); } } else { @@ -567,7 +567,7 @@ class Cart $this->_checkoutSession->addError($e->getMessage()); } catch (\Exception $e) { $this->_checkoutSession->addError(__('We cannot apply the coupon code.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_goBack(); diff --git a/app/code/Magento/Checkout/Controller/Multishipping.php b/app/code/Magento/Checkout/Controller/Multishipping.php index 7ac37e99e253d772841d2633ab68d428752ba97a..29da8e0daf564f8f93fad914989555172145c489 100644 --- a/app/code/Magento/Checkout/Controller/Multishipping.php +++ b/app/code/Magento/Checkout/Controller/Multishipping.php @@ -453,7 +453,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action $this->_getCheckoutSession()->addError($e->getMessage()); $this->_redirect('*/*/billing'); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getCheckoutSession()->addException($e, __('We cannot open the overview page.')); $this->_redirect('*/*/billing'); } @@ -518,7 +518,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action $this->_getCheckoutSession()->addError($e->getMessage()); $this->_redirect('*/*/billing'); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_objectManager->get('Magento\Checkout\Helper\Data') ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping'); $this->_getCheckoutSession()->addError(__('Order place error')); diff --git a/app/code/Magento/Checkout/Controller/Onepage.php b/app/code/Magento/Checkout/Controller/Onepage.php index cc6869c7f66f463d7b254e07da020667f71661cc..0a538f3918e5817a08b4fcc8c54dec8d6930b714 100644 --- a/app/code/Magento/Checkout/Controller/Onepage.php +++ b/app/code/Magento/Checkout/Controller/Onepage.php @@ -93,8 +93,7 @@ class Onepage extends \Magento\Checkout\Controller\Action { $this->getResponse() ->setHeader('HTTP/1.1', '403 Session Expired') - ->setHeader('Login-Required', 'true') - ->sendResponse(); + ->setHeader('Login-Required', 'true'); return $this; } @@ -477,7 +476,7 @@ class Onepage extends \Magento\Checkout\Controller\Action } catch (\Magento\Core\Exception $e) { $result['error'] = $e->getMessage(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $result['error'] = __('Unable to set Payment Method'); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); @@ -574,7 +573,7 @@ class Onepage extends \Magento\Checkout\Controller\Action 'html' => $this->_getPaymentMethodsHtml() ); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_objectManager->get('Magento\Checkout\Helper\Data')->sendPaymentFailedEmail( $this->getOnepage()->getQuote(), $e->getMessage() @@ -600,7 +599,7 @@ class Onepage extends \Magento\Checkout\Controller\Action $this->getOnepage()->getCheckout()->setUpdateSection(null); } } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_objectManager->get('Magento\Checkout\Helper\Data')->sendPaymentFailedEmail( $this->getOnepage()->getQuote(), $e->getMessage() diff --git a/app/code/Magento/Checkout/Model/Resource/Agreement.php b/app/code/Magento/Checkout/Model/Resource/Agreement.php index c07af1c44b2d16c622d0a60610fb9f867a34a0a1..e7d001da6105172f5e8c8943804a6311bf9911c3 100644 --- a/app/code/Magento/Checkout/Model/Resource/Agreement.php +++ b/app/code/Magento/Checkout/Model/Resource/Agreement.php @@ -37,25 +37,19 @@ namespace Magento\Checkout\Model\Resource; class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb { /** - * Checkout data - * - * @var \Magento\Checkout\Helper\Data + * @var \Magento\Filter\FilterManager */ - protected $_checkoutData = null; + protected $filterManager; /** - * Class constructor - * - * - * - * @param \Magento\Checkout\Helper\Data $checkoutData - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Filter\FilterManager $filterManager + * @param \Magento\App\Resource $resource */ public function __construct( - \Magento\Checkout\Helper\Data $checkoutData, - \Magento\Core\Model\Resource $resource + \Magento\Filter\FilterManager $filterManager, + \Magento\App\Resource $resource ) { - $this->_checkoutData = $checkoutData; + $this->filterManager = $filterManager; parent::__construct($resource); } @@ -78,7 +72,7 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb { // format height $height = $object->getContentHeight(); - $height = $this->_checkoutData->stripTags($height); + $height = $this->filterManager->stripTags($height); if (!$height) { $height = ''; } diff --git a/app/code/Magento/Checkout/Model/Resource/Setup.php b/app/code/Magento/Checkout/Model/Resource/Setup.php index 4cdca96d3152e6574d8c7cb1ed478a5e5c115a6f..1af9e5dd1f1f3dc91e43e8c57cc5cf7c83ebd8be 100644 --- a/app/code/Magento/Checkout/Model/Resource/Setup.php +++ b/app/code/Magento/Checkout/Model/Resource/Setup.php @@ -43,7 +43,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup /** * @param \Magento\Core\Model\Resource\Setup\Context $context - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory * @param \Magento\Customer\Helper\Address $customerAddress * @param string $resourceName @@ -52,7 +52,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup */ public function __construct( \Magento\Core\Model\Resource\Setup\Context $context, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, \Magento\Customer\Helper\Address $customerAddress, $resourceName, diff --git a/app/code/Magento/Checkout/Model/Session.php b/app/code/Magento/Checkout/Model/Session.php index 4aa73f1edd77697dea58d74654b9c7c13289fd74..de136ca5222da903f1590265cb23cf03c0ff61dc 100644 --- a/app/code/Magento/Checkout/Model/Session.php +++ b/app/code/Magento/Checkout/Model/Session.php @@ -89,6 +89,11 @@ class Session extends \Magento\Core\Model\Session\AbstractSession */ protected $_request; + /** + * @var \Magento\HTTP\PhpEnvironment\RemoteAddress + */ + protected $_remoteAddress; + /** * @param \Magento\Core\Model\Session\Context $context * @param \Magento\Sales\Model\OrderFactory $orderFactory @@ -96,6 +101,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Core\Model\Message\CollectionFactory $messageCollFactory * @param \Magento\Sales\Model\QuoteFactory $quoteFactory + * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress * @param null $sessionName * @param array $data */ @@ -106,6 +112,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession \Magento\Customer\Model\Session $customerSession, \Magento\Core\Model\Message\CollectionFactory $messageCollFactory, \Magento\Sales\Model\QuoteFactory $quoteFactory, + \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress, $sessionName = null, array $data = array() ) { @@ -114,6 +121,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession $this->_customerSession = $customerSession; $this->_messageCollFactory = $messageCollFactory; $this->_quoteFactory = $quoteFactory; + $this->_remoteAddress = $remoteAddress; parent::__construct($context, $data); $this->init('checkout', $sessionName); } @@ -222,7 +230,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession $this->_quote = $quote; } - if ($remoteAddr = $this->_coreHttp->getRemoteAddr()) { + if ($remoteAddr = $this->_remoteAddress->getRemoteAddress()) { $this->_quote->setRemoteIp($remoteAddr); $xForwardIp = $this->_request->getServer('HTTP_X_FORWARDED_FOR'); $this->_quote->setXForwardedFor($xForwardIp); diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php index 4258599363db9221d22bef55aef4cf763ca596bd..0384042495e42e636d8e62946720e319903d97fc 100644 --- a/app/code/Magento/Checkout/Model/Type/Onepage.php +++ b/app/code/Magento/Checkout/Model/Type/Onepage.php @@ -66,7 +66,7 @@ class Onepage protected $_helper; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -131,7 +131,7 @@ class Onepage * @param \Magento\Checkout\Helper\Data $helper * @param \Magento\Customer\Helper\Data $customerData * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -147,7 +147,7 @@ class Onepage \Magento\Checkout\Helper\Data $helper, \Magento\Customer\Helper\Data $customerData, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\Session $customerSession, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Checkout/etc/adminhtml/menu.xml b/app/code/Magento/Checkout/etc/adminhtml/menu.xml index 33f7cbc0ec8256b942197780cafdca9af39da213..fabe4fb08a1ab35098819242d865b2ef4ea34842 100644 --- a/app/code/Magento/Checkout/etc/adminhtml/menu.xml +++ b/app/code/Magento/Checkout/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_Checkout::sales_checkoutagreement" title="Terms and Conditions" module="Magento_Checkout" sortOrder="30" parent="Magento_Adminhtml::stores_settings" action="adminhtml/checkout_agreement/" resource="Magento_Checkout::checkoutagreement"/> + <add id="Magento_Checkout::sales_checkoutagreement" title="Terms and Conditions" module="Magento_Checkout" sortOrder="30" parent="Magento_Adminhtml::stores_settings" action="checkout/agreement/" resource="Magento_Checkout::checkoutagreement"/> </menu> </config> diff --git a/app/code/Magento/Checkout/etc/adminhtml/routes.xml b/app/code/Magento/Checkout/etc/adminhtml/routes.xml new file mode 100644 index 0000000000000000000000000000000000000000..43113893ea2708d44d70210a03cbdf4775e4394c --- /dev/null +++ b/app/code/Magento/Checkout/etc/adminhtml/routes.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <router id="admin"> + <route id="checkout" frontName="checkout"> + <module name="Magento_Checkout_Adminhtml" before="Magento_Adminhtml" /> + </route> + </router> +</config> diff --git a/app/code/Magento/Checkout/etc/di.xml b/app/code/Magento/Checkout/etc/di.xml index cd103944fe67b270b56ca2e273e1458570e36794..023a7768da491a993b3c36dc380ba6c00bf6c705 100644 --- a/app/code/Magento/Checkout/etc/di.xml +++ b/app/code/Magento/Checkout/etc/di.xml @@ -24,7 +24,7 @@ */ --> <config> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <checkout_setup>Magento\Checkout\Model\Resource\Setup</checkout_setup> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_paymentmethod.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_paymentmethod.xml index 08648cb20f1889ddc9b186542c7fff76a8807fce..8a9230c4df9fa72318ea34a31a29d766fab5499e 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_paymentmethod.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_paymentmethod.xml @@ -24,12 +24,10 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="One Page Checkout Choose Payment Method" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Checkout\Block\Onepage\Payment\Methods" name="payment_method" template="onepage/payment/methods.phtml"> - <action method="setMethodFormTemplate"> - <argument name="method" xsi:type="string">purchaseorder</argument> - <argument name="template" xsi:type="string">Magento_Payment::form/purchaseorder.phtml</argument> - </action> - </block> + <block class="Magento\Checkout\Block\Onepage\Payment\Methods" name="payment_method" output="1" template="onepage/payment/methods.phtml"> + <action method="setMethodFormTemplate"> + <argument name="method" xsi:type="string">purchaseorder</argument> + <argument name="template" xsi:type="string">Magento_Payment::form/purchaseorder.phtml</argument> + </action> </block> </layout> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review.xml index 27d4d6e5ab78a23c2584c0cee672a0c72db3538f..1db04c0ed12211f85e0954271b81127348a0e383 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review.xml @@ -24,16 +24,14 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="One Page Checkout Overview" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Checkout\Block\Onepage\Review\Info" name="order_review" template="onepage/review/info.phtml"> - <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="onepage/review/item.phtml"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="onepage/review/item.phtml"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="onepage/review/item.phtml"/> - <block class="Magento\Checkout\Block\Cart\Totals" name="checkout.onepage.review.info.totals" as="totals" template="onepage/review/totals.phtml"/> - <container name="checkout.onepage.review.info.items.before" as="items_before" label="Items Before"/> - <container name="checkout.onepage.review.info.items.after" as="items_after" label="Items After"/> - <block class="Magento\Checkout\Block\Agreements" name="checkout.onepage.agreements" as="agreements" template="onepage/agreements.phtml"/> - <block class="Magento\Core\Block\Template" name="checkout.onepage.review.button" as="button" template="Magento_Checkout::onepage/review/button.phtml"/> - </block> + <block class="Magento\Checkout\Block\Onepage\Review\Info" name="order_review" output="1" template="onepage/review/info.phtml"> + <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="onepage/review/item.phtml"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="onepage/review/item.phtml"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="onepage/review/item.phtml"/> + <block class="Magento\Checkout\Block\Cart\Totals" name="checkout.onepage.review.info.totals" as="totals" template="onepage/review/totals.phtml"/> + <container name="checkout.onepage.review.info.items.before" as="items_before" label="Items Before"/> + <container name="checkout.onepage.review.info.items.after" as="items_after" label="Items After"/> + <block class="Magento\Checkout\Block\Agreements" name="checkout.onepage.agreements" as="agreements" template="onepage/agreements.phtml"/> + <block class="Magento\Core\Block\Template" name="checkout.onepage.review.button" as="button" template="Magento_Checkout::onepage/review/button.phtml"/> </block> </layout> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_shippingmethod.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_shippingmethod.xml index 6e27ca6cc787606e3763c28f159a61eb00916482..d00f291336fca2a64817352dea95bf1f8191d4b2 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_shippingmethod.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_shippingmethod.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="One Page Checkout Choose Shipping Method" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Checkout\Block\Onepage\Shipping\Method\Available" name="shipping_method" template="onepage/shipping_method/available.phtml"/> - </block> + <block class="Magento\Checkout\Block\Onepage\Shipping\Method\Available" name="shipping_method" output="1" template="onepage/shipping_method/available.phtml"/> </layout> diff --git a/app/code/Magento/Adminhtml/Block/Cms/Block.php b/app/code/Magento/Cms/Block/Adminhtml/Block.php similarity index 87% rename from app/code/Magento/Adminhtml/Block/Cms/Block.php rename to app/code/Magento/Cms/Block/Adminhtml/Block.php index ece9d90354603e80c2cbd920ff3b22295fc8b95e..7710c16dabd77982f0ef3b4e2d0371ef09e3bc74 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Block.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Block.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,17 +28,18 @@ * Adminhtml cms blocks content block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms; +namespace Magento\Cms\Block\Adminhtml; class Block extends \Magento\Adminhtml\Block\Widget\Grid\Container { protected function _construct() { - $this->_controller = 'cms_block'; + $this->_blockGroup = 'Magento_Cms'; + $this->_controller = 'adminhtml_block'; $this->_headerText = __('Static Blocks'); $this->_addButtonLabel = __('Add New Block'); parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/Cms/Block/Edit.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Cms/Block/Edit.php rename to app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php index 28cf4890fdff560d459d92752bc2585493813abd..231df64e1a17b79984828114197097dcd017bc9b 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Block/Edit.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * CMS block edit form container * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Block; +namespace Magento\Cms\Block\Adminhtml\Block; class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -61,7 +61,8 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container protected function _construct() { $this->_objectId = 'block_id'; - $this->_controller = 'cms_block'; + $this->_blockGroup = 'Magento_Cms'; + $this->_controller = 'adminhtml_block'; parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/Cms/Block/Edit/Form.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Cms/Block/Edit/Form.php rename to app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php index 0a2a8e565ab3c8cd8c880bb0cf262052ea9cb915..22a28803c44bdc8c4012ceab73c975d91f39ba89 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Block/Edit/Form.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Adminhtml cms block edit form * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Block\Edit; +namespace Magento\Cms\Block\Adminhtml\Block\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { @@ -50,7 +50,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -59,7 +59,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, \Magento\Core\Model\System\Store $systemStore, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/Cms/Block/Widget/Chooser.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/Cms/Block/Widget/Chooser.php rename to app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php index f2e13864c8ea8a36598cf8b55f0a53ca79798270..d4402ced6f40b996342bc0c0b356fc8a1279a06a 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Block/Widget/Chooser.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * CMS block chooser for Wysiwyg CMS widget * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Block\Widget; +namespace Magento\Cms\Block\Adminhtml\Block\Widget; class Chooser extends \Magento\Adminhtml\Block\Widget\Grid { @@ -88,8 +88,8 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid */ public function prepareElementHtml(\Magento\Data\Form\Element\AbstractElement $element) { - $uniqId = $this->_coreData->uniqHash($element->getId()); - $sourceUrl = $this->getUrl('adminhtml/cms_block_widget/chooser', array('uniq_id' => $uniqId)); + $uniqId = $this->mathRandom->getUniqueHash($element->getId()); + $sourceUrl = $this->getUrl('cms/block_widget/chooser', array('uniq_id' => $uniqId)); $chooser = $this->getLayout()->createBlock('Magento\Widget\Block\Adminhtml\Widget\Chooser') ->setElement($element) @@ -184,6 +184,6 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid public function getGridUrl() { - return $this->getUrl('adminhtml/cms_block_widget/chooser', array('_current' => true)); + return $this->getUrl('cms/block_widget/chooser', array('_current' => true)); } } diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page.php b/app/code/Magento/Cms/Block/Adminhtml/Page.php similarity index 90% rename from app/code/Magento/Adminhtml/Block/Cms/Page.php rename to app/code/Magento/Cms/Block/Adminhtml/Page.php index cffbd576f864433a05f3bd139cd921a3cba1016d..9b18263f7fa19f3615f9120fd84386727c08a383 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,20 +29,20 @@ * Adminhtml cms pages content block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms; +namespace Magento\Cms\Block\Adminhtml; class Page extends \Magento\Adminhtml\Block\Widget\Grid\Container { - /** * Block constructor */ protected function _construct() { - $this->_controller = 'cms_page'; + $this->_controller = 'adminhtml_page'; + $this->_blockGroup = 'Magento_Cms'; $this->_headerText = __('Manage Pages'); parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Cms/Page/Edit.php rename to app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php index 2c0ad037b43359f1e70e3a6b7b06b122a6eec7e7..d3c42da2cd8f7b2b575591a73471737295a6b3c7 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Admin CMS page * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Page; +namespace Magento\Cms\Block\Adminhtml\Page; class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -66,7 +66,8 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container protected function _construct() { $this->_objectId = 'page_id'; - $this->_controller = 'cms_page'; + $this->_blockGroup = 'Magento_Cms'; + $this->_controller = 'adminhtml_page'; parent::_construct(); @@ -126,7 +127,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container */ protected function _getSaveAndContinueUrl() { - return $this->getUrl('adminhtml/*/save', array( + return $this->getUrl('cms/*/save', array( '_current' => true, 'back' => 'edit', 'active_tab' => '{{tab_id}}' diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Form.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Form.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Form.php rename to app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Form.php index 323e93bdbea94452844c8ec973d16dd04cfac51e..c12d78114687a67c7254330579ccce3666761abb 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Form.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Form.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Adminhtml cms page edit form block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Page\Edit; +namespace Magento\Cms\Block\Adminhtml\Page\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php rename to app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php index 0bbda0d7ad05b51e286d323889336fb1646b7a63..760268aca13407f780625f3a09e0c8680880158f 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Content.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +27,7 @@ /** * Cms page edit form main tab */ -namespace Magento\Adminhtml\Block\Cms\Page\Edit\Tab; +namespace Magento\Cms\Block\Adminhtml\Page\Edit\Tab; class Content extends \Magento\Backend\Block\Widget\Form\Generic @@ -41,7 +41,7 @@ class Content /** * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\Registry $coreRegistry @@ -50,7 +50,7 @@ class Content public function __construct( \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, \Magento\Backend\Block\Template\Context $context, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\Registry $coreRegistry, @@ -114,7 +114,7 @@ class Content // Setting custom renderer for content field to remove label column $renderer = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset\Element') - ->setTemplate('cms/page/edit/form/renderer/content.phtml'); + ->setTemplate('Magento_Cms::page/edit/form/renderer/content.phtml'); $contentField->setRenderer($renderer); $this->_eventManager->dispatch('adminhtml_cms_page_edit_tab_content_prepare_form', array('form' => $form)); diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php rename to app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php index 435c43bb4e887f3ebf318607ac576f275dbd1ce0..0119a603a67c21c8c6c4d76bb51a19ac8167f5fc 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php @@ -19,11 +19,11 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Cms\Page\Edit\Tab; +namespace Magento\Cms\Block\Adminhtml\Page\Edit\Tab; /** * @SuppressWarnings(PHPMD.DepthOfInheritance) @@ -46,7 +46,7 @@ class Design * @param \Magento\Page\Model\Source\Layout $pageLayout * @param \Magento\Core\Model\Theme\LabelFactory $labelFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -55,7 +55,7 @@ class Design \Magento\Page\Model\Source\Layout $pageLayout, \Magento\Core\Model\Theme\LabelFactory $labelFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -77,7 +77,7 @@ class Design /** * Initialise form fields * - * @return \Magento\Adminhtml\Block\Cms\Page\Edit\Tab\Design + * @return \Magento\Cms\Block\Adminhtml\Page\Edit\Tab\Design */ protected function _prepareForm() { diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php rename to app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php index 086e4ed98768b567945987dc87a11f6b12246ea6..3cedb1c24eb94326cd72af72a1b50301b0f5efa5 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +27,7 @@ /** * Cms page edit form main tab */ -namespace Magento\Adminhtml\Block\Cms\Page\Edit\Tab; +namespace Magento\Cms\Block\Adminhtml\Page\Edit\Tab; class Main extends \Magento\Backend\Block\Widget\Form\Generic @@ -41,7 +41,7 @@ class Main /** * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -49,7 +49,7 @@ class Main public function __construct( \Magento\Core\Model\System\Store $systemStore, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Meta.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php rename to app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Meta.php index b7b83daa810a4b4af24ed0d0d0efe93300190465..5942f65fcf5bc7837dddc2dd501d2d4d9dd4d610 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Meta.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Customer account form block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Page\Edit\Tab; +namespace Magento\Cms\Block\Adminhtml\Page\Edit\Tab; class Meta extends \Magento\Backend\Block\Widget\Form\Generic diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tabs.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tabs.php rename to app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php index effbb9633f91229ec6ed1c7b009cff834068ab7d..178be6c91322722a3486cd9939aa2d86bf9e2368 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tabs.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tabs.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Admin page left menu * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Page\Edit; +namespace Magento\Cms\Block\Adminhtml\Page\Edit; class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs { diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page/Grid.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/Cms/Page/Grid.php rename to app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php index ee26de4e3e1f31220495938efa8a7c5cfa99bc73..48d4298126d029de38fe0c7c5a7cc7f2ea7b6717 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page/Grid.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml cms pages grid * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Page; +namespace Magento\Cms\Block\Adminhtml\Page; class Grid extends \Magento\Adminhtml\Block\Widget\Grid { @@ -157,7 +157,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid 'width' => 10, 'sortable' => false, 'filter' => false, - 'renderer' => 'Magento\Adminhtml\Block\Cms\Page\Grid\Renderer\Action', + 'renderer' => 'Magento\Cms\Block\Adminhtml\Page\Grid\Renderer\Action', )); return parent::_prepareColumns(); @@ -185,6 +185,6 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid */ public function getRowUrl($row) { - return $this->getUrl('adminhtml/*/edit', array('page_id' => $row->getId())); + return $this->getUrl('*/*/edit', array('page_id' => $row->getId())); } } diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php rename to app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php index b681f38532c3c49ee7a6a53b43d8a23ffa01265f..eed40c878d1b5534689d432d336e722fc303a7d1 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Grid/Renderer/Action.php @@ -19,12 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Cms\Page\Grid\Renderer; +namespace Magento\Cms\Block\Adminhtml\Page\Grid\Renderer; class Action extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer diff --git a/app/code/Magento/Adminhtml/Block/Cms/Page/Widget/Chooser.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Cms/Page/Widget/Chooser.php rename to app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php index 125c99d4849d9d3aaf5256e2552af0563740a820..fac8309d3bcf05d3325960a642230a524a5be406 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Page/Widget/Chooser.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * CMS page chooser for Wysiwyg CMS widget * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Page\Widget; +namespace Magento\Cms\Block\Adminhtml\Page\Widget; class Chooser extends \Magento\Adminhtml\Block\Widget\Grid { @@ -103,8 +103,8 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid */ public function prepareElementHtml(\Magento\Data\Form\Element\AbstractElement $element) { - $uniqId = $this->_coreData->uniqHash($element->getId()); - $sourceUrl = $this->getUrl('adminhtml/cms_page_widget/chooser', array('uniq_id' => $uniqId)); + $uniqId = $this->mathRandom->getUniqueHash($element->getId()); + $sourceUrl = $this->getUrl('cms/page_widget/chooser', array('uniq_id' => $uniqId)); $chooser = $this->getLayout()->createBlock('Magento\Widget\Block\Adminhtml\Widget\Chooser') ->setElement($element) @@ -212,6 +212,6 @@ class Chooser extends \Magento\Adminhtml\Block\Widget\Grid public function getGridUrl() { - return $this->getUrl('adminhtml/cms_page_widget/chooser', array('_current' => true)); + return $this->getUrl('cms/page_widget/chooser', array('_current' => true)); } } diff --git a/app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php similarity index 89% rename from app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content.php rename to app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php index acbb6a4b772c4a41466cff9fe4cdf363ac3b1d27..99c4d820ee543de95dfaf5f25f7bf201e3ed8703 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Wysiwyg Images content block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Wysiwyg\Images; +namespace Magento\Cms\Block\Adminhtml\Wysiwyg\Images; class Content extends \Magento\Adminhtml\Block\Widget\Container { @@ -75,7 +75,7 @@ class Content extends \Magento\Adminhtml\Block\Widget\Container */ public function getContentsUrl() { - return $this->getUrl('adminhtml/*/contents', array('type' => $this->getRequest()->getParam('type'))); + return $this->getUrl('cms/*/contents', array('type' => $this->getRequest()->getParam('type'))); } /** @@ -111,7 +111,7 @@ class Content extends \Magento\Adminhtml\Block\Widget\Container */ public function getNewfolderUrl() { - return $this->getUrl('adminhtml/*/newFolder'); + return $this->getUrl('cms/*/newFolder'); } /** @@ -121,7 +121,7 @@ class Content extends \Magento\Adminhtml\Block\Widget\Container */ protected function getDeletefolderUrl() { - return $this->getUrl('adminhtml/*/deleteFolder'); + return $this->getUrl('cms/*/deleteFolder'); } /** @@ -132,7 +132,7 @@ class Content extends \Magento\Adminhtml\Block\Widget\Container */ public function getDeleteFilesUrl() { - return $this->getUrl('adminhtml/*/deleteFiles'); + return $this->getUrl('cms/*/deleteFiles'); } /** @@ -142,7 +142,7 @@ class Content extends \Magento\Adminhtml\Block\Widget\Container */ public function getOnInsertUrl() { - return $this->getUrl('adminhtml/*/onInsert'); + return $this->getUrl('cms/*/onInsert'); } /** diff --git a/app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Files.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php rename to app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Files.php index c5b6bb17ddfd1bfc3a1090eb29f2710e21d95225..10fea8eea10b51efbadb29cc70f8e376223ab41c 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Files.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Directory contents block for Wysiwyg Images * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Content; +namespace Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content; class Files extends \Magento\Adminhtml\Block\Template { diff --git a/app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Newfolder.php similarity index 89% rename from app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php rename to app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Newfolder.php index b41192e71168482e59a6194bc5b1fcc7a6c2c6d1..2240478bf1c7e1bc79d4323e79211cbf0fd761bf 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Newfolder.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * New directory block for Wysiwyg Images * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Content; +namespace Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content; class Newfolder extends \Magento\Adminhtml\Block\Template { diff --git a/app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Uploader.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php rename to app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Uploader.php index 87e51428d38c377a59ce478e12831551ec7d4f7e..c2462939da24daa6e632b7b19b73b252b24753cd 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Uploader.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Uploader block for Wysiwyg Images * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Content; +namespace Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content; class Uploader extends \Magento\Adminhtml\Block\Media\Uploader { @@ -72,7 +72,7 @@ class Uploader extends \Magento\Adminhtml\Block\Media\Uploader $files[] = '*.' . $ext; } $this->getConfig() - ->setUrl($this->_urlBuilder->addSessionParam()->getUrl('adminhtml/*/upload', array('type' => $type))) + ->setUrl($this->_urlBuilder->addSessionParam()->getUrl('cms/*/upload', array('type' => $type))) ->setFileField('image') ->setFilters(array( 'images' => array( diff --git a/app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php rename to app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php index 78defe801e72e9e7396856f319338400f6698d58..bca6fda28698ba611b778d273aa46376ff000bfa 100644 --- a/app/code/Magento/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Directory tree renderer for Cms Wysiwyg Images * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Cms\Wysiwyg\Images; +namespace Magento\Cms\Block\Adminhtml\Wysiwyg\Images; class Tree extends \Magento\Adminhtml\Block\Template { @@ -97,7 +97,7 @@ class Tree extends \Magento\Adminhtml\Block\Template */ public function getTreeLoaderUrl() { - return $this->getUrl('adminhtml/*/treeJson'); + return $this->getUrl('cms/*/treeJson'); } /** diff --git a/app/code/Magento/Adminhtml/Controller/Cms/Block.php b/app/code/Magento/Cms/Controller/Adminhtml/Block.php similarity index 89% rename from app/code/Magento/Adminhtml/Controller/Cms/Block.php rename to app/code/Magento/Cms/Controller/Adminhtml/Block.php index e33189ae35e914e9a53b7a2d827cacf5ba1b2231..1c01373f4c5bd218f8cafa8250a8a09b31ce53f1 100644 --- a/app/code/Magento/Adminhtml/Controller/Cms/Block.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Block.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Cms manage blocks controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Cms; +namespace Magento\Cms\Controller\Adminhtml; class Block extends \Magento\Backend\Controller\Adminhtml\Action { @@ -58,7 +58,7 @@ class Block extends \Magento\Backend\Controller\Adminhtml\Action /** * Init actions * - * @return \Magento\Adminhtml\Controller\Cms\Block + * @return \Magento\Cms\Controller\Adminhtml\Block */ protected function _initAction() { @@ -106,7 +106,7 @@ class Block extends \Magento\Backend\Controller\Adminhtml\Action $model->load($id); if (! $model->getId()) { $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('This block no longer exists.')); - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); return; } } @@ -140,7 +140,7 @@ class Block extends \Magento\Backend\Controller\Adminhtml\Action $model = $this->_objectManager->create('Magento\Cms\Model\Block')->load($id); if (!$model->getId() && $id) { $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('This block no longer exists.')); - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); return; } @@ -159,11 +159,11 @@ class Block extends \Magento\Backend\Controller\Adminhtml\Action // check if 'Save and Continue' if ($this->getRequest()->getParam('back')) { - $this->_redirect('adminhtml/*/edit', array('block_id' => $model->getId())); + $this->_redirect('*/*/edit', array('block_id' => $model->getId())); return; } // go to grid - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); return; } catch (\Exception $e) { @@ -172,11 +172,11 @@ class Block extends \Magento\Backend\Controller\Adminhtml\Action // save data in session $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setFormData($data); // redirect to edit form - $this->_redirect('adminhtml/*/edit', array('block_id' => $this->getRequest()->getParam('block_id'))); + $this->_redirect('*/*/edit', array('block_id' => $this->getRequest()->getParam('block_id'))); return; } } - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); } /** @@ -195,20 +195,20 @@ class Block extends \Magento\Backend\Controller\Adminhtml\Action // display success message $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The block has been deleted.')); // go to grid - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); return; } catch (\Exception $e) { // display error message $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); // go back to edit form - $this->_redirect('adminhtml/*/edit', array('block_id' => $id)); + $this->_redirect('*/*/edit', array('block_id' => $id)); return; } } // display error message $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('We can\'t find a block to delete.')); // go to grid - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); } /** diff --git a/app/code/Magento/Adminhtml/Controller/Cms/Block/Widget.php b/app/code/Magento/Cms/Controller/Adminhtml/Block/Widget.php similarity index 85% rename from app/code/Magento/Adminhtml/Controller/Cms/Block/Widget.php rename to app/code/Magento/Cms/Controller/Adminhtml/Block/Widget.php index ef35401ebd9ab8b822e818786354f3e1e2ccdbd7..83e42be7a0fe544088657f1b6882bd7522f9cc91 100644 --- a/app/code/Magento/Adminhtml/Controller/Cms/Block/Widget.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Block/Widget.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Controller for CMS Block Widget plugin * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Cms\Block; +namespace Magento\Cms\Controller\Adminhtml\Block; class Widget extends \Magento\Backend\Controller\Adminhtml\Action { @@ -42,7 +42,7 @@ class Widget extends \Magento\Backend\Controller\Adminhtml\Action public function chooserAction() { $uniqId = $this->getRequest()->getParam('uniq_id'); - $pagesGrid = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Cms\Block\Widget\Chooser', '', array( + $pagesGrid = $this->getLayout()->createBlock('Magento\Cms\Block\Adminhtml\Block\Widget\Chooser', '', array( 'data' => array('id' => $uniqId) )); $this->getResponse()->setBody($pagesGrid->toHtml()); diff --git a/app/code/Magento/Adminhtml/Controller/Cms/Page.php b/app/code/Magento/Cms/Controller/Adminhtml/Page.php similarity index 91% rename from app/code/Magento/Adminhtml/Controller/Cms/Page.php rename to app/code/Magento/Cms/Controller/Adminhtml/Page.php index 2fa76351d34bce8e3731333e1d605eee9a55cbf2..0427e9e664dabddb9b9532e534ccc7074f6795d6 100644 --- a/app/code/Magento/Adminhtml/Controller/Cms/Page.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Page.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -32,7 +32,7 @@ * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Cms; +namespace Magento\Cms\Controller\Adminhtml; class Page extends \Magento\Backend\Controller\Adminhtml\Action { @@ -58,7 +58,7 @@ class Page extends \Magento\Backend\Controller\Adminhtml\Action /** * Init actions * - * @return \Magento\Adminhtml\Controller\Cms\Page + * @return \Magento\Cms\Controller\Adminhtml\Page */ protected function _initAction() { @@ -108,7 +108,7 @@ class Page extends \Magento\Backend\Controller\Adminhtml\Action if (! $model->getId()) { $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( __('This page no longer exists.')); - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); return; } } @@ -157,7 +157,7 @@ class Page extends \Magento\Backend\Controller\Adminhtml\Action //validating if (!$this->_validatePostData($data)) { - $this->_redirect('adminhtml/*/edit', array('page_id' => $model->getId(), '_current' => true)); + $this->_redirect('*/*/edit', array('page_id' => $model->getId(), '_current' => true)); return; } @@ -173,11 +173,11 @@ class Page extends \Magento\Backend\Controller\Adminhtml\Action $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setFormData(false); // check if 'Save and Continue' if ($this->getRequest()->getParam('back')) { - $this->_redirect('adminhtml/*/edit', array('page_id' => $model->getId(), '_current'=>true)); + $this->_redirect('*/*/edit', array('page_id' => $model->getId(), '_current'=>true)); return; } // go to grid - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); return; } catch (\Magento\Core\Exception $e) { @@ -188,10 +188,10 @@ class Page extends \Magento\Backend\Controller\Adminhtml\Action } $this->_getSession()->setFormData($data); - $this->_redirect('adminhtml/*/edit', array('page_id' => $this->getRequest()->getParam('page_id'))); + $this->_redirect('*/*/edit', array('page_id' => $this->getRequest()->getParam('page_id'))); return; } - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); } /** @@ -214,7 +214,7 @@ class Page extends \Magento\Backend\Controller\Adminhtml\Action __('The page has been deleted.')); // go to grid $this->_eventManager->dispatch('adminhtml_cmspage_on_delete', array('title' => $title, 'status' => 'success')); - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); return; } catch (\Exception $e) { @@ -222,14 +222,14 @@ class Page extends \Magento\Backend\Controller\Adminhtml\Action // display error message $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); // go back to edit form - $this->_redirect('adminhtml/*/edit', array('page_id' => $id)); + $this->_redirect('*/*/edit', array('page_id' => $id)); return; } } // display error message $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('We can\'t find a page to delete.')); // go to grid - $this->_redirect('adminhtml/*/'); + $this->_redirect('*/*/'); } /** diff --git a/app/code/Magento/Adminhtml/Controller/Cms/Page/Widget.php b/app/code/Magento/Cms/Controller/Adminhtml/Page/Widget.php similarity index 86% rename from app/code/Magento/Adminhtml/Controller/Cms/Page/Widget.php rename to app/code/Magento/Cms/Controller/Adminhtml/Page/Widget.php index a92e8ccfbde378689a3c1f5674ad4c2f294afa46..70a04863dbc2cdac3823172254426f3913d96b6c 100644 --- a/app/code/Magento/Adminhtml/Controller/Cms/Page/Widget.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Page/Widget.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Controller for CMS Page Link Widget plugin * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Cms\Page; +namespace Magento\Cms\Controller\Adminhtml\Page; class Widget extends \Magento\Backend\Controller\Adminhtml\Action { @@ -42,7 +42,7 @@ class Widget extends \Magento\Backend\Controller\Adminhtml\Action public function chooserAction() { $uniqId = $this->getRequest()->getParam('uniq_id'); - $pagesGrid = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Cms\Page\Widget\Chooser', '', array( + $pagesGrid = $this->getLayout()->createBlock('Magento\Cms\Block\Adminhtml\Page\Widget\Chooser', '', array( 'data' => array('id' => $uniqId) )); $this->getResponse()->setBody($pagesGrid->toHtml()); diff --git a/app/code/Magento/Adminhtml/Controller/Cms/Wysiwyg.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg.php similarity index 91% rename from app/code/Magento/Adminhtml/Controller/Cms/Wysiwyg.php rename to app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg.php index 12404b583510fb9ac18271bab7c7f1d5112b7a79..34f89faad0101d76a97a06dac8e17649976945e6 100644 --- a/app/code/Magento/Adminhtml/Controller/Cms/Wysiwyg.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Wysiwyg controller for different purposes * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Cms; +namespace Magento\Cms\Controller\Adminhtml; class Wysiwyg extends \Magento\Backend\Controller\Adminhtml\Action { @@ -53,7 +53,7 @@ class Wysiwyg extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Exception $e) { $image->open($this->_objectManager->get('Magento\Cms\Model\Wysiwyg\Config')->getSkinImagePlaceholderUrl()); $response->setHeader('Content-Type', $image->getMimeType())->setBody($image->getImage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } } diff --git a/app/code/Magento/Adminhtml/Controller/Cms/Wysiwyg/Images.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php similarity index 96% rename from app/code/Magento/Adminhtml/Controller/Cms/Wysiwyg/Images.php rename to app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php index 5961f0f53a9a279f1d0a88a59684b51719462051..868c2dd6c2f708c0d369b5d2f9a36f296dfdb3f7 100644 --- a/app/code/Magento/Adminhtml/Controller/Cms/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Images manage controller for Cms WYSIWYG editor * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Cms\Wysiwyg; +namespace Magento\Cms\Controller\Adminhtml\Wysiwyg; class Images extends \Magento\Backend\Controller\Adminhtml\Action { @@ -57,7 +57,7 @@ class Images extends \Magento\Backend\Controller\Adminhtml\Action /** * Init storage * - * @return \Magento\Adminhtml\Controller\Cms\Wysiwyg\Images + * @return \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images */ protected function _initAction() { @@ -87,7 +87,7 @@ class Images extends \Magento\Backend\Controller\Adminhtml\Action try { $this->_initAction(); $this->getResponse()->setBody( - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Tree') + $this->getLayout()->createBlock('Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Tree') ->getTreeJson() ); } catch (\Exception $e) { @@ -233,7 +233,7 @@ class Images extends \Magento\Backend\Controller\Adminhtml\Action /** * Save current path in session * - * @return \Magento\Adminhtml\Controller\Cms\Wysiwyg\Images + * @return \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images */ protected function _saveSessionCurrentPath() { diff --git a/app/code/Magento/Cms/Controller/Router.php b/app/code/Magento/Cms/Controller/Router.php index 4dae02e646c556c893d919694d0f33b95b9cada9..84d9f2b199b41d4f222c25e80a3ddb9bc78af427 100644 --- a/app/code/Magento/Cms/Controller/Router.php +++ b/app/code/Magento/Cms/Controller/Router.php @@ -81,7 +81,7 @@ class Router extends \Magento\App\Router\AbstractRouter /** * Construct * - * @param \Magento\App\ActionFactory $controllerFactory + * @param \Magento\App\ActionFactory $actionFactory * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\UrlInterface $url * @param \Magento\App\State $appState @@ -90,7 +90,7 @@ class Router extends \Magento\App\Router\AbstractRouter * @param \Magento\App\ResponseInterface $response */ public function __construct( - \Magento\App\ActionFactory $controllerFactory, + \Magento\App\ActionFactory $actionFactory, \Magento\Event\ManagerInterface $eventManager, \Magento\UrlInterface $url, \Magento\App\State $appState, @@ -98,7 +98,7 @@ class Router extends \Magento\App\Router\AbstractRouter \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ResponseInterface $response ) { - parent::__construct($controllerFactory); + parent::__construct($actionFactory); $this->_eventManager = $eventManager; $this->_url = $url; $this->_appState = $appState; @@ -136,10 +136,9 @@ class Router extends \Magento\App\Router\AbstractRouter $identifier = $condition->getIdentifier(); if ($condition->getRedirectUrl()) { - $this->_response->setRedirect($condition->getRedirectUrl()) - ->sendResponse(); + $this->_response->setRedirect($condition->getRedirectUrl()); $request->setDispatched(true); - return $this->_controllerFactory->createController('Magento\App\Action\Redirect', + return $this->_actionFactory->createController('Magento\App\Action\Redirect', array('request' => $request) ); } @@ -164,7 +163,7 @@ class Router extends \Magento\App\Router\AbstractRouter $identifier ); - return $this->_controllerFactory->createController('Magento\App\Action\Forward', + return $this->_actionFactory->createController('Magento\App\Action\Forward', array('request' => $request) ); } diff --git a/app/code/Magento/Cms/Helper/Page.php b/app/code/Magento/Cms/Helper/Page.php index e539a22f2d34d500589db55517018c72425ecc38..1961a2d978e95c757b49db58c525e217388c348d 100644 --- a/app/code/Magento/Cms/Helper/Page.php +++ b/app/code/Magento/Cms/Helper/Page.php @@ -100,6 +100,13 @@ class Page extends \Magento\Core\Helper\AbstractHelper protected $_url; /** + * @var \Magento\Escaper + */ + protected $_escaper; + + /** + * Construct + * * @param \Magento\Core\Helper\Context $context * @param \Magento\Core\Model\Session\Pool $sessionFactory * @param \Magento\Cms\Model\Page $page @@ -110,6 +117,7 @@ class Page extends \Magento\Core\Helper\AbstractHelper * @param \Magento\Cms\Model\PageFactory $pageFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\Escaper $escaper */ public function __construct( \Magento\Core\Helper\Context $context, @@ -121,7 +129,8 @@ class Page extends \Magento\Core\Helper\AbstractHelper \Magento\UrlInterface $url, \Magento\Cms\Model\PageFactory $pageFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\LocaleInterface $locale + \Magento\Core\Model\LocaleInterface $locale, + \Magento\Escaper $escaper ) { $this->_sessionPool = $sessionFactory; // used singleton (instead factory) because there exist dependencies on \Magento\Cms\Helper\Page @@ -133,6 +142,7 @@ class Page extends \Magento\Core\Helper\AbstractHelper $this->_pageFactory = $pageFactory; $this->_storeManager = $storeManager; $this->_locale = $locale; + $this->_escaper = $escaper; parent::__construct($context); } @@ -210,7 +220,7 @@ class Page extends \Magento\Core\Helper\AbstractHelper $contentHeadingBlock = $action->getLayout()->getBlock('page_content_heading'); if ($contentHeadingBlock) { - $contentHeading = $this->escapeHtml($this->_page->getContentHeading()); + $contentHeading = $this->_escaper->escapeHtml($this->_page->getContentHeading()); $contentHeadingBlock->setContentHeading($contentHeading); } diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index 65f82ba9f5c80056a92766a6bce10e79a4a9e00d..8abb1516f9cfd69f765643a7f0086bbfbdf3068f 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -258,7 +258,7 @@ class Images extends \Magento\Core\Helper\AbstractHelper } else { $directive = $this->_coreData->urlEncode($directive); $html = $this->_backendData->getUrl( - '*/cms_wysiwyg/directive', + 'cms/wysiwyg/directive', array('___directive' => $directive) ); } diff --git a/app/code/Magento/Cms/Model/Resource/Block.php b/app/code/Magento/Cms/Model/Resource/Block.php index f148ef1e9faf9c1a93137faacc78d6b21b45df68..d15eb9f7910bc389e94bad457cece2e14668aba5 100644 --- a/app/code/Magento/Cms/Model/Resource/Block.php +++ b/app/code/Magento/Cms/Model/Resource/Block.php @@ -51,12 +51,12 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Date $date * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\Date $date, \Magento\Core\Model\StoreManagerInterface $storeManager ) { diff --git a/app/code/Magento/Cms/Model/Resource/Page.php b/app/code/Magento/Cms/Model/Resource/Page.php index 155893e8f53af6a5d85554e8f6083861d8dba83e..7226b38da31a7ee8e6ac6e4fd7c45f9e1c06d4c8 100644 --- a/app/code/Magento/Cms/Model/Resource/Page.php +++ b/app/code/Magento/Cms/Model/Resource/Page.php @@ -55,21 +55,29 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected $_storeManager; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Date $date * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\Date $date, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Stdlib\DateTime $dateTime ) { parent::__construct($resource); $this->_date = $date; $this->_storeManager = $storeManager; + $this->dateTime = $dateTime; } /** @@ -115,7 +123,7 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb */ foreach (array('custom_theme_from', 'custom_theme_to') as $field) { $value = !$object->getData($field) ? null : $object->getData($field); - $object->setData($field, $this->formatDate($value)); + $object->setData($field, $this->dateTime->formatDate($value)); } if (!$this->getIsUniquePageToStores($object)) { diff --git a/app/code/Magento/Cms/Model/Resource/Page/Collection.php b/app/code/Magento/Cms/Model/Resource/Page/Collection.php index a07fef4f2adb4d7583ae2535687c6b9d3aaf4ea7..e0b164fadc51f313489a6ce3b6ca947b763b35b2 100644 --- a/app/code/Magento/Cms/Model/Resource/Page/Collection.php +++ b/app/code/Magento/Cms/Model/Resource/Page/Collection.php @@ -55,7 +55,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -63,7 +63,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Config.php b/app/code/Magento/Cms/Model/Wysiwyg/Config.php index 4105a7246dd208c220ce78662084a4165fa48b3f..92c3eeb22b7907e66108c164e8d716093ad4c830 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Config.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Config.php @@ -160,7 +160,7 @@ class Config extends \Magento\Object 'no_display' => false, 'translator' => $this->_cmsData, 'encode_directives' => true, - 'directives_url' => $this->_backendUrl->getUrl('adminhtml/cms_wysiwyg/directive'), + 'directives_url' => $this->_backendUrl->getUrl('cms/wysiwyg/directive'), 'popup_css' => $viewUrl->getViewFileUrl('mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css'), 'content_css' => @@ -174,7 +174,7 @@ class Config extends \Magento\Object if ($this->_authorization->isAllowed('Magento_Cms::media_gallery')) { $config->addData(array( 'add_images' => true, - 'files_browser_window_url' => $this->_backendUrl->getUrl('adminhtml/cms_wysiwyg_images/index'), + 'files_browser_window_url' => $this->_backendUrl->getUrl('cms/wysiwyg_images/index'), 'files_browser_window_width' => $this->_windowSize['width'], 'files_browser_window_height'=> $this->_windowSize['height'], )); diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php index 35f29ec38e0f361a5465a5baae6bd509862a756b..4bb2ef5729529eb85dd0b6d1846b59cef2382904 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php @@ -303,7 +303,7 @@ class Storage extends \Magento\Object $thumbUrl = $this->getThumbnailUrl($item->getFilename(), true); // generate thumbnail "on the fly" if it does not exists if (!$thumbUrl) { - $thumbUrl = $this->_backendUrl->getUrl('adminhtml/*/thumbnail', array('file' => $item->getId())); + $thumbUrl = $this->_backendUrl->getUrl('cms/*/thumbnail', array('file' => $item->getId())); } $size = @getimagesize($item->getFilename()); diff --git a/app/code/Magento/Cms/etc/adminhtml/menu.xml b/app/code/Magento/Cms/etc/adminhtml/menu.xml index 29c0d578b162c681a0d689be80fea4868b352620..81982bc3066e8d296fb532950a5f62f85d032080 100644 --- a/app/code/Magento/Cms/etc/adminhtml/menu.xml +++ b/app/code/Magento/Cms/etc/adminhtml/menu.xml @@ -27,7 +27,7 @@ --> <config> <menu> - <add id="Magento_Cms::cms_page" title="Pages" module="Magento_Cms" sortOrder="0" parent="Magento_Adminhtml::content_elements" action="adminhtml/cms_page" resource="Magento_Cms::page"/> - <add id="Magento_Cms::cms_block" title="Blocks" module="Magento_Cms" sortOrder="30" parent="Magento_Adminhtml::content_elements" action="adminhtml/cms_block" resource="Magento_Cms::block"/> + <add id="Magento_Cms::cms_page" title="Pages" module="Magento_Cms" sortOrder="0" parent="Magento_Adminhtml::content_elements" action="cms/page" resource="Magento_Cms::page"/> + <add id="Magento_Cms::cms_block" title="Blocks" module="Magento_Cms" sortOrder="30" parent="Magento_Adminhtml::content_elements" action="cms/block" resource="Magento_Cms::block"/> </menu> </config> diff --git a/app/code/Magento/Cms/etc/adminhtml/routes.xml b/app/code/Magento/Cms/etc/adminhtml/routes.xml new file mode 100644 index 0000000000000000000000000000000000000000..0134d08bf472af0db3a3df5b4112689392a66a6c --- /dev/null +++ b/app/code/Magento/Cms/etc/adminhtml/routes.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <router id="admin"> + <route id="cms" frontName="cms"> + <module name="Magento_Cms_Adminhtml" before="Magento_Adminhtml" /> + </route> + </router> +</config> diff --git a/app/code/Magento/Cms/etc/di.xml b/app/code/Magento/Cms/etc/di.xml index f764b802e9ef0ee79adac13fd0c56356d5226a09..d95c689facabe7496397cd34c7e7d7da1c255979 100644 --- a/app/code/Magento/Cms/etc/di.xml +++ b/app/code/Magento/Cms/etc/di.xml @@ -24,17 +24,6 @@ */ --> <config> - <type name="Magento\App\RouterList"> - <param name="routerList"> - <value> - <cms> - <instance>Magento\Cms\Controller\Router</instance> - <disable type="bool">false</disable> - <sortOrder>60</sortOrder> - </cms> - </value> - </param> - </type> <type name="Magento\Cms\Model\Wysiwyg\Config"> <param name="windowSize"> <value> @@ -81,12 +70,7 @@ </value> </param> </type> - <type name="Magento\Core\Helper\Data"> - <param name="config"> - <instance type="Magento\Core\Model\ConfigProxy" /> - </param> - </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <cms_setup>Magento\Cms\Model\Resource\Setup</cms_setup> diff --git a/app/code/Magento/Cms/etc/frontend/di.xml b/app/code/Magento/Cms/etc/frontend/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..c9d16f9fb735b501ab3cdde7341524dab4965c4f --- /dev/null +++ b/app/code/Magento/Cms/etc/frontend/di.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <type name="Magento\App\RouterList"> + <param name="routerList"> + <value> + <cms> + <instance>Magento\Cms\Controller\Router</instance> + <disable type="bool">false</disable> + <sortOrder>60</sortOrder> + </cms> + </value> + </param> + </type> +</config> \ No newline at end of file diff --git a/app/code/Magento/Cms/etc/widget.xml b/app/code/Magento/Cms/etc/widget.xml index 9f2a5f1ff16ea0c94c6548d20b03bfe288838ee3..f5e7d70d006e4cedf882f76b1f1db93945baf221 100644 --- a/app/code/Magento/Cms/etc/widget.xml +++ b/app/code/Magento/Cms/etc/widget.xml @@ -32,7 +32,7 @@ <parameters> <parameter name="page_id" xsi:type="block" visible="true" required="true" sort_order="10"> <label translate="true">CMS Page</label> - <block class="Magento\Adminhtml\Block\Cms\Page\Widget\Chooser"> + <block class="Magento\Cms\Block\Adminhtml\Page\Widget\Chooser"> <data> <item name="button" xsi:type="array"> <item name="open" xsi:type="string">Select Page...</item> @@ -67,7 +67,7 @@ <parameters> <parameter name="block_id" xsi:type="block" visible="true" required="true" sort_order="20"> <label translate="true">Block</label> - <block class="Magento\Adminhtml\Block\Cms\Block\Widget\Chooser"> + <block class="Magento\Cms\Block\Adminhtml\Block\Widget\Chooser"> <data> <item name="button" xsi:type="array"> <item name="open" xsi:type="string">Select Block...</item> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/cms/browser/content.phtml b/app/code/Magento/Cms/view/adminhtml/browser/content.phtml similarity index 96% rename from app/code/Magento/Adminhtml/view/adminhtml/cms/browser/content.phtml rename to app/code/Magento/Cms/view/adminhtml/browser/content.phtml index bc23833802bc3accdbaa88ec282e908b3ace80d3..28096edfad7db8d191370bd952e47dba1b5341a8 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/cms/browser/content.phtml +++ b/app/code/Magento/Cms/view/adminhtml/browser/content.phtml @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ - /** @var $this \Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Content */ + /** @var $this \Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content */ ?> <div data-mage-init="{mediabrowser: <?php echo $this->escapeHtml($this->getFilebrowserSetupObject()); ?>}"> @@ -40,4 +40,4 @@ <div id="contents"></div> </div> <div style="float:left; width: 20%"><?php echo $this->getChildHtml('wysiwyg_images.tree') ?></div> -</div> \ No newline at end of file +</div> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/cms/browser/content/files.phtml b/app/code/Magento/Cms/view/adminhtml/browser/content/files.phtml similarity index 96% rename from app/code/Magento/Adminhtml/view/adminhtml/cms/browser/content/files.phtml rename to app/code/Magento/Cms/view/adminhtml/browser/content/files.phtml index f1f3578ca5d96aeddb2e17e57e9c775e921a3180..eb55ed53c2389c5867866eb53a9b5a9962abc588 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/cms/browser/content/files.phtml +++ b/app/code/Magento/Cms/view/adminhtml/browser/content/files.phtml @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ - /** @var $this \Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Content\Files */ + /** @var $this \Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content\Files */ $_width = $this->getImagesWidth(); $_height = $this->getImagesHeight(); diff --git a/app/code/Magento/Adminhtml/view/adminhtml/cms/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/browser/content/uploader.phtml similarity index 98% rename from app/code/Magento/Adminhtml/view/adminhtml/cms/browser/content/uploader.phtml rename to app/code/Magento/Cms/view/adminhtml/browser/content/uploader.phtml index e87883d9678a65e562ad9ee9d837f149ff63965c..80d0d63287f6ca40e2ec8f528c3e13d15e1dd727 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/cms/browser/content/uploader.phtml +++ b/app/code/Magento/Cms/view/adminhtml/browser/content/uploader.phtml @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -/** @var $this \Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Content\Uploader */ +/** @var $this \Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content\Uploader */ ?> <div id="<?php echo $this->getHtmlId() ?>" class="uploader"> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/cms/browser/tree.phtml b/app/code/Magento/Cms/view/adminhtml/browser/tree.phtml similarity index 96% rename from app/code/Magento/Adminhtml/view/adminhtml/cms/browser/tree.phtml rename to app/code/Magento/Cms/view/adminhtml/browser/tree.phtml index 5daf50863606aa35764e3cb40b52c236bb26a4fe..c6cd374aa8023472d063a9462cb5828821e8a756 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/cms/browser/tree.phtml +++ b/app/code/Magento/Cms/view/adminhtml/browser/tree.phtml @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ - /** @var \Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Tree $this */ + /** @var \Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Tree $this */ ?> <div class="tree-panel" > <div class="categories-side-col"> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_block_edit.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_block_edit.xml rename to app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml index e08b6735bf61d43f421f25b67349e338cb9b1494..96f6417ba0107218712d0743436624d916476935 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_block_edit.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml @@ -58,6 +58,6 @@ </block> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Cms\Block\Edit" name="cms_block_edit"/> + <block class="Magento\Cms\Block\Adminhtml\Block\Edit" name="cms_block_edit"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_block_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml similarity index 98% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_block_index.xml rename to app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml index 265c1599966791219443707685afcdd9acafa959..55a837448cd5e9a8db398a51714cebd2860c0e8d 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_block_index.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Cms\Block" name="cms_block"> + <block class="Magento\Cms\Block\Adminhtml\Block" name="cms_block"> <block class="Magento\Backend\Block\Widget\Grid" name="adminhtml.cms.block.grid" as="grid"> <arguments> <argument name="id" xsi:type="string">cmsBlockGrid</argument> @@ -37,7 +37,7 @@ <arguments> <argument name="id" xsi:type="string">cmsBlockGrid</argument> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">adminhtml/*/edit</item> + <item name="path" xsi:type="string">*/*/edit</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="block_id" xsi:type="string">getId</item> </item> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_page_new.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_new.xml similarity index 95% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_page_new.xml rename to app/code/Magento/Cms/view/adminhtml/layout/cms_block_new.xml index 77b086408336b7a7b5575d65e3a96113dd2f8e2f..c7b280477125ae374e8b664bc3b2ac0e87703ab0 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_page_new.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_new.xml @@ -24,5 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="adminhtml_cms_page_edit"/> + <update handle="cms_block_edit"/> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_page_edit.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml similarity index 91% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_page_edit.xml rename to app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml index 738cadfd99a0a37d2fca12804511ba9ebb0ea70f..c694e9b85640f1a7885e84764fe85a457f8b84ca 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_page_edit.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml @@ -63,14 +63,14 @@ </referenceBlock> <update handle="editor"/> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Cms\Page\Edit" name="cms_page_edit"/> + <block class="Magento\Cms\Block\Adminhtml\Page\Edit" name="cms_page_edit"/> </referenceContainer> <referenceContainer name="left"> - <block class="Magento\Adminhtml\Block\Cms\Page\Edit\Tabs" name="cms_page_edit_tabs"> - <block class="Magento\Adminhtml\Block\Cms\Page\Edit\Tab\Main" name="cms_page_edit_tab_main"/> - <block class="Magento\Adminhtml\Block\Cms\Page\Edit\Tab\Content" name="cms_page_edit_tab_content"/> - <block class="Magento\Adminhtml\Block\Cms\Page\Edit\Tab\Design" name="cms_page_edit_tab_design"/> - <block class="Magento\Adminhtml\Block\Cms\Page\Edit\Tab\Meta" name="cms_page_edit_tab_meta"/> + <block class="Magento\Cms\Block\Adminhtml\Page\Edit\Tabs" name="cms_page_edit_tabs"> + <block class="Magento\Cms\Block\Adminhtml\Page\Edit\Tab\Main" name="cms_page_edit_tab_main"/> + <block class="Magento\Cms\Block\Adminhtml\Page\Edit\Tab\Content" name="cms_page_edit_tab_content"/> + <block class="Magento\Cms\Block\Adminhtml\Page\Edit\Tab\Design" name="cms_page_edit_tab_design"/> + <block class="Magento\Cms\Block\Adminhtml\Page\Edit\Tab\Meta" name="cms_page_edit_tab_meta"/> <action method="addTab"> <argument name="name" xsi:type="string">main_section</argument> <argument name="block" xsi:type="string">cms_page_edit_tab_main</argument> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_page_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_page_index.xml rename to app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml index bff9e70149c936264193b306235d2f8914036626..73f201d9f7ff373f6fa4d9aeb2ea4a6f3334ed46 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_page_index.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Cms\Page" name="cms_page"/> + <block class="Magento\Cms\Block\Adminhtml\Page" name="cms_page"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_block_new.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_new.xml similarity index 95% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_block_new.xml rename to app/code/Magento/Cms/view/adminhtml/layout/cms_page_new.xml index deb7ea38d786db06f7ebe586083c11df8d7ddc34..c5a86664a0850fa5b2c1b0d860cd193143957730 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_block_new.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_new.xml @@ -24,5 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="adminhtml_cms_block_edit"/> + <update handle="cms_page_edit"/> </layout> diff --git a/app/code/Magento/PaypalUk/view/frontend/layout/paypaluk_express_review_details.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_contents.xml similarity index 86% rename from app/code/Magento/PaypalUk/view/frontend/layout/paypaluk_express_review_details.xml rename to app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_contents.xml index 4f46c82923b71d07308f026147531375317704df..2e40d476653225180c1484a61261d5b7bb3e3069 100644 --- a/app/code/Magento/PaypalUk/view/frontend/layout/paypaluk_express_review_details.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_contents.xml @@ -24,5 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"/> + <block class="Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content\Files" name="wysiwyg_images.files" template="browser/content/files.phtml" output="1"/> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_wysiwyg_images_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml similarity index 76% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_wysiwyg_images_index.xml rename to app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml index 5cbaf74f7ea63a0c2862518099f28194c81e7937..e5ab74c51ccd078b39f6326d0c7c60fb739a3104 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_wysiwyg_images_index.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml @@ -28,9 +28,9 @@ <remove name="head"/> <remove name="left"/> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Content" name="wysiwyg_images.content" template="cms/browser/content.phtml"> - <block class="Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Tree" name="wysiwyg_images.tree" template="cms/browser/tree.phtml"/> - <block class="Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Content\Uploader" name="wysiwyg_images.uploader" template="cms/browser/content/uploader.phtml"/> + <block class="Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content" name="wysiwyg_images.content" template="browser/content.phtml"> + <block class="Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Tree" name="wysiwyg_images.tree" template="browser/tree.phtml"/> + <block class="Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content\Uploader" name="wysiwyg_images.uploader" template="Magento_Cms::browser/content/uploader.phtml"/> </block> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/cms/page/edit/form/renderer/content.phtml b/app/code/Magento/Cms/view/adminhtml/page/edit/form/renderer/content.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/cms/page/edit/form/renderer/content.phtml rename to app/code/Magento/Cms/view/adminhtml/page/edit/form/renderer/content.phtml diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php index 4fad445d926c12fa0bfd220ffa2d731ae7b7acf6..ba6a666aaa78c358be6b8f19cb4d13aa0d58dca7 100644 --- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php +++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/AbstractTab.php @@ -54,7 +54,7 @@ abstract class AbstractTab /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Connect\Model\Session $session @@ -62,7 +62,7 @@ abstract class AbstractTab */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Connect\Model\Session $session, diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php index 80e90e98ec5aabac733dae31c94ef16c469a18f1..642f27dd1a3f80d4411fdbcd4a4d3dcf46715761 100644 --- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php +++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Tab/Contents.php @@ -46,7 +46,7 @@ class Contents /** * @param \Magento\Connect\Model\ExtensionFactory $extensionFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Connect\Model\Session $session @@ -55,7 +55,7 @@ class Contents public function __construct( \Magento\Connect\Model\ExtensionFactory $extensionFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Connect\Model\Session $session, diff --git a/app/code/Magento/Connect/Helper/Data.php b/app/code/Magento/Connect/Helper/Data.php index 5d323abaa7fb0ffd990c1e01c0f72a0233c5f06c..0f111de96925111bd9f6772f34ee94f18058d617 100644 --- a/app/code/Magento/Connect/Helper/Data.php +++ b/app/code/Magento/Connect/Helper/Data.php @@ -23,16 +23,11 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Connect\Helper; /** * Default helper of the module - * - * @category Magento - * @package Magento_Connect - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Connect\Helper; - class Data extends \Magento\Core\Helper\Data { /** @@ -47,41 +42,49 @@ class Data extends \Magento\Core\Helper\Data */ protected $_dirs; + /** + * @var \Magento\Convert\Xml + */ + protected $_xmlConverter; + /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor * @param \Magento\Filesystem $filesystem + * @param \Magento\Convert\Xml $xmlConverter * @param \Magento\App\Dir $dirs * @param bool $dbCompatibleMode */ public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, \Magento\Filesystem $filesystem, + \Magento\Convert\Xml $xmlConverter, \Magento\App\Dir $dirs, $dbCompatibleMode = true - ) - { + ) { $this->_filesystem = $filesystem; $this->_dirs = $dirs; - parent::__construct($context, $eventManager, $coreHttp, $config, $coreStoreConfig, $storeManager, - $locale, $dateModel, $appState, $encryptor, $dbCompatibleMode + $this->_xmlConverter = $xmlConverter; + parent::__construct( + $context, + $eventManager, + $coreStoreConfig, + $storeManager, + $locale, + $dateModel, + $appState, + $dbCompatibleMode ); } @@ -173,27 +176,23 @@ class Data extends \Magento\Core\Helper\Data public function loadLocalPackage($packageName) { //check LFI protection - $this->checkLfiProtection($packageName); - + $this->_filesystem->checkLfiProtection($packageName); $path = $this->getLocalPackagesPath(); $xmlFile = $path . $packageName . '.xml'; $serFile = $path . $packageName . '.ser'; - if ($this->_filesystem->isFile($xmlFile) && $this->_filesystem->isReadable($xmlFile)) { - $xml = simplexml_load_string($this->_filesystem->read($xmlFile)); - $data = $this->xmlToAssoc($xml); + $xml = simplexml_load_string($this->_filesystem->read($xmlFile)); + $data = $this->_xmlConverter->xmlToAssoc($xml); if (!empty($data)) { return $data; } } - if ($this->_filesystem->isFile($serFile) && $this->_filesystem->isReadable($xmlFile)) { $data = unserialize($this->_filesystem->read($serFile)); if (!empty($data)) { return $data; } } - return false; } } diff --git a/app/code/Magento/Connect/Model/Extension.php b/app/code/Magento/Connect/Model/Extension.php index 8efaaec271b93834e865dfa04b6e8f50cb91335e..6eb6cf76e7fb38e24b3e810680c42f8430d09594 100644 --- a/app/code/Magento/Connect/Model/Extension.php +++ b/app/code/Magento/Connect/Model/Extension.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Connect\Model; + /** * Extension model - * - * @category Magento - * @package Magento_Connect - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Connect\Model; - class Extension extends \Magento\Object { /** @@ -59,14 +55,12 @@ class Extension extends \Magento\Object * * @var \Magento\Connect\Helper\Data */ - protected $_connectData = null; + protected $_connectData; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Convert\ConvertArray */ - protected $_coreData = null; + protected $_convertArray; /** * Session @@ -76,20 +70,20 @@ class Extension extends \Magento\Object protected $_session; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Convert\ConvertArray $convertArray * @param \Magento\Connect\Helper\Data $connectData * @param \Magento\Filesystem $filesystem * @param \Magento\Connect\Model\Session $session * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Convert\ConvertArray $convertArray, \Magento\Connect\Helper\Data $connectData, \Magento\Filesystem $filesystem, \Magento\Connect\Model\Session $session, array $data = array() ) { - $this->_coreData = $coreData; + $this->_convertArray = $convertArray; $this->_connectData = $connectData; $this->_session = $session; parent::__construct($data); @@ -110,14 +104,14 @@ class Extension extends \Magento\Object } /** - * Set package object. + * Set package object * * @return \Magento\Connect\Model\Extension + * @throws \Magento\Core\Exception */ public function generatePackageXml() { - $this->_session - ->setLocalExtensionPackageFormData($this->getData()); + $this->_session->setLocalExtensionPackageFormData($this->getData()); $this->_setPackage() ->_setRelease() @@ -180,6 +174,10 @@ class Extension extends \Magento\Object return $this; } + /** + * @param string $filesString + * @return array + */ protected function packageFilesToArray($filesString) { $packageFiles = array(); @@ -190,7 +188,7 @@ class Extension extends \Magento\Object $res = explode(DIRECTORY_SEPARATOR, $file, 2); array_map('trim', $res); if (2 == count($res)) { - $packageFiles[] = array('target'=>$res[0], 'path'=>$res[1]); + $packageFiles[] = array('target' => $res[0], 'path' => $res[1]); } } } @@ -208,31 +206,32 @@ class Extension extends \Magento\Object ->clearDependencies() ->setDependencyPhpVersion($this->getData('depends_php_min'), $this->getData('depends_php_max')); - foreach ($this->getData('depends') as $deptype=>$deps) { - foreach ($deps['name'] as $i=>$type) { - if (0===$i) { + foreach ($this->getData('depends') as $depType => $deps) { + foreach (array_keys($deps['name']) as $key) { + if (0 === $key) { continue; } - $name = $deps['name'][$i]; - $min = !empty($deps['min'][$i]) ? $deps['min'][$i] : false; - $max = !empty($deps['max'][$i]) ? $deps['max'][$i] : false; + $name = $deps['name'][$key]; + $min = !empty($deps['min'][$key]) ? $deps['min'][$key] : false; + $max = !empty($deps['max'][$key]) ? $deps['max'][$key] : false; - $files = !empty($deps['files'][$i]) ? $deps['files'][$i] : false; + $files = !empty($deps['files'][$key]) ? $deps['files'][$key] : false; $packageFiles = $this->packageFilesToArray($files); - if ($deptype !== 'extension') { - $channel = !empty($deps['channel'][$i]) - ? $deps['channel'][$i] + if ($depType !== 'extension') { + $channel = !empty($deps['channel'][$key]) + ? $deps['channel'][$key] : 'connect.magentocommerce.com/core'; } - switch ($deptype) { + switch ($depType) { case 'package': $this->getPackage()->addDependencyPackage($name, $channel, $min, $max, $packageFiles); break; - case 'extension': $this->getPackage()->addDependencyExtension($name, $min, $max); break; + default: + break; } } } @@ -248,15 +247,14 @@ class Extension extends \Magento\Object { $this->getPackage()->clearContents(); $contents = $this->getData('contents'); - foreach ($contents['target'] as $i=>$target) { - if (0===$i) { + foreach ($contents['target'] as $i => $target) { + if (0 === $i) { continue; } switch ($contents['type'][$i]) { case 'file': $this->getPackage()->addContent($contents['path'][$i], $contents['target'][$i]); break; - case 'dir': $target = $contents['target'][$i]; $path = $contents['path'][$i]; @@ -264,6 +262,8 @@ class Extension extends \Magento\Object $ignore = $contents['ignore'][$i]; $this->getPackage()->addContentDir($target, $path, $ignore, $include); break; + default: + break; } } return $this; @@ -301,7 +301,7 @@ class Extension extends \Magento\Object $this->unsPackageXml(); $this->unsTargets(); - $xml = $this->_coreData->assocToXml($this->getData()); + $xml = $this->_convertArray->assocToXml($this->getData()); $xml = new \Magento\Simplexml\Element($xml->asXML()); // prepare dir to save diff --git a/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php b/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php new file mode 100644 index 0000000000000000000000000000000000000000..378994adff2c8d1c5fd75d24af9c2e6c2f67ab0a --- /dev/null +++ b/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php @@ -0,0 +1,75 @@ +<?php +/** + * Dispatch exception handler + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\App\FrontController\Plugin; + +use Magento\Core\Model\StoreManager, + Magento\App\Dir; + +class DispatchExceptionHandler +{ + /** + * @var \Magento\Core\Model\StoreManager + */ + protected $_storeManager; + + + /** + * @var \Magento\App\Dir + */ + protected $_dir; + + /** + * @param StoreManager $storeManager + * @param Dir $dir + */ + public function __construct( + StoreManager $storeManager, + Dir $dir + ) { + $this->_storeManager = $storeManager; + $this->_dir = $dir; + } + + /** + * Handle dispatch exceptions + * + * @param array $arguments + * @param \Magento\Code\Plugin\InvocationChain $invocationChain + * @return mixed + */ + public function aroundDispatch(array $arguments, \Magento\Code\Plugin\InvocationChain $invocationChain) + { + try { + return $invocationChain->proceed($arguments); + } catch (\Magento\Core\Model\Session\Exception $e) { + header('Location: ' . $this->_storeManager->getStore()->getBaseUrl()); + exit; + } catch (\Magento\Core\Model\Store\Exception $e) { + require $this->_dir->getDir(Dir::PUB) . DS . 'errors' . DS . '404.php'; + exit; + } + } +} diff --git a/app/code/Magento/Core/App/FrontController/Plugin/RequestPreprocessor.php b/app/code/Magento/Core/App/FrontController/Plugin/RequestPreprocessor.php index 358c748aece6965cfc543b09a45451b4fa60b7a0..8ea7e827e02e59df583759ddd2703c983a420775 100644 --- a/app/code/Magento/Core/App/FrontController/Plugin/RequestPreprocessor.php +++ b/app/code/Magento/Core/App/FrontController/Plugin/RequestPreprocessor.php @@ -25,11 +25,6 @@ namespace Magento\Core\App\FrontController\Plugin; class RequestPreprocessor { - /** - * @var \Magento\Core\App\Request\RewriteService RewriteService - */ - protected $_rewriteService; - /** * @var \Magento\Core\Model\Store\Config */ @@ -56,30 +51,19 @@ class RequestPreprocessor protected $_storeManager; /** - * @var \Magento\Backend\Helper\Data - */ - protected $_backendData; - - /** - * @param \Magento\Core\App\Request\RewriteService $rewriteService * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\App\State $appState * @param \Magento\Core\Model\Url $url - * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\App\ResponseFactory $responseFactory */ public function __construct( - \Magento\Core\App\Request\RewriteService $rewriteService, \Magento\Core\Model\StoreManager $storeManager, \Magento\App\State $appState, \Magento\Core\Model\Url $url, - \Magento\Backend\Helper\Data $backendData, \Magento\Core\Model\Store\Config $storeConfig, \Magento\App\ResponseFactory $responseFactory ) { - $this->_backendData = $backendData; - $this->_rewriteService = $rewriteService; $this->_storeManager = $storeManager; $this->_appState = $appState; $this->_url = $url; @@ -88,7 +72,8 @@ class RequestPreprocessor } /** - * Preprocess request + * Auto-redirect to base url (without SID) if the requested url doesn't match it. + * By default this feature is enabled in configuration. * * @param array $arguments * @param \Magento\Code\Plugin\InvocationChain $invocationChain @@ -97,88 +82,54 @@ class RequestPreprocessor public function aroundDispatch(array $arguments, \Magento\Code\Plugin\InvocationChain $invocationChain) { $request = $arguments[0]; - // If pre-configured, check equality of base URL and requested URL - $this->_checkBaseUrl($request); + if ($this->_appState->isInstalled() && !$request->isPost() && $this->_isBaseUrlCheckEnabled()) { + $baseUrl = $this->_storeManager->getStore()->getBaseUrl( + \Magento\Core\Model\Store::URL_TYPE_WEB, + $this->_storeManager->getStore()->isCurrentlySecure() + ); + if ($baseUrl) { + $uri = parse_url($baseUrl); + if (!$this->_isBaseUrlCorrect($uri, $request)) { + $redirectUrl = $this->_url->getRedirectUrl( + $this->_url->getUrl(ltrim($request->getPathInfo(), '/'), array('_nosid' => true)) + ); + $redirectCode = (int)$this->_storeConfig->getConfig('web/url/redirect_to_base') !== 301 + ? 302 + : 301; + + $response = $this->_responseFactory->create(); + $response->setRedirect($redirectUrl, $redirectCode); + return $response; + } + } + } $request->setDispatched(false); - $this->_rewriteService->applyRewrites($request); return $invocationChain->proceed($arguments); } /** - * Check if requested path starts with one of the admin front names + * Is base url check enabled * - * @param \Magento\App\RequestInterface $request - * @return boolean + * @return bool */ - protected function _isAdminFrontNameMatched($request) + protected function _isBaseUrlCheckEnabled() { - $pathPrefix = $this->_extractPathPrefixFromUrl($request); - return $pathPrefix == $this->_backendData->getAreaFrontName(); + return (bool) $this->_storeConfig->getConfig('web/url/redirect_to_base'); } /** - * Extract first path part from url (in most cases this is area code) + * Check if base url enabled * - * @param \Magento\App\RequestInterface $request - * @return string + * @param array $uri + * @param \Magento\App\Request\Http $request + * @return bool */ - protected function _extractPathPrefixFromUrl($request) + protected function _isBaseUrlCorrect($uri, $request) { - $pathPrefix = ltrim($request->getPathInfo(), '/'); - $urlDelimiterPos = strpos($pathPrefix, '/'); - if ($urlDelimiterPos) { - $pathPrefix = substr($pathPrefix, 0, $urlDelimiterPos); - } - - return $pathPrefix; - } - - /** - * Auto-redirect to base url (without SID) if the requested url doesn't match it. - * By default this feature is enabled in configuration. - * - * @param \Magento\App\RequestInterface $request - */ - protected function _checkBaseUrl($request) - { - if (!$this->_appState->isInstalled() || $request->getPost() || strtolower($request->getMethod()) == 'post') { - return; - } - - $redirectCode = (int)$this->_storeConfig->getConfig('web/url/redirect_to_base'); - if (!$redirectCode) { - return; - } elseif ($redirectCode != 301) { - $redirectCode = 302; - } - - if ($this->_isAdminFrontNameMatched($request)) { - return; - } - - $baseUrl = $this->_storeManager->getStore()->getBaseUrl( - \Magento\Core\Model\Store::URL_TYPE_WEB, - $this->_storeManager->getStore()->isCurrentlySecure() - ); - if (!$baseUrl) { - return; - } - - $uri = parse_url($baseUrl); $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/'; - if (isset($uri['scheme']) && $uri['scheme'] != $request->getScheme() - || isset($uri['host']) && $uri['host'] != $request->getHttpHost() - || isset($uri['path']) && strpos($requestUri, $uri['path']) === false - ) { - $redirectUrl = $this->_url->getRedirectUrl( - $this->_url->getUrl(ltrim($request->getPathInfo(), '/'), array('_nosid' => true)) - ); - - $response = $this->_responseFactory->create(); - $response->setRedirect($redirectUrl, $redirectCode); - $response->sendResponse(); - exit; - } + return (!isset($uri['scheme']) || $uri['scheme'] === $request->getScheme()) + && (!isset($uri['host']) || $uri['host'] === $request->getHttpHost()) + && (!isset($uri['path']) || strpos($requestUri, $uri['path']) !== false); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Core/App/FrontController/Plugin/UrlRewrite.php b/app/code/Magento/Core/App/FrontController/Plugin/UrlRewrite.php new file mode 100644 index 0000000000000000000000000000000000000000..1bc71d37439ee61705a052b91375a4c458ec7930 --- /dev/null +++ b/app/code/Magento/Core/App/FrontController/Plugin/UrlRewrite.php @@ -0,0 +1,66 @@ +<?php +/** + * Url Rewrite front controller plugin. Performs url rewrites + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\App\FrontController\Plugin; + +class UrlRewrite +{ + /** + * @var \Magento\Core\App\Request\RewriteService RewriteService + */ + protected $_rewriteService; + + /** + * @var \Magento\App\State + */ + protected $_state; + + /** + * @param \Magento\Core\App\Request\RewriteService $rewriteService + * @param \Magento\App\State $state + */ + public function __construct(\Magento\Core\App\Request\RewriteService $rewriteService, \Magento\App\State $state) + { + $this->_rewriteService = $rewriteService; + $this->_state = $state; + } + + /** + * Perform url rewites + * + * @param array $arguments + * @param \Magento\Code\Plugin\InvocationChain $invocationChain + * @return mixed + */ + public function aroundDispatch(array $arguments, \Magento\Code\Plugin\InvocationChain $invocationChain) + { + if (!$this->_state->isInstalled()) { + return $invocationChain->proceed($arguments); + } + $request = $arguments[0]; + $this->_rewriteService->applyRewrites($request); + return $invocationChain->proceed($arguments); + } +} \ No newline at end of file diff --git a/app/code/Magento/Core/Model/EntryPoint/Media.php b/app/code/Magento/Core/App/Media.php similarity index 77% rename from app/code/Magento/Core/Model/EntryPoint/Media.php rename to app/code/Magento/Core/App/Media.php index 740b4cce7e27912b1c16e068cf96debe2fa144db..08743890f8a5dc04224ebe090153ef875bab7a20 100644 --- a/app/code/Magento/Core/Model/EntryPoint/Media.php +++ b/app/code/Magento/Core/App/Media.php @@ -1,6 +1,6 @@ <?php /** - * Media downloader entry point + * Media application * * Magento * @@ -23,10 +23,26 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\EntryPoint; +namespace Magento\Core\App; -class Media extends \Magento\Core\Model\AbstractEntryPoint +use Magento\App\State, + Magento\AppInterface, + Magento\ObjectManager, + Magento\Core\Model\File\Storage\Request, + Magento\Core\Model\File\Storage\Response; + +class Media implements AppInterface { + /** + * @var \Magento\App\State + */ + protected $_applicationState; + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + /** * @var \Magento\Core\Model\File\Storage\Request */ @@ -73,47 +89,49 @@ class Media extends \Magento\Core\Model\AbstractEntryPoint protected $_response; /** - * @param \Magento\Core\Model\Config\Primary $config - * @param \Magento\Core\Model\File\Storage\Request $request + * @param State $applicationState + * @param ObjectManager $objectManager + * @param Request $request + * @param Response $response * @param callable $isAllowed * @param string $workingDirectory * @param string $mediaDirectory * @param string $configCacheFile * @param string $relativeFileName - * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\File\Storage\Response */ public function __construct( - \Magento\Core\Model\Config\Primary $config, - \Magento\Core\Model\File\Storage\Request $request, + State $applicationState, + ObjectManager $objectManager, + Request $request, + Response $response, \Closure $isAllowed, $workingDirectory, $mediaDirectory, $configCacheFile, - $relativeFileName, - \Magento\ObjectManager $objectManager = null, - \Magento\Core\Model\File\Storage\Response $response = null + $relativeFileName ) { - parent::__construct($config, $objectManager); + $this->_applicationState = $applicationState; + $this->_objectManager = $objectManager; $this->_request = $request; + $this->_response = $response; $this->_isAllowed = $isAllowed; $this->_workingDirectory = $workingDirectory; $this->_mediaDirectory = $mediaDirectory; $this->_configCacheFile = $configCacheFile; $this->_relativeFileName = $relativeFileName; - $this->_response = $response ?: new \Magento\Core\Model\File\Storage\Response($this->_objectManager); } /** - * Process request to application + * Execute application + * + * @return int */ - protected function _processRequest() + public function execute() { try { - $appState = $this->_objectManager->get('Magento\App\State'); - if (!$appState->isInstalled()) { + if (!$this->_applicationState->isInstalled()) { $this->_response->sendNotFound(); - return; + return -1; } if (!$this->_mediaDirectory) { $config = $this->_objectManager->create( @@ -128,13 +146,13 @@ class Media extends \Magento\Core\Model\AbstractEntryPoint $isAllowed = $this->_isAllowed; if (!$isAllowed($this->_relativeFileName, $allowedResources)) { $this->_response->sendNotFound(); - return; + return -1; } } if (0 !== stripos($this->_request->getPathInfo(), $this->_mediaDirectory . '/')) { $this->_response->sendNotFound(); - return; + return -1; } $sync = $this->_objectManager->get('Magento\Core\Model\File\Storage\Synchronization'); @@ -142,12 +160,14 @@ class Media extends \Magento\Core\Model\AbstractEntryPoint if (is_readable($this->_request->getFilePath())) { $this->_response->sendFile($this->_request->getFilePath()); + return 0; } else { $this->_response->sendNotFound(); + return -1; } } catch (\Magento\Core\Model\Store\Exception $e) { $this->_response->sendNotFound(); - return; + return -1; } } } diff --git a/app/code/Magento/Core/App/Router/Base.php b/app/code/Magento/Core/App/Router/Base.php new file mode 100644 index 0000000000000000000000000000000000000000..742c4168bdbbc973b11ddfaf4abe4c02267748c4 --- /dev/null +++ b/app/code/Magento/Core/App/Router/Base.php @@ -0,0 +1,436 @@ +<?php +/** + * Base router + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\App\Router; + +class Base extends \Magento\App\Router\AbstractRouter +{ + /** + * @var array + */ + protected $_modules = array(); + + /** + * @var array + */ + protected $_dispatchData = array(); + + /** + * List of required request parameters + * Order sensitive + * @var array + */ + protected $_requiredParams = array( + 'moduleFrontName', + 'controllerName', + 'actionName', + ); + + /** + * @var \Magento\App\Route\ConfigInterface + */ + protected $_routeConfig; + + /** + * Url security information. + * + * @var \Magento\Core\Model\Url\SecurityInfoInterface + */ + protected $_urlSecurityInfo; + + /** + * Core store config + * + * @var \Magento\Core\Model\Store\Config + */ + protected $_storeConfig; + + /** + * Core config + * + * @var \Magento\Core\Model\Config + */ + protected $_config = null; + + /** + * @var \Magento\UrlInterface + */ + protected $_url; + + /** + * @var \Magento\Core\Model\StoreManager + */ + protected $_storeManager; + + /** + * @var \Magento\App\State + */ + protected $_appState; + + /** + * @var \Magento\App\ResponseFactory + */ + protected $_responseFactory; + + /** + * @var \Magento\App\DefaultPathInterface + */ + protected $_defaultPath; + + /** + * @param \Magento\App\ActionFactory $actionFactory + * @param \Magento\App\DefaultPathInterface $defaultPath + * @param \Magento\App\ResponseFactory $responseFactory + * @param \Magento\App\Route\ConfigInterface $routeConfig + * @param \Magento\App\State $appState + * @param \Magento\Core\Model\Url|\Magento\UrlInterface $url + * @param \Magento\Core\Model\StoreManager|\Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo + * @param $routerId + * @throws \InvalidArgumentException + */ + public function __construct( + \Magento\App\ActionFactory $actionFactory, + \Magento\App\DefaultPathInterface $defaultPath, + \Magento\App\ResponseFactory $responseFactory, + \Magento\App\Route\ConfigInterface $routeConfig, + \Magento\App\State $appState, + \Magento\UrlInterface $url, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo, + $routerId + ) { + parent::__construct($actionFactory); + + $this->_responseFactory = $responseFactory; + $this->_defaultPath = $defaultPath; + $this->_routeConfig = $routeConfig; + $this->_urlSecurityInfo = $urlSecurityInfo; + $this->_storeConfig = $storeConfig; + $this->_url = $url; + $this->_storeManager = $storeManager; + $this->_appState = $appState; + } + + /** + * Match provided request and if matched - return corresponding controller + * + * @param \Magento\App\RequestInterface $request + * @return \Magento\Core\Controller\Front\Action|null + */ + public function match(\Magento\App\RequestInterface $request) + { + $params = $this->_parseRequest($request); + + return $this->_matchController($request, $params); + } + + /** + * Parse request URL params + * + * @param \Magento\App\RequestInterface $request + * @return array + */ + protected function _parseRequest(\Magento\App\RequestInterface $request) + { + $output = array(); + + $path = trim($request->getPathInfo(), '/'); + + $params = explode('/', ($path ? $path : $this->_getDefaultPath())); + foreach ($this->_requiredParams as $paramName) { + $output[$paramName] = array_shift($params); + } + + for ($i = 0, $l = sizeof($params); $i < $l; $i += 2) { + $output['variables'][$params[$i]] = isset($params[$i+1]) ? urldecode($params[$i + 1]) : ''; + } + return $output; + } + + /** + * Match module front name + * + * @param \Magento\App\RequestInterface $request + * @param string $param + * @return string|null + */ + protected function _matchModuleFrontName(\Magento\App\RequestInterface $request, $param) + { + // get module name + if ($request->getModuleName()) { + $moduleFrontName = $request->getModuleName(); + } else if (!empty($param)) { + $moduleFrontName = $param; + } else { + $moduleFrontName = $this->_defaultPath->getPart('module'); + $request->setAlias(\Magento\Core\Model\Url\Rewrite::REWRITE_REQUEST_PATH_ALIAS, ''); + } + if (!$moduleFrontName) { + return null; + } + return $moduleFrontName; + } + + /** + * Match controller name + * + * @param \Magento\App\RequestInterface $request + * @param string $param + * @return string + */ + protected function _matchControllerName(\Magento\App\RequestInterface $request, $param) + { + if ($request->getControllerName()) { + $controller = $request->getControllerName(); + } else if (!empty($param)) { + $controller = $param; + } else { + $controller = $this->_defaultPath->getPart('controller'); + $request->setAlias( + \Magento\Core\Model\Url\Rewrite::REWRITE_REQUEST_PATH_ALIAS, + ltrim($request->getOriginalPathInfo(), '/') + ); + } + return $controller; + } + + /** + * Match controller name + * + * @param \Magento\App\RequestInterface $request + * @param string $param + * @return string + */ + protected function _matchActionName(\Magento\App\RequestInterface $request, $param) + { + if ($request->getActionName()) { + $action = $request->getActionName(); + } else if (empty($param)) { + $action = $this->_defaultPath->getPart('action'); + } else { + $action = $param; + } + + return $action; + } + + /** + * Get not found controller instance + * + * @param $currentModuleName + * @param \Magento\App\RequestInterface $request + * @return \Magento\Core\Controller\Varien\Action|null + */ + protected function _getNotFoundControllerInstance($currentModuleName, \Magento\App\RequestInterface $request) + { + if (!$this->_noRouteShouldBeApplied()) { + return null; + } + + $controllerClassName = $this->getControllerClassName($currentModuleName, 'index'); + if (!$controllerClassName || !method_exists($controllerClassName, 'norouteAction')) { + return null; + } + + // instantiate controller class + return $this->_actionFactory->createController($controllerClassName, + array('request' => $request) + ); + } + + /** + * Create matched controller instance + * + * @param \Magento\App\RequestInterface $request + * @param array $params + * @return \Magento\Core\Controller\Front\Action|null + */ + protected function _matchController(\Magento\App\RequestInterface $request, array $params) + { + $moduleFrontName = $this->_matchModuleFrontName($request, $params['moduleFrontName']); + if (empty($moduleFrontName)) { + return null; + } + + /** + * Searching router args by module name from route using it as key + */ + $modules = $this->_routeConfig->getModulesByFrontName($moduleFrontName); + + if (empty($modules) === true) { + return null; + } + + /** + * Going through modules to find appropriate controller + */ + $currentModuleName = null; + $controller = null; + $action = null; + $controllerInstance = null; + + $request->setRouteName($this->_routeConfig->getRouteByFrontName($moduleFrontName)); + $controller = $this->_matchControllerName($request, $params['controllerName']); + $action = $this->_matchActionName($request, $params['actionName']); + $this->_checkShouldBeSecure($request, '/' . $moduleFrontName . '/' . $controller . '/' . $action); + + foreach ($modules as $moduleName) { + $currentModuleName = $moduleName; + + $controllerClassName = $this->getControllerClassName($moduleName, $controller); + if (!$controllerClassName || false === method_exists($controllerClassName, $action . 'Action')) { + continue; + } + + $controllerInstance = $this->_actionFactory->createController($controllerClassName, + array('request' => $request) + ); + break; + } + + if (null == $controllerInstance) { + $controllerInstance = $this->_getNotFoundControllerInstance($currentModuleName, $request); + if (is_null($controllerInstance)) { + return null; + } + } + + // set values only after all the checks are done + $request->setModuleName($moduleFrontName); + $request->setControllerName($controller); + $request->setActionName($action); + $request->setControllerModule($currentModuleName); + if (isset($params['variables'])) { + $request->setParams($params['variables']); + } + return $controllerInstance; + } + + /** + * Get router default request path + * @return string + */ + protected function _getDefaultPath() + { + return $this->_storeConfig->getConfig('web/default/front'); + } + + /** + * Allow to control if we need to enable no route functionality in current router + * + * @return bool + */ + protected function _noRouteShouldBeApplied() + { + return false; + } + + /** + * Build controller class name + * + * @param string $realModule + * @param string $controller + * @return string + */ + public function getControllerClassName($realModule, $controller) + { + return \Magento\Core\Helper\String::buildClassName(array( + $realModule, + 'Controller', + $controller + )); + } + + /** + * Check that request uses https protocol if it should. + * Function redirects user to correct URL if needed. + * + * @param \Magento\App\RequestInterface $request + * @param string $path + * @return void + */ + protected function _checkShouldBeSecure(\Magento\App\RequestInterface $request, $path = '') + { + if (!$this->_appState->isInstalled() || $request->getPost()) { + return; + } + + if ($this->_shouldBeSecure($path) && !$request->isSecure()) { + $url = $this->_getCurrentSecureUrl($request); + if ($this->_shouldRedirectToSecure()) { + $url = $this->_url->getRedirectUrl($url); + } + + $this->_responseFactory->create() + ->setRedirect($url) + ->sendResponse(); + exit; + } + } + + /** + * Check whether redirect url should be used for secure routes + * + * @return bool + */ + protected function _shouldRedirectToSecure() + { + return $this->_url->getUseSession(); + } + + /** + * Retrieve secure url for current request + * + * @param \Magento\App\RequestInterface $request + * @return string + */ + protected function _getCurrentSecureUrl($request) + { + $alias = $request->getAlias(\Magento\Core\Model\Url\Rewrite::REWRITE_REQUEST_PATH_ALIAS); + if ($alias) { + return $this->_storeManager->getStore()->getBaseUrl('link', true) . ltrim($alias, '/'); + } + + return $this->_storeManager->getStore()->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/'); + } + + /** + * Check whether given path should be secure according to configuration security requirements for URL + * "Secure" should not be confused with https protocol, it is about web/secure/*_url settings usage only + * + * @param string $path + * @return bool + */ + protected function _shouldBeSecure($path) + { + return substr($this->_storeConfig->getConfig('web/unsecure/base_url'), 0, 5) === 'https' + || $this->_storeConfig->getConfigFlag('web/secure/use_in_frontend') + && substr($this->_storeConfig->getConfig('web/secure/base_url'), 0, 5) == 'https' + && $this->_urlSecurityInfo->isSecure($path); + } +} diff --git a/app/code/Magento/Core/App/Router/NoRouteHandler.php b/app/code/Magento/Core/App/Router/NoRouteHandler.php index f5dd26fdbd69e538458fcb5e51544431fed1b6b8..ac90babbf1a76eec98e151f35aff22b566ff99b6 100644 --- a/app/code/Magento/Core/App/Router/NoRouteHandler.php +++ b/app/code/Magento/Core/App/Router/NoRouteHandler.php @@ -26,7 +26,7 @@ namespace Magento\Core\App\Router; -class NoRouteHandler implements \Magento\Appl\Router\NoRouteHandlerInterface +class NoRouteHandler implements \Magento\App\Router\NoRouteHandlerInterface { /** * @var \Magento\Core\Model\Config diff --git a/app/code/Magento/Core/Block/AbstractBlock.php b/app/code/Magento/Core/Block/AbstractBlock.php index 0c49aefc14b3b618f66181b5c2f259799c481240..bd9d74ed8fa900361eb4084fdb2ad2efcda0de39 100644 --- a/app/code/Magento/Core/Block/AbstractBlock.php +++ b/app/code/Magento/Core/Block/AbstractBlock.php @@ -24,6 +24,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Block; + +use Magento\View\Element\BlockInterface; /** * Base Content Block class @@ -31,15 +34,6 @@ * For block generation you must define Data source class, data source class method, * parameters array and block template * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Core\Block; - -use Magento\View\Element\BlockInterface; - -/** * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -149,14 +143,24 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface protected $_cacheState; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** * @var \Magento\Core\Model\App */ - protected $_storeManager; + protected $_app; + + /** + * @var \Magento\Escaper + */ + protected $_escaper; + + /** + * @var \Magento\Filter\FilterManager + */ + protected $filterManager; /** * @param \Magento\Core\Block\Context $context @@ -179,7 +183,9 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $this->_viewConfig = $context->getViewConfig(); $this->_cacheState = $context->getCacheState(); $this->_logger = $context->getLogger(); - $this->_storeManager = $context->getApp(); + $this->_app = $context->getApp(); + $this->_escaper = $context->getEscaper(); + $this->filterManager = $context->getFilterManager(); parent::__construct($data); $this->_construct(); } @@ -862,7 +868,7 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ public function escapeHtml($data, $allowedTags = null) { - return $this->helper('Magento\Core\Helper\Data')->escapeHtml($data, $allowedTags); + return $this->_escaper->escapeHtml($data, $allowedTags); } /** @@ -875,7 +881,10 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ public function stripTags($data, $allowableTags = null, $allowHtmlEntities = false) { - return $this->helper('Magento\Core\Helper\Data')->stripTags($data, $allowableTags, $allowHtmlEntities); + return $this->filterManager->stripTags($data, array( + 'allowableTags' => $allowableTags, + 'escape' => $allowHtmlEntities + )); } /** @@ -886,7 +895,7 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ public function escapeUrl($data) { - return $this->helper('Magento\Core\Helper\Data')->escapeUrl($data); + return $this->_escaper->escapeUrl($data); } /** @@ -897,9 +906,9 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface * @param bool $addSlashes * @return string */ - public function quoteEscape($data, $addSlashes = false) + public function escapeQuote($data, $addSlashes = false) { - return $this->helper('Magento\Core\Helper\Data')->quoteEscape($data, $addSlashes); + return $this->_escaper->escapeQuote($data, $addSlashes); } /** @@ -909,9 +918,9 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface * @param string $quote * @return mixed */ - public function jsQuoteEscape($data, $quote = '\'') + public function escapeJsQuote($data, $quote = '\'') { - return $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape($data, $quote); + return $this->_escaper->escapeJsQuote($data, $quote); } /** diff --git a/app/code/Magento/Core/Block/Context.php b/app/code/Magento/Core/Block/Context.php index 693d2c7e56f53176fe70b42f445e924dfd7e6b45..5302aff7c4ab5049325a9fea1d0ab75eb04d5f1d 100644 --- a/app/code/Magento/Core/Block/Context.php +++ b/app/code/Magento/Core/Block/Context.php @@ -54,7 +54,7 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_translator; /** - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; @@ -101,7 +101,7 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_cacheState; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -110,13 +110,23 @@ class Context implements \Magento\ObjectManager\ContextInterface */ protected $_app; + /** + * @var \Magento\Escaper + */ + protected $_escaper; + + /** + * @var \Magento\Filter\FilterManager + */ + protected $_filterManager; + /** * @param \Magento\App\RequestInterface $request * @param \Magento\View\LayoutInterface $layout * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Core\Model\Translate $translator - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\View\DesignInterface $design * @param \Magento\Core\Model\Session\AbstractSession $session * @param \Magento\Core\Model\Store\Config $storeConfig @@ -125,8 +135,10 @@ class Context implements \Magento\ObjectManager\ContextInterface * @param \Magento\Core\Model\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\Core\Model\Cache\StateInterface $cacheState - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\App $app + * @param \Magento\Escaper $escaper + * @param \Magento\Filter\FilterManager $filterManager * @param array $data */ public function __construct( @@ -135,7 +147,7 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\Event\ManagerInterface $eventManager, \Magento\UrlInterface $urlBuilder, \Magento\Core\Model\Translate $translator, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\View\DesignInterface $design, \Magento\Core\Model\Session\AbstractSession $session, \Magento\Core\Model\Store\Config $storeConfig, @@ -144,8 +156,10 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\Core\Model\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\Core\Model\Cache\StateInterface $cacheState, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\App $app, + \Magento\Escaper $escaper, + \Magento\Filter\FilterManager $filterManager, array $data = array() ) { $this->_request = $request; @@ -164,10 +178,12 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_cacheState = $cacheState; $this->_logger = $logger; $this->_app = $app; + $this->_escaper = $escaper; + $this->_filterManager = $filterManager; } /** - * @return \Magento\Core\Model\CacheInterface + * @return \Magento\App\CacheInterface */ public function getCache() { @@ -279,7 +295,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\Logger + * @return \Magento\Logger */ public function getLogger() { @@ -293,4 +309,20 @@ class Context implements \Magento\ObjectManager\ContextInterface { return $this->_app; } + + /** + * @return \Magento\Escaper + */ + public function getEscaper() + { + return $this->_escaper; + } + + /** + * @return \Magento\Filter\FilterManager + */ + public function getFilterManager() + { + return $this->_filterManager; + } } diff --git a/app/code/Magento/Core/Block/Template.php b/app/code/Magento/Core/Block/Template.php index f067fcbb201264ff746c35b964c332bb90801f64..96ae28dd03466a2ce92fe3e506367d10d1072215 100644 --- a/app/code/Magento/Core/Block/Template.php +++ b/app/code/Magento/Core/Block/Template.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Block; /** * Base html block - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Block; - class Template extends \Magento\Core\Block\AbstractBlock { const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink'; @@ -67,11 +62,6 @@ class Template extends \Magento\Core\Block\AbstractBlock */ protected $_dirs; - /** - * @var \Magento\Core\Model\Logger - */ - protected $_logger; - /** * @var \Magento\Filesystem */ @@ -99,13 +89,18 @@ class Template extends \Magento\Core\Block\AbstractBlock * * @var \Magento\Core\Helper\Data */ - protected $_coreData = null; + protected $_coreData; /** * @var \Magento\Core\Model\App */ protected $_storeManager; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Block\Template\Context $context @@ -119,11 +114,11 @@ class Template extends \Magento\Core\Block\AbstractBlock ) { $this->_coreData = $coreData; $this->_dirs = $context->getDirs(); - $this->_logger = $context->getLogger(); $this->_filesystem = $context->getFilesystem(); $this->_viewFileSystem = $context->getViewFileSystem(); $this->_templateEngineFactory = $context->getEngineFactory(); $this->_storeManager = $context->getApp(); + $this->_appState = $context->getAppState(); parent::__construct($context, $data); } @@ -185,15 +180,13 @@ class Template extends \Magento\Core\Block\AbstractBlock /** * Get design area + * + * @deprecated * @return string */ public function getArea() { - $result = $this->_getData('area'); - if (!$result && $this->getLayout()) { - $result = $this->getLayout()->getArea(); - } - return $result; + return $this->_appState->getAreaCode(); } /** diff --git a/app/code/Magento/Core/Block/Template/Context.php b/app/code/Magento/Core/Block/Template/Context.php index 4e5852162c81302ff869037769ebad609beb4b1f..5c8565fe2de21cbcb9dfb281d41f34d034a7970b 100644 --- a/app/code/Magento/Core/Block/Template/Context.php +++ b/app/code/Magento/Core/Block/Template/Context.php @@ -21,7 +21,7 @@ class Context extends \Magento\Core\Block\Context /** * Logger instance * - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -42,13 +42,18 @@ class Context extends \Magento\Core\Block\Context */ protected $_engineFactory; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * @param \Magento\App\RequestInterface $request * @param \Magento\View\LayoutInterface $layout * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Core\Model\Translate $translator - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\View\DesignInterface $design * @param \Magento\Core\Model\Session $session * @param \Magento\Core\Model\Store\Config $storeConfig @@ -58,11 +63,14 @@ class Context extends \Magento\Core\Block\Context * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\Core\Model\Cache\StateInterface $cacheState * @param \Magento\App\Dir $dirs - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEngineFactory $engineFactory * @param \Magento\Core\Model\App $app + * @param \Magento\App\State $appState + * @param \Magento\Escaper $escaper + * @param \Magento\Filter\FilterManager $filterManager */ public function __construct( \Magento\App\RequestInterface $request, @@ -70,7 +78,7 @@ class Context extends \Magento\Core\Block\Context \Magento\Event\ManagerInterface $eventManager, \Magento\UrlInterface $urlBuilder, \Magento\Core\Model\Translate $translator, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\View\DesignInterface $design, \Magento\Core\Model\Session $session, \Magento\Core\Model\Store\Config $storeConfig, @@ -80,17 +88,37 @@ class Context extends \Magento\Core\Block\Context \Magento\View\ConfigInterface $viewConfig, \Magento\Core\Model\Cache\StateInterface $cacheState, \Magento\App\Dir $dirs, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Filesystem $filesystem, \Magento\Core\Model\View\FileSystem $viewFileSystem, \Magento\View\TemplateEngineFactory $engineFactory, - \Magento\Core\Model\App $app + \Magento\Core\Model\App $app, + \Magento\App\State $appState, + \Magento\Escaper $escaper, + \Magento\Filter\FilterManager $filterManager ) { parent::__construct( - $request, $layout, $eventManager, $urlBuilder, $translator, $cache, $design, $session, - $storeConfig, $frontController, $helperFactory, $viewUrl, $viewConfig, $cacheState, $logger, $app + $request, + $layout, + $eventManager, + $urlBuilder, + $translator, + $cache, + $design, + $session, + $storeConfig, + $frontController, + $helperFactory, + $viewUrl, + $viewConfig, + $cacheState, + $logger, + $app, + $escaper, + $filterManager ); + $this->_appState = $appState; $this->_dirs = $dirs; $this->_logger = $logger; $this->_filesystem = $filesystem; @@ -120,7 +148,7 @@ class Context extends \Magento\Core\Block\Context /** * Get logger instance * - * @return \Magento\Core\Model\Logger + * @return \Magento\Logger */ public function getLogger() { @@ -146,4 +174,14 @@ class Context extends \Magento\Core\Block\Context { return $this->_engineFactory; } + + /** + * Get app state object + * + * @return \Magento\App\State + */ + public function getAppState() + { + return $this->_appState; + } } diff --git a/app/code/Magento/Core/Controller/Front/Action.php b/app/code/Magento/Core/Controller/Front/Action.php index b3b3a8dad6ab2957327ffdcbb745854efbabeeca..6555ad323888214068347adeeb30d2d40c27580d 100644 --- a/app/code/Magento/Core/Controller/Front/Action.php +++ b/app/code/Magento/Core/Controller/Front/Action.php @@ -59,45 +59,4 @@ class Action extends \Magento\Core\Controller\Varien\Action } return $this; } - - /** - * Check if admin is logged in and authorized to access resource by specified ACL path - * - * If not authenticated, will try to do it using credentials from HTTP-request - * - * @param string $aclResource - * @param \Magento\Core\Model\Logger $logger - * @return bool - */ - public function authenticateAndAuthorizeAdmin($aclResource, $logger) - { - $this->_objectManager->get('Magento\Core\Model\App') - ->loadAreaPart(\Magento\Core\Model\App\Area::AREA_ADMINHTML, \Magento\Core\Model\App\Area::PART_CONFIG); - - /** @var $auth \Magento\Backend\Model\Auth */ - $auth = $this->_objectManager->create('Magento\Backend\Model\Auth'); - $session = $auth->getAuthStorage(); - - // Try to login using HTTP-authentication - if (!$session->isLoggedIn()) { - list($login, $password) = $this->_objectManager->get('Magento\Core\Helper\Http') - ->getHttpAuthCredentials($this->getRequest()); - try { - $auth->login($login, $password); - } catch (\Magento\Backend\Model\Auth\Exception $e) { - $logger->logException($e); - } - } - - // Verify if logged in and authorized - if (!$session->isLoggedIn() - || !$this->_objectManager->get('Magento\AuthorizationInterface')->isAllowed($aclResource)) { - $this->_objectManager->get('Magento\Core\Helper\Http') - ->failHttpAuthentication($this->getResponse(), 'RSS Feeds'); - $this->setFlag('', self::FLAG_NO_DISPATCH, true); - return false; - } - - return true; - } } diff --git a/app/code/Magento/Core/Controller/Varien/Action.php b/app/code/Magento/Core/Controller/Varien/Action.php index 98c72360509c6b9138b1bbf59f31a8f32912baf1..8d92cf3a721494d835d858c302b28d99f2327655 100644 --- a/app/code/Magento/Core/Controller/Varien/Action.php +++ b/app/code/Magento/Core/Controller/Varien/Action.php @@ -136,6 +136,11 @@ class Action extends \Magento\App\Action\AbstractAction */ protected $_isRenderInherited; + /** + * @var \Magento\HTTP\Authentication + */ + protected $authentication; + /** * @param \Magento\Core\Controller\Varien\Action\Context $context */ @@ -149,6 +154,7 @@ class Action extends \Magento\App\Action\AbstractAction $this->_eventManager = $context->getEventManager(); $this->_isRenderInherited = $context->isRenderInherited(); $this->_frontController->setAction($this); + $this->authentication = $context->getAuthentication(); $this->_construct(); } @@ -509,7 +515,7 @@ class Action extends \Magento\App\Action\AbstractAction $session->setSkipSessionIdFlag(true); } elseif ($checkCookie) { if (isset($_GET[$session->getSessionIdQueryParam()]) - && $this->_objectManager->get('Magento\Core\Model\App')->getUseSessionInUrl() + && $this->_objectManager->get('Magento\Core\Model\Url')->getUseSession() && $this->_sessionNamespace != \Magento\Backend\Controller\AbstractAction::SESSION_NAMESPACE ) { $session->setCookieShouldBeReceived(true); @@ -530,7 +536,8 @@ class Action extends \Magento\App\Action\AbstractAction protected function _initDesign() { $area = $this->_objectManager->get('Magento\Core\Model\App')->getArea($this->getLayout()->getArea()); - $area->load(); + $area->load(\Magento\Core\Model\App\Area::PART_DESIGN); + $area->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); $area->detectDesign($this->getRequest()); return $this; } @@ -552,14 +559,12 @@ class Action extends \Magento\App\Action\AbstractAction // Prohibit disabled store actions $storeManager = $this->_objectManager->get('Magento\Core\Model\StoreManager'); - if ($this->_objectManager->get('Magento\App\State') && !$storeManager->getStore()->getIsActive()) { + if ($this->_objectManager->get('Magento\App\State')->isInstalled() + && !$storeManager->getStore()->getIsActive() + ) { $this->_objectManager->get('Magento\Core\Model\StoreManager')->throwStoreException(); } - if ($this->_rewrite()) { - return; - } - // Start session $this->_startSession(); @@ -773,7 +778,7 @@ class Action extends \Magento\App\Action\AbstractAction /** @var $session \Magento\Core\Model\Session */ $session = $this->_objectManager->get('Magento\Core\Model\Session'); if ($session->getCookieShouldBeReceived() - && $this->_objectManager->get('Magento\Core\Model\App')->getUseSessionInUrl() + && $this->_objectManager->get('Magento\Core\Model\Url')->getUseSession() && $this->_sessionNamespace != \Magento\Backend\Controller\AbstractAction::SESSION_NAMESPACE ) { $arguments += array('_query' => array( @@ -895,65 +900,6 @@ class Action extends \Magento\App\Action\AbstractAction return false; } - /** - * Support for controllers rewrites - * - * Example of configuration: - * <global> - * <routers> - * <core_module> - * <rewrite> - * <core_controller> - * <to>new_route/new_controller</to> - * <override_actions>true</override_actions> - * <actions> - * <core_action><to>new_module/new_controller/new_action</core_action> - * </actions> - * <core_controller> - * </rewrite> - * </core_module> - * </routers> - * </global> - * - * This will override: - * 1. core_module/core_controller/core_action to new_module/new_controller/new_action - * 2. all other actions of core_module/core_controller to new_module/new_controller - * - * @return boolean true if rewrite happened - */ - protected function _rewrite() - { - $route = $this->getRequest()->getRouteName(); - $controller = $this->getRequest()->getControllerName(); - $action = $this->getRequest()->getActionName(); - - $rewrite = $this->_objectManager->get('Magento\Core\Model\Config')->getNode('global/routers/' . $route . '/rewrite/' . $controller); - if (!$rewrite) { - return false; - } - - if (!($rewrite->actions && $rewrite->actions->$action) || $rewrite->is('override_actions')) { - $rewriteTo = explode('/', (string)$rewrite->to); - if (sizeof($rewriteTo) !== 2 || empty($rewriteTo[0]) || empty($rewriteTo[1])) { - return false; - } - $rewriteTo[2] = $action; - } else { - $rewriteTo = explode('/', (string)$rewrite->actions->$action->to); - if (sizeof($rewriteTo) !== 3 || empty($rewriteTo[0]) || empty($rewriteTo[1]) || empty($rewriteTo[2])) { - return false; - } - } - - $this->_forward( - $rewriteTo[2] === '*' ? $action : $rewriteTo[2], - $rewriteTo[1] === '*' ? $controller : $rewriteTo[1], - $rewriteTo[0] === '*' ? $route : $rewriteTo[0] - ); - - return true; - } - /** * Validate Form Key * @@ -1027,7 +973,7 @@ class Action extends \Magento\App\Action\AbstractAction ->getDateFormat(\Magento\Core\Model\LocaleInterface::FORMAT_TYPE_SHORT) )); $filterInternal = new \Zend_Filter_NormalizedToLocalized(array( - 'date_format' => \Magento\Date::DATE_INTERNAL_FORMAT + 'date_format' => \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT )); foreach ($dateFields as $dateField) { @@ -1056,7 +1002,7 @@ class Action extends \Magento\App\Action\AbstractAction ->getDateTimeFormat(\Magento\Core\Model\LocaleInterface::FORMAT_TYPE_SHORT) )); $filterInternal = new \Zend_Filter_NormalizedToLocalized(array( - 'date_format' => \Magento\Date::DATETIME_INTERNAL_FORMAT + 'date_format' => \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT )); foreach ($dateFields as $dateField) { diff --git a/app/code/Magento/Core/Controller/Varien/Action/Context.php b/app/code/Magento/Core/Controller/Varien/Action/Context.php index 88139ce82fa452da41a8e844ac3aa53529127aff..e76f4ed68ad074983690f8e31d5d0d5c7d5fa985 100644 --- a/app/code/Magento/Core/Controller/Varien/Action/Context.php +++ b/app/code/Magento/Core/Controller/Varien/Action/Context.php @@ -65,28 +65,35 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_isRenderInherited; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** - * @param \Magento\Core\Model\Logger $logger + * @var \Magento\HTTP\Authentication + */ + protected $authentication; + + /** + * @param \Magento\Logger $logger * @param \Magento\App\RequestInterface $request * @param \Magento\App\ResponseInterface $response * @param \Magento\ObjectManager $objectManager * @param \Magento\App\FrontController $frontController * @param \Magento\View\LayoutInterface $layout * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\HTTP\Authentication $authentication * @param bool $isRenderInherited */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\App\RequestInterface $request, \Magento\App\ResponseInterface $response, \Magento\ObjectManager $objectManager, \Magento\App\FrontController $frontController, \Magento\View\LayoutInterface $layout, \Magento\Event\ManagerInterface $eventManager, + \Magento\HTTP\Authentication $authentication, $isRenderInherited ) { $this->_request = $request; @@ -97,6 +104,7 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_eventManager = $eventManager; $this->_isRenderInherited = $isRenderInherited; $this->_logger = $logger; + $this->authentication = $authentication; } /** @@ -158,10 +166,18 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\Logger + * @return \Magento\Logger */ public function getLogger() { return $this->_logger; } + + /** + * @return \Magento\HTTP\Authentication + */ + public function getAuthentication() + { + return $this->authentication; + } } diff --git a/app/code/Magento/Core/Controller/Varien/Router/Base.php b/app/code/Magento/Core/Controller/Varien/Router/Base.php deleted file mode 100644 index 711c65027c20b7ee5e340284965e5268b6825586..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Controller/Varien/Router/Base.php +++ /dev/null @@ -1,698 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Core\Controller\Varien\Router; - -use Magento\App\Router\AbstractRouter; - -class Base extends \Magento\App\Router\AbstractRouter -{ - /** - * @var array - */ - protected $_modules = array(); - - /** - * @var array - */ - protected $_dispatchData = array(); - - /** - * List of required request parameters - * Order sensitive - * @var array - */ - protected $_requiredParams = array( - 'moduleFrontName', - 'controllerName', - 'actionName', - ); - - /** - * Current router belongs to the area - * - * @var string - */ - protected $_areaCode; - - /** - * Unique router id - * - * @var string - */ - protected $_routerId; - - /** - * Base controller that belongs to area - * - * @var string - */ - protected $_baseController; - - /** - * @var \Magento\Core\Model\App - */ - protected $_app; - - /** - * @var \Magento\Core\Model\Route\Config - */ - protected $_routeConfig; - - /** - * @var array - */ - protected $_routes; - - /** - * Url security information. - * - * @var \Magento\Core\Model\Url\SecurityInfoInterface - */ - protected $_urlSecurityInfo; - - /** - * Core store config - * - * @var \Magento\Core\Model\Store\Config - */ - protected $_coreStoreConfig; - - /** - * Core config - * - * @var \Magento\Core\Model\Config - */ - protected $_config = null; - - /** - * @var \Magento\Core\Model\Url - */ - protected $_url; - - /** - * @var \Magento\Core\Model\StoreManager - */ - protected $_storeManager; - - /** - * @var \Magento\App\State - */ - protected $_appState; - - /** - * @param \Magento\App\ActionFactory $controllerFactory - * @param \Magento\Filesystem $filesystem - * @param \Magento\Core\Model\App $app - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Route\Config $routeConfig - * @param \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo - * @param \Magento\Core\Model\Config $config - * @param \Magento\Core\Model\Url $url - * @param \Magento\Core\Model\StoreManager $storeManager - * @param \Magento\App\State $appState - * @param string $areaCode - * @param string $baseController - * @param string $routerId - * @throws \InvalidArgumentException - */ - public function __construct( - \Magento\App\ActionFactory $controllerFactory, - \Magento\Filesystem $filesystem, - \Magento\Core\Model\App $app, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Route\Config $routeConfig, - \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo, - \Magento\Core\Model\Config $config, - \Magento\Core\Model\Url $url, - \Magento\Core\Model\StoreManager $storeManager, - \Magento\App\State $appState, - $areaCode, - $baseController, - $routerId - ) { - parent::__construct($controllerFactory); - - $this->_app = $app; - $this->_filesystem = $filesystem; - $this->_areaCode = $areaCode; - $this->_baseController = $baseController; - $this->_routeConfig = $routeConfig; - $this->_routerId = $routerId; - $this->_urlSecurityInfo = $urlSecurityInfo; - $this->_coreStoreConfig = $coreStoreConfig; - $this->_config = $config; - $this->_url = $url; - $this->_storeManager = $storeManager; - $this->_appState = $appState; - - if (is_null($this->_areaCode) || is_null($this->_baseController)) { - throw new \InvalidArgumentException("Not enough options to initialize router."); - } - } - - /** - * Get routes for router - * - * @return array - */ - protected function _getRoutes() - { - if (empty($this->_routes)) { - $this->_routes = $this->_routeConfig->getRoutes($this->_areaCode, $this->_routerId); - } - - return $this->_routes; - } - - /** - * Set default module/controller/action values - */ - public function fetchDefault() - { - $this->getFront()->setDefault(array( - 'module' => 'core', - 'controller' => 'index', - 'action' => 'index' - )); - } - - /** - * checking if this admin if yes then we don't use this router - * - * @return bool - */ - protected function _beforeModuleMatch() - { - if ($this->_app->getStore()->isAdmin()) { - return false; - } - return true; - } - - /** - * dummy call to pass through checking - * - * @return bool - */ - protected function _afterModuleMatch() - { - return true; - } - - /** - * Match provided request and if matched - return corresponding controller - * - * @param \Magento\App\RequestInterface $request - * @return \Magento\Core\Controller\Front\Action|null - */ - public function match(\Magento\App\RequestInterface $request) - { - //checking before even try to find out that current module - //should use this router - if (!$this->_beforeModuleMatch()) { - return null; - } - - $params = $this->_parseRequest($request); - - if (false == $this->_canProcess($params)) { - return null; - } - - return $this->_matchController($request, $params); - } - - /** - * Check if router can process provided request - * - * @param array $params - * @return bool - */ - protected function _canProcess(array $params) - { - return true; - } - - /** - * Parse request URL params - * - * @param \Magento\App\RequestInterface $request - * @return array - */ - protected function _parseRequest(\Magento\App\RequestInterface $request) - { - $output = array(); - - $path = trim($request->getPathInfo(), '/'); - - $params = explode('/', ($path ? $path : $this->_getDefaultPath())); - foreach ($this->_requiredParams as $paramName) { - $output[$paramName] = array_shift($params); - } - - for ($i = 0, $l = sizeof($params); $i < $l; $i += 2) { - $output['variables'][$params[$i]] = isset($params[$i+1]) ? urldecode($params[$i + 1]) : ''; - } - return $output; - } - - /** - * Match module front name - * - * @param \Magento\App\RequestInterface $request - * @param string $param - * @return string|null - */ - protected function _matchModuleFrontName(\Magento\App\RequestInterface $request, $param) - { - // get module name - if ($request->getModuleName()) { - $moduleFrontName = $request->getModuleName(); - } else { - if (!empty($param)) { - $moduleFrontName = $param; - } else { - $moduleFrontName = $this->getFront()->getDefault('module'); - $request->setAlias(\Magento\Core\Model\Url\Rewrite::REWRITE_REQUEST_PATH_ALIAS, ''); - } - } - if (!$moduleFrontName) { - return null; - } - return $moduleFrontName; - } - - /** - * Match controller name - * - * @param \Magento\App\RequestInterface $request - * @param string $param - * @return string - */ - protected function _matchControllerName(\Magento\App\RequestInterface $request, $param) - { - if ($request->getControllerName()) { - $controller = $request->getControllerName(); - } else { - if (!empty($param)) { - $controller = $param; - } else { - $controller = $this->getFront()->getDefault('controller'); - $request->setAlias( - \Magento\Core\Model\Url\Rewrite::REWRITE_REQUEST_PATH_ALIAS, - ltrim($request->getOriginalPathInfo(), '/') - ); - } - } - return $controller; - } - - /** - * Match controller name - * - * @param \Magento\App\RequestInterface $request - * @param string $param - * @return string - */ - protected function _matchActionName(\Magento\App\RequestInterface $request, $param) - { - if (empty($action)) { - if ($request->getActionName()) { - $action = $request->getActionName(); - } else { - $action = !empty($param) ? $param : $this->getFront()->getDefault('action'); - } - } else { - $action = $param; - } - - return $action; - } - - /** - * Get not found controller instance - * - * @param $currentModuleName - * @param \Magento\App\RequestInterface $request - * @return \Magento\Core\Controller\Varien\Action|null - */ - protected function _getNotFoundControllerInstance($currentModuleName, \Magento\App\RequestInterface $request) - { - $controllerInstance = null; - - if ($this->_noRouteShouldBeApplied()) { - $controller = 'index'; - $action = 'noroute'; - - $controllerClassName = $this->_validateControllerClassName($currentModuleName, $controller); - if (false == $controllerClassName) { - return null; - } - - if (false == $this->_validateControllerAction($controllerClassName, $action)) { - return null; - } - - // instantiate controller class - $controllerInstance = $this->_controllerFactory->createController($controllerClassName, - array('request' => $request, 'areaCode' => $this->_areaCode) - ); - } else { - return null; - } - - return $controllerInstance; - } - - /** - * Check whether action handler exists for provided handler - * - * @param string $controllerClassName - * @param string $action - * @return bool - */ - protected function _validateControllerAction($controllerClassName, $action) - { - return method_exists($controllerClassName, $action . 'Action'); - } - - /** - * Create matched controller instance - * - * @param \Magento\App\RequestInterface $request - * @param array $params - * @return \Magento\Core\Controller\Front\Action|null - */ - protected function _matchController(\Magento\App\RequestInterface $request, array $params) - { - $this->fetchDefault(); - - $moduleFrontName = $this->_matchModuleFrontName($request, $params['moduleFrontName']); - if (empty($moduleFrontName)) { - return null; - } - - /** - * Searching router args by module name from route using it as key - */ - $modules = $this->getModulesByFrontName($moduleFrontName); - - if (empty($modules) === true) { - return null; - } - - // checks after we found out that this router should be used for current module - if (!$this->_afterModuleMatch()) { - return null; - } - - /** - * Going through modules to find appropriate controller - */ - $found = false; - $currentModuleName = null; - $controller = null; - $action = null; - $controllerInstance = null; - - foreach ($modules as $moduleName) { - $currentModuleName = $moduleName; - - $request->setRouteName($this->getRouteByFrontName($moduleFrontName)); - - $controller = $this->_matchControllerName($request, $params['controllerName']); - - $action = $this->_matchActionName($request, $params['actionName']); - - //checking if this place should be secure - $this->_checkShouldBeSecure($request, '/' . $moduleFrontName . '/' . $controller . '/' . $action); - - $controllerClassName = $this->_validateControllerClassName($moduleName, $controller); - if (false == $controllerClassName) { - continue; - } - - if (false === $this->_validateControllerAction($controllerClassName, $action)) { - continue; - } - - // instantiate controller class - $controllerInstance = $this->_controllerFactory->createController($controllerClassName, - array('request' => $request) - ); - - $found = true; - break; - } - - /** - * if we did not found any suitable - */ - if (false == $found) { - $controllerInstance = $this->_getNotFoundControllerInstance($currentModuleName, $request); - if (is_null($controllerInstance)) { - return null; - } - } - - // set values only after all the checks are done - $request->setModuleName($moduleFrontName); - $request->setControllerName($controller); - $request->setActionName($action); - $request->setControllerModule($currentModuleName); - if (isset($params['variables'])) { - $request->setParams($params['variables']); - } - return $controllerInstance; - } - - /** - * Get router default request path - * @return string - */ - protected function _getDefaultPath() - { - return $this->_coreStoreConfig->getConfig('web/default/front'); - } - - /** - * Allow to control if we need to enable no route functionality in current router - * - * @return bool - */ - protected function _noRouteShouldBeApplied() - { - return false; - } - - /** - * Generating and validating class file name, - * class and if everything ok do include if needed and return of class name - * - * @param $realModule - * @param $controller - * @return bool|string - */ - protected function _validateControllerClassName($realModule, $controller) - { - $controllerClassName = $this->getControllerClassName($realModule, $controller); - if (!$controllerClassName) { - return false; - } - - return $controllerClassName; - } - - /** - * Include the file containing controller class if this class is not defined yet - * - * @param $controllerFileName - * @param $controllerClassName - * @return bool - * @throws \Magento\Core\Exception - */ - protected function _includeControllerClass($controllerFileName, $controllerClassName) - { - if (!class_exists($controllerClassName, false)) { - if (!$this->_filesystem->isFile($controllerFileName)) { - return false; - } - include $controllerFileName; - - if (!class_exists($controllerClassName, false)) { - throw new \Magento\Core\Exception(__('Controller file was loaded but class does not exist')); - } - } - return true; - } - - /** - * Retrieve list of modules subscribed to given frontName - * - * @param string $frontName - * @return array - */ - public function getModulesByFrontName($frontName) - { - $modules = array(); - - $routes = $this->_getRoutes(); - foreach ($routes as $routeData) { - if ($routeData['frontName'] == $frontName && isset($routeData['modules'])) { - $modules = $routeData['modules']; - break; - } - } - - return array_unique($modules); - } - - /** - * Get route frontName by id - * @param string $routeId - * @return string - */ - public function getFrontNameByRoute($routeId) - { - $routes = $this->_getRoutes(); - if (isset($routes[$routeId])) { - return $routes[$routeId]['frontName']; - } - - return false; - } - - /** - * Get route Id by route frontName - * - * @param string $frontName - * @return string - */ - public function getRouteByFrontName($frontName) - { - foreach ($this->_getRoutes() as $routeId => $routeData) { - if ($routeData['frontName'] == $frontName) { - return $routeId; - } - } - - return false; - } - - public function getControllerClassName($realModule, $controller) - { - $class = str_replace('_', \Magento\Autoload\IncludePath::NS_SEPARATOR, $realModule) . - \Magento\Autoload\IncludePath::NS_SEPARATOR . 'Controller' . - \Magento\Autoload\IncludePath::NS_SEPARATOR . - str_replace('_','\\', uc_words(str_replace('_', ' ', $controller))); - return $class; - } - - public function rewrite(array $p) - { - $rewrite = $this->_config->getNode('global/rewrite'); - if ($module = $rewrite->{$p[0]}) { - if (!$module->children()) { - $p[0] = trim((string)$module); - } - } - if (isset($p[1]) && ($controller = $rewrite->{$p[0]}->{$p[1]})) { - if (!$controller->children()) { - $p[1] = trim((string)$controller); - } - } - if (isset($p[2]) && ($action = $rewrite->{$p[0]}->{$p[1]}->{$p[2]})) { - if (!$action->children()) { - $p[2] = trim((string)$action); - } - } - - return $p; - } - - /** - * Check that request uses https protocol if it should. - * Function redirects user to correct URL if needed. - * - * @param \Magento\App\RequestInterface $request - * @param string $path - * @return void - */ - protected function _checkShouldBeSecure(\Magento\App\RequestInterface $request, $path = '') - { - if (!$this->_appState->isInstalled() || $request->getPost()) { - return; - } - - if ($this->_shouldBeSecure($path) && !$request->isSecure()) { - $url = $this->_getCurrentSecureUrl($request); - if ($this->_shouldRedirectToSecure()) { - $url = $this->_url->getRedirectUrl($url); - } - - $this->_app->getFrontController()->getResponse() - ->setRedirect($url) - ->sendResponse(); - exit; - } - } - - /** - * Check whether redirect url should be used for secure routes - * - * @return bool - */ - protected function _shouldRedirectToSecure() - { - return $this->_app->getUseSessionInUrl(); - } - - protected function _getCurrentSecureUrl($request) - { - $alias = $request->getAlias(\Magento\Core\Model\Url\Rewrite::REWRITE_REQUEST_PATH_ALIAS); - if ($alias) { - return $this->_storeManager->getStore()->getBaseUrl('link', true) . ltrim($alias, '/'); - } - - return $this->_storeManager->getStore()->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/'); - } - - /** - * Check whether given path should be secure according to configuration security requirements for URL - * "Secure" should not be confused with https protocol, it is about web/secure/*_url settings usage only - * - * @param string $path - * @return bool - */ - protected function _shouldBeSecure($path) - { - return substr($this->_coreStoreConfig->getConfig('web/unsecure/base_url'), 0, 5) === 'https' - || $this->_coreStoreConfig->getConfigFlag('web/secure/use_in_frontend') - && substr($this->_coreStoreConfig->getConfig('web/secure/base_url'), 0, 5) == 'https' - && $this->_urlSecurityInfo->isSecure($path); - } -} diff --git a/app/code/Magento/Core/Helper/AbstractHelper.php b/app/code/Magento/Core/Helper/AbstractHelper.php index 653106641536f0b68e8c626231d46e9d96849c1d..3952405aa7d5c13cef33869254c4b7031dc910f0 100644 --- a/app/code/Magento/Core/Helper/AbstractHelper.php +++ b/app/code/Magento/Core/Helper/AbstractHelper.php @@ -60,7 +60,7 @@ abstract class AbstractHelper private $_moduleManager; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -74,6 +74,11 @@ abstract class AbstractHelper */ protected $_urlBuilder; + /** + * @var \Magento\HTTP\Header + */ + protected $_httpHeader; + /** * @param \Magento\Core\Helper\Context $context */ @@ -85,6 +90,7 @@ abstract class AbstractHelper $this->_request = $context->getRequest(); $this->_app = $context->getApp(); $this->_urlBuilder = $context->getUrlBuilder(); + $this->_httpHeader = $context->getHttpHeader(); } /** @@ -191,114 +197,6 @@ abstract class AbstractHelper return $this->_moduleManager->isEnabled($moduleName); } - /** - * Escape html entities - * - * @param string|array $data - * @param array $allowedTags - * @return mixed - */ - public function escapeHtml($data, $allowedTags = null) - { - if (is_array($data)) { - $result = array(); - foreach ($data as $item) { - $result[] = $this->escapeHtml($item); - } - } else { - // process single item - if (strlen($data)) { - if (is_array($allowedTags) and !empty($allowedTags)) { - $allowed = implode('|', $allowedTags); - $result = preg_replace('/<([\/\s\r\n]*)(' . $allowed . ')([\/\s\r\n]*)>/si', '##$1$2$3##', $data); - $result = htmlspecialchars($result, ENT_COMPAT, 'UTF-8', false); - $result = preg_replace('/##([\/\s\r\n]*)(' . $allowed . ')([\/\s\r\n]*)##/si', '<$1$2$3>', $result); - } else { - $result = htmlspecialchars($data, ENT_COMPAT, 'UTF-8', false); - } - } else { - $result = $data; - } - } - return $result; - } - - /** - * Remove html tags, but leave "<" and ">" signs - * - * @param string $html - * @return string - */ - public function removeTags($html) - { - $callback = function ($matches) { - return htmlentities($matches[0]); - }; - $html = preg_replace_callback("# <(?![/a-z]) | (?<=\s)>(?![a-z]) #xi", $callback, $html); - $html = strip_tags($html); - return htmlspecialchars_decode($html); - } - - /** - * Wrapper for standard strip_tags() function with extra functionality for html entities - * - * @param string $data - * @param string $allowableTags - * @param bool $escape - * @return string - */ - public function stripTags($data, $allowableTags = null, $escape = false) - { - $result = strip_tags($data, $allowableTags); - return $escape ? $this->escapeHtml($result, $allowableTags) : $result; - } - - /** - * Escape html entities in url - * - * @param string $data - * @return string - */ - public function escapeUrl($data) - { - return htmlspecialchars($data); - } - - /** - * Escape quotes in java script - * - * @param mixed $data - * @param string $quote - * @return mixed - */ - public function jsQuoteEscape($data, $quote = '\'') - { - if (is_array($data)) { - $result = array(); - foreach ($data as $item) { - $result[] = str_replace($quote, '\\' . $quote, $item); - } - return $result; - } - return str_replace($quote, '\\' . $quote, $data); - } - - /** - * Escape quotes inside html attributes - * Use $addSlashes = false for escaping js that inside html attribute (onClick, onSubmit etc) - * - * @param string $data - * @param bool $addSlashes - * @return string - */ - public function quoteEscape($data, $addSlashes = false) - { - if ($addSlashes === true) { - $data = addslashes($data); - } - return htmlspecialchars($data, ENT_QUOTES, null, false); - } - /** * Retrieve url * diff --git a/app/code/Magento/Core/Helper/Context.php b/app/code/Magento/Core/Helper/Context.php index 690b01f85e5da578511d1ad3fa9712731f5cff63..f7d892d63450133adb26ffb35a8681300d0ceec2 100644 --- a/app/code/Magento/Core/Helper/Context.php +++ b/app/code/Magento/Core/Helper/Context.php @@ -43,7 +43,7 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_eventManager; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -57,11 +57,6 @@ class Context implements \Magento\ObjectManager\ContextInterface */ protected $_cacheConfig; - /** - * @var \Magento\Core\Model\EncryptionFactory - */ - protected $_encryptorFactory; - /** * @var \Magento\Core\Model\Fieldset\Config */ @@ -78,39 +73,52 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_urlBuilder; /** - * @param \Magento\Core\Model\Logger $logger + * @var \Magento\HTTP\Header + */ + protected $_httpHeader; + + /** + * @var \Magento\HTTP\PhpEnvironment\RemoteAddress + */ + protected $_remoteAddress; + + /** + * @param \Magento\Logger $logger * @param \Magento\Core\Model\Translate $translator * @param \Magento\Core\Model\ModuleManager $moduleManager * @param \Magento\App\RequestInterface $httpRequest * @param \Magento\Core\Model\Cache\Config $cacheConfig - * @param \Magento\Core\Model\EncryptionFactory $encryptorFactory * @param \Magento\Core\Model\Fieldset\Config $fieldsetConfig * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\App $app * @param \Magento\UrlInterface $urlBuilder + * @param \Magento\HTTP\Header $httpHeader + * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\Translate $translator, \Magento\Core\Model\ModuleManager $moduleManager, \Magento\App\RequestInterface $httpRequest, \Magento\Core\Model\Cache\Config $cacheConfig, - \Magento\Core\Model\EncryptionFactory $encryptorFactory, \Magento\Core\Model\Fieldset\Config $fieldsetConfig, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\App $app, - \Magento\UrlInterface $urlBuilder + \Magento\UrlInterface $urlBuilder, + \Magento\HTTP\Header $httpHeader, + \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress ) { $this->_translator = $translator; $this->_moduleManager = $moduleManager; $this->_httpRequest = $httpRequest; $this->_cacheConfig = $cacheConfig; - $this->_encryptorFactory = $encryptorFactory; $this->_fieldsetConfig = $fieldsetConfig; $this->_eventManager = $eventManager; $this->_logger = $logger; $this->_app = $app; $this->_urlBuilder = $urlBuilder; + $this->_httpHeader = $httpHeader; + $this->_remoteAddress = $remoteAddress; } /** @@ -161,14 +169,6 @@ class Context implements \Magento\ObjectManager\ContextInterface return $this->_cacheConfig; } - /** - * @return \Magento\Core\Model\EncryptionFactory - */ - public function getEncryptorFactory() - { - return $this->_encryptorFactory; - } - /** * @return \Magento\Event\ManagerInterface */ @@ -186,10 +186,26 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\Logger + * @return \Magento\Logger */ public function getLogger() { return $this->_logger; } + + /** + * @return \Magento\HTTP\Header + */ + public function getHttpHeader() + { + return $this->_httpHeader; + } + + /** + * @return \Magento\HTTP\PhpEnvironment\RemoteAddress + */ + public function getRemoteAddress() + { + return $this->_remoteAddress; + } } diff --git a/app/code/Magento/Core/Helper/Data.php b/app/code/Magento/Core/Helper/Data.php index 1f1a6591cdab3b128b8ac0d4d7a643e74449b49e..e7d9ef9eada0f11eaa167ba3893c999c00cc4729 100644 --- a/app/code/Magento/Core/Helper/Data.php +++ b/app/code/Magento/Core/Helper/Data.php @@ -24,37 +24,17 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Helper; + /** * Core data helper - * - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Helper; - class Data extends \Magento\Core\Helper\AbstractHelper { const XML_PATH_DEFAULT_COUNTRY = 'general/country/default'; - const XML_PATH_PROTECTED_FILE_EXTENSIONS = 'general/file/protected_extensions'; - const XML_PATH_PUBLIC_FILES_VALID_PATHS = 'general/file/public_files_valid_paths'; const XML_PATH_DEV_ALLOW_IPS = 'dev/restrict/allow_ips'; const XML_PATH_CONNECTION_TYPE = 'global/resources/default_setup/connection/type'; - const CHARS_LOWERS = 'abcdefghijklmnopqrstuvwxyz'; - const CHARS_UPPERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - const CHARS_DIGITS = '0123456789'; - const CHARS_SPECIALS = '!$*+-.=?@^_|~'; - const CHARS_PASSWORD_LOWERS = 'abcdefghjkmnpqrstuvwxyz'; - const CHARS_PASSWORD_UPPERS = 'ABCDEFGHJKLMNPQRSTUVWXYZ'; - const CHARS_PASSWORD_DIGITS = '23456789'; - const CHARS_PASSWORD_SPECIALS = '!$*-.=?@_'; - - /** - * Config pathes to merchant country code and merchant VAT number - */ - const XML_PATH_MERCHANT_COUNTRY_CODE = 'general/store_information/country_id'; - const XML_PATH_MERCHANT_VAT_NUMBER = 'general/store_information/merchant_vat_number'; - const XML_PATH_EU_COUNTRIES_LIST = 'general/country/eu_countries'; - const XML_PATH_SINGLE_STORE_MODE_ENABLED = 'general/single_store_mode/enabled'; /** @@ -67,11 +47,6 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ const XML_PATH_SYSTEM_SMTP_DISABLE = 'system/smtp/disable'; - /** - * @var \Magento\Core\Model\Encryption - */ - protected $_encryptor; - protected $_allowedFormats = array( \Magento\Core\Model\LocaleInterface::FORMAT_TYPE_FULL, \Magento\Core\Model\LocaleInterface::FORMAT_TYPE_LONG, @@ -79,18 +54,6 @@ class Data extends \Magento\Core\Helper\AbstractHelper \Magento\Core\Model\LocaleInterface::FORMAT_TYPE_SHORT ); - /** - * @var \Magento\Core\Model\Config - */ - protected $_config; - - /** - * Core http - * - * @var \Magento\Core\Helper\Http - */ - protected $_coreHttp = null; - /** * Core event manager proxy * @@ -103,11 +66,6 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ protected $_cacheConfig; - /** - * @var \Magento\Core\Model\EncryptionFactory - */ - protected $_encryptorFactory; - /** * @var \Magento\Core\Model\Fieldset\Config */ @@ -146,56 +104,43 @@ class Data extends \Magento\Core\Helper\AbstractHelper protected $_dbCompatibleMode; /** - * @param \Magento\Core\Helper\Context $context + * @var \Magento\HTTP\PhpEnvironment\RemoteAddress + */ + protected $_remoteAddress; + + /** + * @param Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor * @param bool $dbCompatibleMode */ public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, $dbCompatibleMode = true ) { $this->_eventManager = $eventManager; - $this->_coreHttp = $coreHttp; $this->_coreStoreConfig = $coreStoreConfig; + $this->_remoteAddress = $context->getRemoteAddress(); parent::__construct($context); - $this->_config = $config; $this->_cacheConfig = $context->getCacheConfig(); - $this->_encryptorFactory = $context->getEncryptorFactory(); $this->_fieldsetConfig = $context->getFieldsetConfig(); $this->_storeManager = $storeManager; $this->_locale = $locale; $this->_dateModel = $dateModel; $this->_appState = $appState; - $this->_encryptor = $encryptor; - $this->_encryptor->setHelper($this); $this->_dbCompatibleMode = $dbCompatibleMode; } - /** - * @return \Magento\Core\Model\Encryption - */ - public function getEncryptor() - { - return $this->_encryptor; - } - /** * Convert and format price value for current application store * @@ -266,8 +211,11 @@ class Data extends \Magento\Core\Helper\AbstractHelper * @param bool $showTime Whether to include time * @return string */ - public function formatDate($date = null, $format = \Magento\Core\Model\LocaleInterface::FORMAT_TYPE_SHORT, $showTime = false) - { + public function formatDate( + $date = null, + $format = \Magento\Core\Model\LocaleInterface::FORMAT_TYPE_SHORT, + $showTime = false + ) { if (!in_array($format, $this->_allowedFormats, true)) { return $date; } @@ -301,8 +249,11 @@ class Data extends \Magento\Core\Helper\AbstractHelper * @param bool $showDate * @return string */ - public function formatTime($time = null, $format = \Magento\Core\Model\LocaleInterface::FORMAT_TYPE_SHORT, $showDate = false) - { + public function formatTime( + $time = null, + $format = \Magento\Core\Model\LocaleInterface::FORMAT_TYPE_SHORT, + $showDate = false + ) { if (!in_array($format, $this->_allowedFormats, true)) { return $time; } @@ -325,148 +276,19 @@ class Data extends \Magento\Core\Helper\AbstractHelper } /** - * Encrypt data using application key - * - * @param string $data - * @return string - */ - public function encrypt($data) - { - if (!$this->_appState->isInstalled()) { - return $data; - } - return $this->getEncryptor()->encrypt($data); - } - - /** - * Decrypt data using application key - * - * @param string $data - * @return string - */ - public function decrypt($data) - { - if (!$this->_appState->isInstalled()) { - return $data; - } - return $this->getEncryptor()->decrypt($data); - } - - public function validateKey($key) - { - return $this->getEncryptor()->validateKey($key); - } - - public function getRandomString($len, $chars = null) - { - if (is_null($chars)) { - $chars = self::CHARS_LOWERS . self::CHARS_UPPERS . self::CHARS_DIGITS; - } - mt_srand(10000000*(double)microtime()); - for ($i = 0, $str = '', $lc = strlen($chars)-1; $i < $len; $i++) { - $str .= $chars[mt_rand(0, $lc)]; - } - return $str; - } - - /** - * Generate salted hash from password - * - * @param string $password - * @param string|integer|boolean $salt - * @return string - */ - public function getHash($password, $salt = false) - { - return $this->getEncryptor()->getHash($password, $salt); - } - - public function validateHash($password, $hash) - { - return $this->getEncryptor()->validateHash($password, $hash); - } - - /** - * Retrieve store identifier - * - * @param mixed $store - * @return int - */ - public function getStoreId($store=null) - { - return $this->_storeManager->getStore($store)->getId(); - } - - /** - * Remove accents - * - * @param string $string - * @param bool $german - * @return string + * @param null $storeId + * @return bool */ - public function removeAccents($string, $german = false) - { - static $replacements; - - if (empty($replacements[$german])) { - $substitutions = array( - // single ISO-8859-1 letters - 192 => 'A', 193 => 'A', 194 => 'A', 195 => 'A', 196 => 'A', 197 => 'A', 199 => 'C', - 208 => 'D', 200 => 'E', 201 => 'E', 202 => 'E', 203 => 'E', 204 => 'I', 205 => 'I', - 206 => 'I', 207 => 'I', 209 => 'N', 210 => 'O', 211 => 'O', 212 => 'O', 213 => 'O', - 214 => 'O', 216 => 'O', 138 => 'S', 217 => 'U', 218 => 'U', 219 => 'U', 220 => 'U', - 221 => 'Y', 142 => 'Z', 224 => 'a', 225 => 'a', 226 => 'a', 227 => 'a', 228 => 'a', - 229 => 'a', 231 => 'c', 232 => 'e', 233 => 'e', 234 => 'e', 235 => 'e', 236 => 'i', - 237 => 'i', 238 => 'i', 239 => 'i', 241 => 'n', 240 => 'o', 242 => 'o', 243 => 'o', - 244 => 'o', 245 => 'o', 246 => 'o', 248 => 'o', 154 => 's', 249 => 'u', 250 => 'u', - 251 => 'u', 252 => 'u', 253 => 'y', 255 => 'y', 158 => 'z', - // HTML entities - 258 => 'A', 260 => 'A', 262 => 'C', 268 => 'C', 270 => 'D', 272 => 'D', 280 => 'E', - 282 => 'E', 286 => 'G', 304 => 'I', 313 => 'L', 317 => 'L', 321 => 'L', 323 => 'N', - 327 => 'N', 336 => 'O', 340 => 'R', 344 => 'R', 346 => 'S', 350 => 'S', 354 => 'T', - 356 => 'T', 366 => 'U', 368 => 'U', 377 => 'Z', 379 => 'Z', 259 => 'a', 261 => 'a', - 263 => 'c', 269 => 'c', 271 => 'd', 273 => 'd', 281 => 'e', 283 => 'e', 287 => 'g', - 305 => 'i', 322 => 'l', 314 => 'l', 318 => 'l', 324 => 'n', 328 => 'n', 337 => 'o', - 341 => 'r', 345 => 'r', 347 => 's', 351 => 's', 357 => 't', 355 => 't', 367 => 'u', - 369 => 'u', 378 => 'z', 380 => 'z', - // ligatures - 198 => 'Ae', 230 => 'ae', 140 => 'Oe', 156 => 'oe', 223 => 'ss', - ); - - if ($german) { - // umlauts - $germanReplacements = array( - 196 => 'Ae', 228 => 'ae', 214 => 'Oe', 246 => 'oe', 220 => 'Ue', 252 => 'ue' - ); - $substitutions = $germanReplacements + $substitutions; - } - - $replacements[$german] = array(); - foreach ($substitutions as $code => $value) { - $replacements[$german][$code < 256 ? chr($code) : '&#' . $code . ';'] = $value; - } - } - - // convert string from default database format (UTF-8) - // to encoding which replacement arrays made with (ISO-8859-1) - if ($convertedString = @iconv('UTF-8', 'ISO-8859-1', $string)) { - $string = $convertedString; - } - // Replace - $string = strtr($string, $replacements[$german]); - return $string; - } - public function isDevAllowed($storeId = null) { $allow = true; $allowedIps = $this->_coreStoreConfig->getConfig(self::XML_PATH_DEV_ALLOW_IPS, $storeId); - $remoteAddr = $this->_coreHttp->getRemoteAddr(); + $remoteAddr = $this->_remoteAddress->getRemoteAddress(); if (!empty($allowedIps) && !empty($remoteAddr)) { $allowedIps = preg_split('#\s*,\s*#', $allowedIps, null, PREG_SPLIT_NO_EMPTY); if (array_search($remoteAddr, $allowedIps) === false - && array_search($this->_coreHttp->getHttpHost(), $allowedIps) === false) { + && array_search($this->_httpHeader->getHttpHost(), $allowedIps) === false) { $allow = false; } } @@ -649,101 +471,6 @@ class Data extends \Magento\Core\Helper\AbstractHelper } } - /** - * Transform an assoc array to \SimpleXMLElement object - * Array has some limitations. Appropriate exceptions will be thrown - * - * @param array $array - * @param string $rootName - * @return \SimpleXMLElement - * @throws \Magento\Exception - */ - public function assocToXml(array $array, $rootName = '_') - { - if (empty($rootName) || is_numeric($rootName)) { - throw new \Magento\Exception('Root element must not be empty or numeric'); - } - - $xmlstr = <<<XML -<?xml version='1.0' encoding='UTF-8' standalone='yes'?> -<$rootName></$rootName> -XML; - $xml = new \SimpleXMLElement($xmlstr); - foreach ($array as $key => $value) { - if (is_numeric($key)) { - throw new \Magento\Exception('Array root keys must not be numeric.'); - } - } - return self::_assocToXml($array, $rootName, $xml); - } - - /** - * Function, that actually recursively transforms array to xml - * - * @param array $array - * @param string $rootName - * @param \SimpleXMLElement $xml - * @return \SimpleXMLElement - * @throws \Magento\Exception - */ - private function _assocToXml(array $array, $rootName, \SimpleXMLElement &$xml) - { - $hasNumericKey = false; - $hasStringKey = false; - foreach ($array as $key => $value) { - if (!is_array($value)) { - if (is_string($key)) { - if ($key === $rootName) { - throw new \Magento\Exception( - 'Associative key must not be the same as its parent associative key.' - ); - } - $hasStringKey = true; - $xml->$key = $value; - } elseif (is_int($key)) { - $hasNumericKey = true; - $xml->{$rootName}[$key] = $value; - } - } else { - self::_assocToXml($value, $key, $xml->$key); - } - } - if ($hasNumericKey && $hasStringKey) { - throw new \Magento\Exception('Associative and numeric keys must not be mixed at one level.'); - } - return $xml; - } - - /** - * Transform \SimpleXMLElement to associative array - * \SimpleXMLElement must be conform structure, generated by assocToXml() - * - * @param \SimpleXMLElement $xml - * @return array - */ - public function xmlToAssoc(\SimpleXMLElement $xml) - { - $array = array(); - foreach ($xml as $key => $value) { - if (isset($value->$key)) { - $i = 0; - foreach ($value->$key as $v) { - $array[$key][$i++] = (string)$v; - } - } else { - // try to transform it into string value, trimming spaces between elements - $array[$key] = trim((string)$value); - if (empty($array[$key]) && !empty($value)) { - $array[$key] = self::xmlToAssoc($value); - } else { - // untrim strings values - $array[$key] = (string)$value; - } - } - } - return $array; - } - /** * Encode the mixed $valueToEncode into the JSON format * @@ -775,17 +502,6 @@ XML; return \Zend_Json::decode($encodedValue, $objectDecodeType); } - /** - * Generate a hash from unique ID - * - * @param string $prefix - * @return string - */ - public function uniqHash($prefix = '') - { - return $prefix . md5(uniqid(microtime() . mt_rand(), true)); - } - /** * Return default country code * @@ -797,42 +513,6 @@ XML; return $this->_coreStoreConfig->getConfig(self::XML_PATH_DEFAULT_COUNTRY, $store); } - /** - * Return list with protected file extensions - * - * @param \Magento\Core\Model\Store|string|int $store - * @return array - */ - public function getProtectedFileExtensions($store = null) - { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_PROTECTED_FILE_EXTENSIONS, $store); - } - - /** - * Return list with public files valid paths - * - * @return array - */ - public function getPublicFilesValidPath() - { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_PUBLIC_FILES_VALID_PATHS); - } - - /** - * Check LFI protection - * - * @throws \Magento\Core\Exception - * @param string $name - * @return bool - */ - public function checkLfiProtection($name) - { - if (preg_match('#\.\.[\\\/]#', $name)) { - throw new \Magento\Core\Exception(__('Requested file may not include parent directory traversal ("../", "..\\" notation)')); - } - return true; - } - /** * Check whether database compatible mode is used (configs enable it for MySQL by default). * @@ -843,60 +523,6 @@ XML; return $this->_dbCompatibleMode; } - /** - * Retrieve merchant country code - * - * @param \Magento\Core\Model\Store|string|int|null $store - * @return string - */ - public function getMerchantCountryCode($store = null) - { - return (string) $this->_coreStoreConfig->getConfig(self::XML_PATH_MERCHANT_COUNTRY_CODE, $store); - } - - /** - * Retrieve merchant VAT number - * - * @param \Magento\Core\Model\Store|string|int|null $store - * @return string - */ - public function getMerchantVatNumber($store = null) - { - return (string) $this->_coreStoreConfig->getConfig(self::XML_PATH_MERCHANT_VAT_NUMBER, $store); - } - - /** - * Check whether specified country is in EU countries list - * - * @param string $countryCode - * @param null|int $storeId - * @return bool - */ - public function isCountryInEU($countryCode, $storeId = null) - { - $euCountries = explode(',', $this->_coreStoreConfig->getConfig(self::XML_PATH_EU_COUNTRIES_LIST, $storeId)); - return in_array($countryCode, $euCountries); - } - - /** - * Returns the floating point remainder (modulo) of the division of the arguments - * - * @param float|int $dividend - * @param float|int $divisor - * @return float|int - */ - public function getExactDivision($dividend, $divisor) - { - $epsilon = $divisor / self::DIVIDE_EPSILON; - - $remainder = fmod($dividend, $divisor); - if (abs($remainder - $divisor) < $epsilon || abs($remainder) < $epsilon) { - $remainder = 0; - } - - return $remainder; - } - /** * Check if Single-Store mode is enabled in configuration * diff --git a/app/code/Magento/Core/Model/File/Storage/AbstractStorage.php b/app/code/Magento/Core/Helper/File/Media.php similarity index 52% rename from app/code/Magento/Core/Model/File/Storage/AbstractStorage.php rename to app/code/Magento/Core/Helper/File/Media.php index c05a8e90d573b932d92987c01a444150e4374766..9518ad1ac7818b059be7f96fa9092b6c739b76d9 100644 --- a/app/code/Magento/Core/Model/File/Storage/AbstractStorage.php +++ b/app/code/Magento/Core/Helper/File/Media.php @@ -24,76 +24,30 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Helper\File; /** - * Abstract file storage model class - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Class Media */ -namespace Magento\Core\Model\File\Storage; - -abstract class AbstractStorage extends \Magento\Core\Model\AbstractModel +class Media extends \Magento\Core\Helper\AbstractHelper { /** - * Store media base directory path - * - * @var string - */ - protected $_mediaBaseDirectory = null; - - /** - * Core file storage database - * - * @var \Magento\Core\Helper\File\Storage\Database - */ - protected $_coreFileStorageDb = null; - - /** - * Date model - * * @var \Magento\Core\Model\Date */ protected $_date; /** - * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb - * @param \Magento\Core\Model\Context $context - * @param \Magento\Core\Model\Registry $registry + * Constructor + * + * @param \Magento\Core\Helper\Context $context * @param \Magento\Core\Model\Date $date - * @param \Magento\Core\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection - * @param array $data */ public function __construct( - \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, - \Magento\Core\Model\Context $context, - \Magento\Core\Model\Registry $registry, - \Magento\Core\Model\Date $date, - \Magento\Core\Model\Resource\AbstractResource $resource = null, - \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array() + \Magento\Core\Helper\Context $context, + \Magento\Core\Model\Date $date ) { - $this->_coreFileStorageDb = $coreFileStorageDb; + parent::__construct($context); $this->_date = $date; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); - } - - /** - * Retrieve media base directory path - * - * @return string - */ - public function getMediaBaseDirectory() - { - if (null === $this->_mediaBaseDirectory) { - /** @var $helper \Magento\Core\Helper\File\Storage\Database */ - $helper = $this->_coreFileStorageDb; - $this->_mediaBaseDirectory = $helper->getMediaBaseDir(); - } - - return $this->_mediaBaseDirectory; } /** @@ -104,16 +58,16 @@ abstract class AbstractStorage extends \Magento\Core\Model\AbstractModel * content => string|bool * update_time => string * directory => string - * ) * - * @param string $path - * @throws \Magento\Core\Exception + * @param string $mediaDirectory + * @param string $path * @return array + * @throws \Magento\Core\Exception */ - public function collectFileInfo($path) + public function collectFileInfo($mediaDirectory, $path) { $path = ltrim($path, '\\/'); - $fullPath = $this->getMediaBaseDirectory() . DS . $path; + $fullPath = $mediaDirectory . DS . $path; if (!file_exists($fullPath) || !is_file($fullPath)) { throw new \Magento\Core\Exception(__('File %1 does not exist', $fullPath)); diff --git a/app/code/Magento/Core/Helper/File/Storage.php b/app/code/Magento/Core/Helper/File/Storage.php index bc7c116e1ef50260aeebef5bd17a41696d3b20c9..3da083470a73551642866a30ac65d160fdcb8d03 100644 --- a/app/code/Magento/Core/Helper/File/Storage.php +++ b/app/code/Magento/Core/Helper/File/Storage.php @@ -64,15 +64,25 @@ class Storage extends \Magento\Core\Helper\AbstractHelper protected $_storage; /** - * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb + * File system storage model + * + * @var \Magento\Core\Model\File\Storage\File + */ + protected $_filesystemStorage; + + /** + * @param Storage\Database $coreFileStorageDb * @param \Magento\Core\Helper\Context $context * @param \Magento\Core\Model\File\Storage $storage + * @param \Magento\Core\Model\File\Storage\File $filesystemStorage */ public function __construct( \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Core\Helper\Context $context, - \Magento\Core\Model\File\Storage $storage + \Magento\Core\Model\File\Storage $storage, + \Magento\Core\Model\File\Storage\File $filesystemStorage ) { + $this->_filesystemStorage = $filesystemStorage; $this->_coreFileStorageDb = $coreFileStorageDb; $this->_storage = $storage; parent::__construct($context); @@ -100,8 +110,7 @@ class Storage extends \Magento\Core\Helper\AbstractHelper */ public function getStorageFileModel() { - return $objectManager = \Magento\Core\Model\ObjectManager::getInstance() - ->getSingleton('Magento\Core\Model\File\Storage\File'); + return $this->_filesystemStorage; } /** diff --git a/app/code/Magento/Core/Helper/Hint.php b/app/code/Magento/Core/Helper/Hint.php deleted file mode 100644 index 2a8659733614e08ff2427587b7cd34642931b953..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Helper/Hint.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Core hint helper - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Core\Helper; - -class Hint extends \Magento\Core\Helper\AbstractHelper -{ - /** - * List of available hints - * - * @var null|array - */ - protected $_availableHints; - - /** - * @var \Magento\Core\Model\Config - */ - protected $_coreConfig; - - /** - * Constructor - * - * @param \Magento\Core\Helper\Context $context - * @param \Magento\Core\Model\Config $coreConfig - */ - public function __construct( - \Magento\Core\Helper\Context $context, - \Magento\Core\Model\Config $coreConfig - ) { - parent::__construct( - $context - ); - $this->_coreConfig = $coreConfig; - } - - /** - * Retrieve list of available hints as [hint code] => [hint url] - * - * @return array - */ - public function getAvailableHints() - { - if (null === $this->_availableHints) { - $hints = array(); - $config = $this->_coreConfig->getValue('hints', 'default'); - if ($config) { - foreach ($config as $type => $configValue) { - if (isset($configValue['enabled']) && $configValue['enabled']) { - $hints[$type] = $configValue['url']; - } - } - } - $this->_availableHints = $hints; - } - return $this->_availableHints; - } - - /** - * Get Hint Url by Its Code - * - * @param string $code - * @return null|string - */ - public function getHintByCode($code) - { - $hint = null; - $hints = $this->getAvailableHints(); - if (array_key_exists($code, $hints)) { - $hint = $hints[$code]; - } - return $hint; - } -} diff --git a/app/code/Magento/Core/Helper/Http.php b/app/code/Magento/Core/Helper/Http.php deleted file mode 100644 index 9171a4c98c15fb33bef9d5d02b59d1284a3ade41..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Helper/Http.php +++ /dev/null @@ -1,291 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Core Http Helper - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Core\Helper; - -class Http extends \Magento\Core\Helper\AbstractHelper -{ - const XML_NODE_REMOTE_ADDR_HEADERS = 'global/remote_addr_headers'; - - /** - * Remote address cache - * - * @var string - */ - protected $_remoteAddr; - - /** - * Core string - * - * @var \Magento\Core\Helper\String - */ - protected $_coreString = null; - - /** - * @var \Magento\Core\Model\Config - */ - protected $_coreConfig; - - /** - * @param \Magento\Core\Helper\String $coreString - * @param \Magento\Core\Helper\Context $context - * @param \Magento\Core\Model\Config $coreConfig - */ - public function __construct( - \Magento\Core\Helper\String $coreString, - \Magento\Core\Helper\Context $context, - \Magento\Core\Model\Config $coreConfig - ) { - $this->_coreString = $coreString; - $this->_coreConfig = $coreConfig; - parent::__construct($context); - } - - /** - * Extract "login" and "password" credentials from HTTP-request - * - * Returns plain array with 2 items: login and password respectively - * - * @param \Magento\App\RequestInterface $request - * @return array - */ - public function getHttpAuthCredentials(\Magento\App\RequestInterface $request) - { - $server = $request->getServer(); - $user = ''; - $pass = ''; - - if (empty($server['HTTP_AUTHORIZATION'])) { - foreach ($server as $k => $v) { - if (substr($k, -18) === 'HTTP_AUTHORIZATION' && !empty($v)) { - $server['HTTP_AUTHORIZATION'] = $v; - break; - } - } - } - - if (isset($server['PHP_AUTH_USER']) && isset($server['PHP_AUTH_PW'])) { - $user = $server['PHP_AUTH_USER']; - $pass = $server['PHP_AUTH_PW']; - } - /** - * IIS Note: for HTTP authentication to work with IIS, - * the PHP directive cgi.rfc2616_headers must be set to 0 (the default value). - */ - elseif (!empty($server['HTTP_AUTHORIZATION'])) { - $auth = $server['HTTP_AUTHORIZATION']; - list($user, $pass) = explode(':', base64_decode(substr($auth, strpos($auth, " ") + 1))); - } - elseif (!empty($server['Authorization'])) { - $auth = $server['Authorization']; - list($user, $pass) = explode(':', base64_decode(substr($auth, strpos($auth, " ") + 1))); - } - - return array($user, $pass); - } - - /** - * Set "auth failed" headers to the specified response object - * - * @param \Magento\App\ResponseInterface $response - * @param string $realm - */ - public function failHttpAuthentication(\Magento\App\ResponseInterface $response, $realm) - { - $response->setHeader('HTTP/1.1', '401 Unauthorized') - ->setHeader('WWW-Authenticate', 'Basic realm="' . $realm . '"') - ->setBody('<h1>401 Unauthorized</h1>') - ; - } - - /** - * Retrieve Remote Addresses Additional check Headers - * - * @return array - */ - public function getRemoteAddrHeaders() - { - $headers = array(); - $element = $this->_coreConfig->getNode(self::XML_NODE_REMOTE_ADDR_HEADERS); - if ($element instanceof \Magento\Core\Model\Config\Element) { - foreach ($element->children() as $node) { - $headers[] = (string)$node; - } - } - - return $headers; - } - - /** - * Retrieve Client Remote Address - * - * @param bool $ipToLong converting IP to long format - * @return string IPv4|long - */ - public function getRemoteAddr($ipToLong = false) - { - if (is_null($this->_remoteAddr)) { - $headers = $this->getRemoteAddrHeaders(); - foreach ($headers as $var) { - if ($this->_getRequest()->getServer($var, false)) { - $this->_remoteAddr = $_SERVER[$var]; - break; - } - } - - if (!$this->_remoteAddr) { - $this->_remoteAddr = $this->_getRequest()->getServer('REMOTE_ADDR'); - } - } - - if (!$this->_remoteAddr) { - return false; - } - - return $ipToLong ? ip2long($this->_remoteAddr) : $this->_remoteAddr; - } - - /** - * Retrieve Server IP address - * - * @param bool $ipToLong converting IP to long format - * @return string IPv4|long - */ - public function getServerAddr($ipToLong = false) - { - $address = $this->_getRequest()->getServer('SERVER_ADDR'); - if (!$address) { - return false; - } - return $ipToLong ? ip2long($address) : $address; - } - - /** - * Retrieve HTTP "clean" value - * - * @param string $var - * @param boolean $clean clean non UTF-8 characters - * @return string - */ - protected function _getHttpCleanValue($var, $clean = true) - { - $value = $this->_getRequest()->getServer($var, ''); - if ($clean) { - $value = $this->_coreString->cleanString($value); - } - - return $value; - } - - /** - * Retrieve HTTP HOST - * - * @param boolean $clean clean non UTF-8 characters - * @return string - */ - public function getHttpHost($clean = true) - { - return $this->_getHttpCleanValue('HTTP_HOST', $clean); - } - - /** - * Retrieve HTTP USER AGENT - * - * @param boolean $clean clean non UTF-8 characters - * @return string - */ - public function getHttpUserAgent($clean = true) - { - return $this->_getHttpCleanValue('HTTP_USER_AGENT', $clean); - } - - /** - * Retrieve HTTP ACCEPT LANGUAGE - * - * @param boolean $clean clean non UTF-8 characters - * @return string - */ - public function getHttpAcceptLanguage($clean = true) - { - return $this->_getHttpCleanValue('HTTP_ACCEPT_LANGUAGE', $clean); - } - - /** - * Retrieve HTTP ACCEPT CHARSET - * - * @param boolean $clean clean non UTF-8 characters - * @return string - */ - public function getHttpAcceptCharset($clean = true) - { - return $this->_getHttpCleanValue('HTTP_ACCEPT_CHARSET', $clean); - } - - /** - * Retrieve HTTP REFERER - * - * @param boolean $clean clean non UTF-8 characters - * @return string - */ - public function getHttpReferer($clean = true) - { - return $this->_getHttpCleanValue('HTTP_REFERER', $clean); - } - - /** - * Returns the REQUEST_URI taking into account - * platform differences between Apache and IIS - * - * @param boolean $clean clean non UTF-8 characters - * @return string - */ - public function getRequestUri($clean = false) - { - $uri = $this->_getRequest()->getRequestUri(); - if ($clean) { - $uri = $this->_coreString->cleanString($uri); - } - return $uri; - } - - /** - * Validate IP address - * - * @param string $address - * @return boolean - */ - public function validateIpAddr($address) - { - return preg_match('#^(1?\d{1,2}|2([0-4]\d|5[0-5]))(\.(1?\d{1,2}|2([0-4]\d|5[0-5]))){3}$#', $address); - } -} diff --git a/app/code/Magento/Core/Helper/String.php b/app/code/Magento/Core/Helper/String.php index adbc4aed30c075f18b5e8dd65cee62e08e0e2b0e..257003e219884392ff03605f6d663d0d7d1475f6 100644 --- a/app/code/Magento/Core/Helper/String.php +++ b/app/code/Magento/Core/Helper/String.php @@ -24,303 +24,28 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Helper; + /** * Core data helper - * - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Helper; - class String extends \Magento\Core\Helper\AbstractHelper { - const ICONV_CHARSET = 'UTF-8'; - - /** - * @var \Magento\Core\Model\LocaleInterface - */ - protected $_locale; - - /** - * @param \Magento\Core\Helper\Context $context - * @param \Magento\Core\Model\Locale $locale - */ - public function __construct( - \Magento\Core\Helper\Context $context, - \Magento\Core\Model\Locale $locale) - { - parent::__construct($context); - $this->_locale = $locale; - } - - - /** - * Truncate a string to a certain length if necessary, appending the $etc string. - * $remainder will contain the string that has been replaced with $etc. - * - * @param string $string - * @param int $length - * @param string $etc - * @param string &$remainder - * @param bool $breakWords - * @return string - */ - public function truncate($string, $length = 80, $etc = '...', &$remainder = '', $breakWords = true) - { - $remainder = ''; - if (0 == $length) { - return ''; - } - - $originalLength = $this->strlen($string); - if ($originalLength > $length) { - $length -= $this->strlen($etc); - if ($length <= 0) { - return ''; - } - $preparedString = $string; - $preparedlength = $length; - if (!$breakWords) { - $preparedString = preg_replace('/\s+?(\S+)?$/u', '', $this->substr($string, 0, $length + 1)); - $preparedlength = $this->strlen($preparedString); - } - $remainder = $this->substr($string, $preparedlength, $originalLength); - return $this->substr($preparedString, 0, $length) . $etc; - } - - return $string; - } - - /** - * Retrieve string length using default charset - * - * @param string $string - * @return int - */ - public function strlen($string) - { - return iconv_strlen($string, self::ICONV_CHARSET); - } - - /** - * Passthrough to iconv_substr() - * - * @param string $string - * @param int $offset - * @param int $length - * @return string - */ - public function substr($string, $offset, $length = null) - { - $string = $this->cleanString($string); - if (is_null($length)) { - $length = $this->strlen($string) - $offset; - } - return iconv_substr($string, $offset, $length, self::ICONV_CHARSET); - } - - /** - * Split string and appending $insert string after $needle - * - * @param string $str - * @param integer $length - * @param string $needle - * @param string $insert - * @return string - */ - public function splitInjection($str, $length = 50, $needle = '-', $insert = ' ') - { - $str = $this->strSplit($str, $length); - $newStr = ''; - foreach ($str as $part) { - if ($this->strlen($part) >= $length) { - $lastDelimetr = $this->strpos($this->strrev($part), $needle); - $tmpNewStr = ''; - $tmpNewStr = $this->substr($this->strrev($part), 0, $lastDelimetr) - . $insert . $this->substr($this->strrev($part), $lastDelimetr); - $newStr .= $this->strrev($tmpNewStr); - } else { - $newStr .= $part; - } - } - return $newStr; - } - - /** - * Binary-safe strrev() - * - * @param string $str - * @return string - */ - public function strrev($str) - { - $result = ''; - $strlen = $this->strlen($str); - if (!$strlen) { - return $result; - } - for ($i = $strlen-1; $i >= 0; $i--) { - $result .= $this->substr($str, $i, 1); - } - return $result; - } - - /** - * Binary-safe variant of strSplit() - * + option not to break words - * + option to trim spaces (between each word) - * + option to set character(s) (pcre pattern) to be considered as words separator - * - * @param string $str - * @param int $length - * @param bool $keepWords - * @param bool $trim - * @param string $wordSeparatorRegex - * @return array - */ - public function strSplit($str, $length = 1, $keepWords = false, $trim = false, $wordSeparatorRegex = '\s') - { - $result = array(); - $strlen = $this->strlen($str); - if ((!$strlen) || (!is_int($length)) || ($length <= 0)) { - return $result; - } - // trim - if ($trim) { - $str = trim(preg_replace('/\s{2,}/siu', ' ', $str)); - } - // do a usual str_split, but safe for our encoding - if ((!$keepWords) || ($length < 2)) { - for ($offset = 0; $offset < $strlen; $offset += $length) { - $result[] = $this->substr($str, $offset, $length); - } - } - // split smartly, keeping words - else { - $split = preg_split('/(' . $wordSeparatorRegex . '+)/siu', $str, null, PREG_SPLIT_DELIM_CAPTURE); - $i = 0; - $space = ''; - $spaceLen = 0; - foreach ($split as $key => $part) { - if ($trim) { - // ignore spaces (even keys) - if ($key % 2) { - continue; - } - $space = ' '; - $spaceLen = 1; - } - if (empty($result[$i])) { - $currentLength = 0; - $result[$i] = ''; - $space = ''; - $spaceLen = 0; - } - else { - $currentLength = $this->strlen($result[$i]); - } - $partLength = $this->strlen($part); - // add part to current last element - if (($currentLength + $spaceLen + $partLength) <= $length) { - $result[$i] .= $space . $part; - } - // add part to new element - elseif ($partLength <= $length) { - $i++; - $result[$i] = $part; - } - // break too long part recursively - else { - foreach ($this->strSplit($part, $length, false, $trim, $wordSeparatorRegex) as $subpart) { - $i++; - $result[$i] = $subpart; - } - } - } - } - // remove last element, if empty - if ($count = count($result)) { - if ($result[$count - 1] === '') { - unset($result[$count - 1]); - } - } - // remove first element, if empty - if (isset($result[0]) && $result[0] === '') { - array_shift($result); - } - return $result; - } - /** - * Split words + * Builds namespace + classname out of the parts array * - * @param string $str The source string - * @param bool $uniqueOnly Unique words only - * @param int $maxWordLength Limit words count - * @param string $wordSeparatorRegexp - * @return array - */ - function splitWords($str, $uniqueOnly = false, $maxWordLength = 0, $wordSeparatorRegexp = '\s') - { - $result = array(); - $split = preg_split('#' . $wordSeparatorRegexp . '#siu', $str, null, PREG_SPLIT_NO_EMPTY); - foreach ($split as $word) { - if ($uniqueOnly) { - $result[$word] = $word; - } - else { - $result[] = $word; - } - } - if ($maxWordLength && count($result) > $maxWordLength) { - $result = array_slice($result, 0, $maxWordLength); - } - return $result; - } - - /** - * Clean non UTF-8 characters + * Split every part into pieces by _ and \ and uppercase every piece + * Then join them back using \ * - * @param string $string + * @param $parts * @return string */ - public function cleanString($string) + public static function buildClassName($parts) { - return '"libiconv"' == ICONV_IMPL ? - iconv(self::ICONV_CHARSET, self::ICONV_CHARSET . '//IGNORE', $string) : $string; + $separator = \Magento\Autoload\IncludePath::NS_SEPARATOR; + $string = join($separator, $parts); + $string = str_replace('_', $separator, $string); + $className = str_replace(' ', $separator, ucwords(str_replace($separator, ' ', $string))); + return $className; } - - /** - * Find position of first occurrence of a string - * - * @param string $haystack - * @param string $needle - * @param int $offset - * @return int|false - */ - public function strpos($haystack, $needle, $offset = null) - { - return iconv_strpos($haystack, $needle, $offset, self::ICONV_CHARSET); - } - - /** - * Sorts array with multibyte string keys - * - * @param array $sort - * @return array - */ - public function ksortMultibyte(array &$sort) - { - if (empty($sort)) { - return false; - } - $oldLocale = setlocale(LC_COLLATE, "0"); - $localeCode = $this->_locale->getLocaleCode(); - // use fallback locale if $localeCode is not available - setlocale(LC_COLLATE, $localeCode . '.UTF8', 'C.UTF-8', 'en_US.utf8'); - ksort($sort, SORT_LOCALE_STRING); - setlocale(LC_COLLATE, $oldLocale); - - return $sort; - } - } diff --git a/app/code/Magento/Core/Helper/Translate.php b/app/code/Magento/Core/Helper/Translate.php index 1d92e7304932796b2fbd4bccc44fb05b262fb90c..2fc62fd7161de75c0177bc9da7a3941158cddc27 100644 --- a/app/code/Magento/Core/Helper/Translate.php +++ b/app/code/Magento/Core/Helper/Translate.php @@ -83,23 +83,21 @@ class Translate extends \Magento\Core\Helper\AbstractHelper /** * This method initializes the Translate object for this instance. * @param $localeCode string - * @param $area string * @param $forceReload bool * @return \Magento\Core\Model\Translate */ - public function initTranslate($localeCode, $area, $forceReload) + public function initTranslate($localeCode, $forceReload) { $this->_translator->setLocale($localeCode); $dispatchResult = new \Magento\Object(array( - 'inline_type' => null, - 'params' => array('area' => $area) + 'inline_type' => null )); $this->_eventManager->dispatch('translate_initialization_before', array( 'translate_object' => $this->_translator, 'result' => $dispatchResult )); - $this->_translator->init($area, $dispatchResult, $forceReload); + $this->_translator->init(null, $dispatchResult, $forceReload); return $this; } } diff --git a/app/code/Magento/Core/Model/AbstractEntryPoint.php b/app/code/Magento/Core/Model/AbstractEntryPoint.php deleted file mode 100644 index f2579ef46db9f6fac07f08786f1a04ed834dd0e8..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/AbstractEntryPoint.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php -/** - * Abstract application entry point - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model; - -abstract class AbstractEntryPoint -{ - /** - * Application configuration - * - * @var \Magento\Core\Model\Config\Primary - */ - protected $_config; - - /** - * Application object manager - * - * @var \Magento\Core\Model\ObjectManager - */ - protected $_objectManager; - - /** - * @param \Magento\Core\Model\Config\Primary $config - * @param \Magento\ObjectManager $objectManager - */ - public function __construct( - \Magento\Core\Model\Config\Primary $config, - \Magento\ObjectManager $objectManager = null - ) { - $this->_config = $config; - $this->_objectManager = $objectManager; - } - - /** - * Process request by the application - */ - public function processRequest() - { - $this->_init(); - $this->_processRequest(); - } - - /** - * Process exception - * - * @param \Exception $exception - */ - public function processException(\Exception $exception) - { - $this->_init(); - $appMode = $this->_objectManager->get('Magento\App\State')->getMode(); - if ($appMode == \Magento\App\State::MODE_DEVELOPER) { - print '<pre>'; - print $exception->getMessage() . "\n\n"; - print $exception->getTraceAsString(); - print '</pre>'; - } else { - $reportData = array($exception->getMessage(), $exception->getTraceAsString()); - - // retrieve server data - if (isset($_SERVER)) { - if (isset($_SERVER['REQUEST_URI'])) { - $reportData['url'] = $_SERVER['REQUEST_URI']; - } - if (isset($_SERVER['SCRIPT_NAME'])) { - $reportData['script_name'] = $_SERVER['SCRIPT_NAME']; - } - } - - // attempt to specify store as a skin - try { - $storeManager = $this->_objectManager->get('Magento\Core\Model\StoreManager'); - $reportData['skin'] = $storeManager->getStore()->getCode(); - } catch (\Exception $exception) { - } - - $modelDir = $this->_objectManager->get('Magento\App\Dir'); - require_once($modelDir->getDir(\Magento\App\Dir::PUB) . DS . 'errors' . DS . 'report.php'); - } - } - - /** - * Initializes the entry point, so a Magento application is ready to be used - */ - protected function _init() - { - if (!$this->_objectManager) { - $this->_objectManager = new \Magento\Core\Model\ObjectManager($this->_config); - } - } - - /** - * Template method to process request according to the actual entry point rules - */ - protected abstract function _processRequest(); -} - diff --git a/app/code/Magento/Core/Model/AbstractModel.php b/app/code/Magento/Core/Model/AbstractModel.php index b43e28bbb442f3b6753a61ab2cc9d449b10d9af3..ea2283b27511934ea4e807f395341e943f0185f3 100644 --- a/app/code/Magento/Core/Model/AbstractModel.php +++ b/app/code/Magento/Core/Model/AbstractModel.php @@ -119,7 +119,7 @@ abstract class AbstractModel extends \Magento\Object /** * Application Cache Manager * - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cacheManager; @@ -129,7 +129,7 @@ abstract class AbstractModel extends \Magento\Object protected $_coreRegistry; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -196,9 +196,9 @@ abstract class AbstractModel extends \Magento\Object */ public function __wakeup() { - $objectManager = \Magento\Core\Model\ObjectManager::getInstance(); + $objectManager = \Magento\App\ObjectManager::getInstance(); $this->_eventDispatcher = $objectManager->get('Magento\Event\ManagerInterface'); - $this->_cacheManager = $objectManager->get('Magento\Core\Model\CacheInterface'); + $this->_cacheManager = $objectManager->get('Magento\App\CacheInterface'); $this->_coreRegistry = $objectManager->get('Magento\Core\Model\Registry'); } @@ -231,7 +231,7 @@ abstract class AbstractModel extends \Magento\Object throw new \Magento\Core\Exception(__('Resource is not set.')); } - return $this->_resource ?: \Magento\Core\Model\ObjectManager::getInstance()->get($this->_resourceName); + return $this->_resource ?: \Magento\App\ObjectManager::getInstance()->get($this->_resourceName); } /** @@ -259,7 +259,7 @@ abstract class AbstractModel extends \Magento\Object } return $this->_resourceCollection ? clone $this->_resourceCollection - : \Magento\Core\Model\ObjectManager::getInstance()->create( + : \Magento\App\ObjectManager::getInstance()->create( $this->_collectionName, array('resource' => $this->_getResource()) ); } @@ -632,7 +632,7 @@ abstract class AbstractModel extends \Magento\Object return; } /* Store manager does not work well in this place when injected via context */ - if (!\Magento\Core\Model\ObjectManager::getInstance() + if (!\Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Model\StoreManager')->getStore()->isAdmin() ) { throw new \Magento\Core\Exception(__('Cannot complete this operation from non-admin area.')); diff --git a/app/code/Magento/Core/Model/App.php b/app/code/Magento/Core/Model/App.php index 4cd0af3514267444ded771e9cec72505c3fb116a..f2b8dbf315601a7d9cc0b92d8fd1f5d1076c919e 100644 --- a/app/code/Magento/Core/Model/App.php +++ b/app/code/Magento/Core/Model/App.php @@ -31,6 +31,8 @@ */ namespace Magento\Core\Model; +use Magento\App\CacheInterface; + class App implements \Magento\Core\Model\AppInterface { /**#@+ @@ -51,32 +53,8 @@ class App implements \Magento\Core\Model\AppInterface /** * Magento version */ - const VERSION = '2.0.0.0-dev50'; + const VERSION = '2.0.0.0-dev51'; - /** - * Custom application dirs - */ - const PARAM_APP_DIRS = 'app_dirs'; - - /** - * Custom application uris - */ - const PARAM_APP_URIS = 'app_uris'; - - /** - * Custom local configuration file name - */ - const PARAM_CUSTOM_LOCAL_FILE = 'custom_local_xml'; - - /** - * Custom local configuration - */ - const PARAM_CUSTOM_LOCAL_CONFIG = 'custom_local_config'; - - /** - * Application run code - */ - const PARAM_MODE = 'MAGE_MODE'; /** * Application run code @@ -141,7 +119,7 @@ class App implements \Magento\Core\Model\AppInterface /** * Cache object * - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; @@ -184,7 +162,7 @@ class App implements \Magento\Core\Model\AppInterface /** * Data base updater object * - * @var \Magento\App\UpdaterInterface + * @var \Magento\Module\UpdaterInterface */ protected $_dbUpdater; @@ -222,7 +200,7 @@ class App implements \Magento\Core\Model\AppInterface */ public function __construct( \Magento\Core\Model\Config $config, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\ObjectManager $objectManager, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Event\ManagerInterface $eventManager, @@ -274,19 +252,6 @@ class App implements \Magento\Core\Model\AppInterface return $this; } - /** - * Loading application area - * - * @param string $code - * @return \Magento\Core\Model\App - */ - public function loadArea($code) - { - $this->_configScope->setCurrentScope($code); - $this->getArea($code)->load(); - return $this; - } - /** * Loading part of area data * @@ -383,7 +348,7 @@ class App implements \Magento\Core\Model\AppInterface /** * Get core cache model * - * @return \Magento\Core\Model\CacheInterface + * @return \Magento\App\CacheInterface */ public function getCacheInstance() { @@ -836,7 +801,7 @@ class App implements \Magento\Core\Model\AppInterface 'revision' => '0', 'patch' => '0', 'stability' => 'dev', - 'number' => '50', + 'number' => '51', ); } } diff --git a/app/code/Magento/Core/Model/App/Area.php b/app/code/Magento/Core/Model/App/Area.php index b22a806dbdd17f1d1e92ca174264d5841c257ebd..ef449a77f93d97010a86c8f61b5dfe61870f8ef1 100644 --- a/app/code/Magento/Core/Model/App/Area.php +++ b/app/code/Magento/Core/Model/App/Area.php @@ -36,7 +36,6 @@ class Area const AREA_GLOBAL = 'global'; const AREA_FRONTEND = 'frontend'; const AREA_ADMIN = 'admin'; - const AREA_ADMINHTML = 'adminhtml'; const PART_CONFIG = 'config'; const PART_TRANSLATE= 'translate'; @@ -90,7 +89,7 @@ class Area protected $_objectManager; /** - * @var \Magento\Core\Model\ObjectManager\ConfigLoader + * @var \Magento\App\ObjectManager\ConfigLoader */ protected $_diConfigLoader; @@ -102,12 +101,12 @@ class Area protected $_coreStoreConfig; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * Core design * * @var \Magento\Core\Model\Design @@ -120,24 +119,24 @@ class Area protected $_storeManager; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\Translate $translator * @param \Magento\Core\Model\Config $config - * @param \Magento\Core\Model\ObjectManager $objectManager - * @param \Magento\Core\Model\ObjectManager\ConfigLoader $diConfigLoader + * @param \Magento\ObjectManager $objectManager + * @param \Magento\App\ObjectManager\ConfigLoader $diConfigLoader * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Design $design * @param \Magento\Core\Model\StoreManager $storeManager * @param string $areaCode */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\Translate $translator, \Magento\Core\Model\Config $config, - \Magento\Core\Model\ObjectManager $objectManager, - \Magento\Core\Model\ObjectManager\ConfigLoader $diConfigLoader, + \Magento\ObjectManager $objectManager, + \Magento\App\ObjectManager\ConfigLoader $diConfigLoader, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Design $design, \Magento\Core\Model\StoreManager $storeManager, @@ -281,7 +280,7 @@ class Area 'translate_object' => $this->_translator, 'result' => $dispatchResult )); - $this->_translator->init($this->_code, $dispatchResult, false); + $this->_translator->init(null, $dispatchResult, false); \Magento\Phrase::setRenderer($this->_objectManager->get('Magento\Phrase\RendererInterface')); return $this; diff --git a/app/code/Magento/Core/Model/App/Emulation.php b/app/code/Magento/Core/Model/App/Emulation.php index bb586f4c813cfce1a17d9328697e289f2fdbd880..a14b17193761f873b03a93bb6f93964daf2f2416 100644 --- a/app/code/Magento/Core/Model/App/Emulation.php +++ b/app/code/Magento/Core/Model/App/Emulation.php @@ -230,7 +230,7 @@ class Emulation extends \Magento\Object $storeId ); $this->_locale->setLocaleCode($newLocaleCode); - $this->_helperTranslate->initTranslate($newLocaleCode, $area, true); + $this->_helperTranslate->initTranslate($newLocaleCode, true); return $initialLocaleCode; } @@ -271,7 +271,7 @@ class Emulation extends \Magento\Object protected function _restoreInitialLocale($initialLocaleCode, $initialArea = \Magento\Core\Model\App\Area::AREA_ADMIN) { $this->_app->getLocale()->setLocaleCode($initialLocaleCode); - $this->_helperTranslate->initTranslate($initialLocaleCode, $initialArea, true); + $this->_helperTranslate->initTranslate($initialLocaleCode, true); return $this; } } diff --git a/app/code/Magento/Core/Model/AppInterface.php b/app/code/Magento/Core/Model/AppInterface.php index f0a690829be7035fb6ce4f39feb839ffee14ea88..7b57c3fffaaaabcfa3a2c782e1f1ff5a68764bc1 100644 --- a/app/code/Magento/Core/Model/AppInterface.php +++ b/app/code/Magento/Core/Model/AppInterface.php @@ -77,14 +77,6 @@ interface AppInterface extends \Magento\Core\Model\StoreManagerInterface */ public function setErrorHandler($handler); - /** - * Loading application area - * - * @param string $code - * @return \Magento\Core\Model\AppInterface - */ - public function loadArea($code); - /** * Loading part of area data * @@ -147,7 +139,7 @@ interface AppInterface extends \Magento\Core\Model\StoreManagerInterface /** * Get core cache model * - * @return \Magento\Core\Model\CacheInterface + * @return \Magento\App\CacheInterface */ public function getCacheInstance(); diff --git a/app/code/Magento/Core/Model/Cache.php b/app/code/Magento/Core/Model/Cache.php index 529cebb283333c7d1c588df0d28b90126f343624..3b323bd6351a26d32e29823a577d4af46e3b8c5c 100644 --- a/app/code/Magento/Core/Model/Cache.php +++ b/app/code/Magento/Core/Model/Cache.php @@ -31,7 +31,7 @@ namespace Magento\Core\Model; -class Cache implements \Magento\Core\Model\CacheInterface +class Cache implements \Magento\App\CacheInterface { /** * @var string diff --git a/app/code/Magento/Core/Model/Cache/Config/SchemaLocator.php b/app/code/Magento/Core/Model/Cache/Config/SchemaLocator.php index 7a965a1af29483fb3f81ce6145c07b8e15525511..ae4264951307b554ac297598061a5e5947aa128d 100644 --- a/app/code/Magento/Core/Model/Cache/Config/SchemaLocator.php +++ b/app/code/Magento/Core/Model/Cache/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . DIRECTORY_SEPARATOR . 'cache.xsd'; } diff --git a/app/code/Magento/Core/Model/Cache/Frontend/Factory.php b/app/code/Magento/Core/Model/Cache/Frontend/Factory.php index 0a1c04524fbf5dc9f5387a9eac38a5f3bdfc7cd8..a3dbdb8f8eb758b8605cc5d2a8edb2bc734c62c8 100644 --- a/app/code/Magento/Core/Model/Cache/Frontend/Factory.php +++ b/app/code/Magento/Core/Model/Cache/Frontend/Factory.php @@ -90,7 +90,7 @@ class Factory /** * Resource * - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; @@ -98,7 +98,7 @@ class Factory * @param \Magento\ObjectManager $objectManager * @param \Magento\Filesystem $filesystem * @param \Magento\App\Dir $dirs - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param array $enforcedOptions * @param array $decorators */ @@ -106,7 +106,7 @@ class Factory \Magento\ObjectManager $objectManager, \Magento\Filesystem $filesystem, \Magento\App\Dir $dirs, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, array $enforcedOptions = array(), array $decorators = array() ) { diff --git a/app/code/Magento/Core/Model/Cache/Proxy.php b/app/code/Magento/Core/Model/Cache/Proxy.php index f0304e0cf150e3667b836282ebc132bd12ccbb9a..7e8d0336d3055de8c3d9a9f3e5d167c65dc616d9 100644 --- a/app/code/Magento/Core/Model/Cache/Proxy.php +++ b/app/code/Magento/Core/Model/Cache/Proxy.php @@ -29,7 +29,7 @@ */ namespace Magento\Core\Model\Cache; -class Proxy implements \Magento\Core\Model\CacheInterface +class Proxy implements \Magento\App\CacheInterface { /** * @var \Magento\ObjectManager @@ -37,7 +37,7 @@ class Proxy implements \Magento\Core\Model\CacheInterface protected $_objectManager; /** - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; @@ -52,7 +52,7 @@ class Proxy implements \Magento\Core\Model\CacheInterface /** * Create cache model * - * @return \Magento\Core\Model\CacheInterface|mixed + * @return \Magento\App\CacheInterface|mixed */ protected function _getCache() { diff --git a/app/code/Magento/Core/Model/Cache/TypeList.php b/app/code/Magento/Core/Model/Cache/TypeList.php index 9767640d93ca0862de27b667bf304e41e45f7dbc..fdf796d51ba556fad98685d911e2ff4db054a425 100644 --- a/app/code/Magento/Core/Model/Cache/TypeList.php +++ b/app/code/Magento/Core/Model/Cache/TypeList.php @@ -43,7 +43,7 @@ class TypeList implements \Magento\Core\Model\Cache\TypeListInterface protected $_cacheState; /** - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; @@ -51,13 +51,13 @@ class TypeList implements \Magento\Core\Model\Cache\TypeListInterface * @param \Magento\Core\Model\Cache\Config $config * @param \Magento\Core\Model\Cache\StateInterface $cacheState * @param \Magento\Core\Model\Cache\InstanceFactory $factory - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache */ public function __construct( \Magento\Core\Model\Cache\Config $config, \Magento\Core\Model\Cache\StateInterface $cacheState, \Magento\Core\Model\Cache\InstanceFactory $factory, - \Magento\Core\Model\CacheInterface $cache + \Magento\App\CacheInterface $cache ) { $this->_config = $config; $this->_factory = $factory; diff --git a/app/code/Magento/Core/Model/Config.php b/app/code/Magento/Core/Model/Config.php index f5301f8c036304dc160e09bf39c8be66659e3ded..0155e227b73f9d31c180b3eb0398090bef06fc98 100644 --- a/app/code/Magento/Core/Model/Config.php +++ b/app/code/Magento/Core/Model/Config.php @@ -26,12 +26,6 @@ namespace Magento\Core\Model; -/** - * @SuppressWarnings(PHPMD.ExcessivePublicCount) - * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - * @SuppressWarnings(PHPMD.TooManyFields) - */ class Config implements \Magento\Core\Model\ConfigInterface { /** @@ -54,98 +48,17 @@ class Config implements \Magento\Core\Model\ConfigInterface */ const SCOPE_WEBSITES = 'websites'; - /** - * Storage of validated secure urls - * - * @var array - */ - protected $_secureUrlCache = array(); - - /** - * Object manager - * - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Configuration storage - * - * @var \Magento\Core\Model\Config\StorageInterface - */ - protected $_storage; - - /** - * Configuration data container - * - * @var \Magento\Core\Model\ConfigInterface - */ - protected $_config; - - /** - * Module configuration reader - * - * @var \Magento\Core\Model\Config\Modules\Reader - */ - protected $_moduleReader; - - /** - * @var \Magento\Config\ScopeInterface - */ - protected $_configScope; - - /** - * @var \Magento\App\ModuleListInterface - */ - protected $_moduleList; - /** * @var \Magento\Core\Model\Config\SectionPool */ protected $_sectionPool; /** - * @var \Magento\Core\Model\Resource\Store\Collection - */ - protected $_storeCollection; - - /** - * @param \Magento\Core\Model\ObjectManager $objectManager - * @param \Magento\Core\Model\Config\StorageInterface $storage - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader - * @param \Magento\App\ModuleListInterface $moduleList - * @param \Magento\Config\ScopeInterface $configScope - * @param \Magento\Core\Model\Config\SectionPool $sectionPool - */ - public function __construct( - \Magento\Core\Model\ObjectManager $objectManager, - \Magento\Core\Model\Config\StorageInterface $storage, - \Magento\Core\Model\Config\Modules\Reader $moduleReader, - \Magento\App\ModuleListInterface $moduleList, - \Magento\Config\ScopeInterface $configScope, - \Magento\Core\Model\Config\SectionPool $sectionPool - ) { - \Magento\Profiler::start('config_load'); - $this->_objectManager = $objectManager; - $this->_storage = $storage; - $this->_config = $this->_storage->getConfiguration(); - $this->_moduleReader = $moduleReader; - $this->_moduleList = $moduleList; - $this->_configScope = $configScope; - $this->_sectionPool = $sectionPool; - \Magento\Profiler::stop('config_load'); - } - - /** - * Returns node found by the $path and scope info - * - * @param string $path - * @return \Magento\Core\Model\Config\Element - * @deprecated + * @param Config\SectionPool $sectionPool */ - public function getNode($path = null) + public function __construct(\Magento\Core\Model\Config\SectionPool $sectionPool) { - return $this->_config->getNode($path); + $this->_sectionPool = $sectionPool; } /** @@ -174,153 +87,6 @@ class Config implements \Magento\Core\Model\ConfigInterface $this->_sectionPool->getSection($scope, $scopeCode)->setValue($path, $value); } - /** - * Create node by $path and set its value. - * - * @param string $path separated by slashes - * @param string $value - * @param bool $overwrite - */ - public function setNode($path, $value, $overwrite = true) - { - $this->_config->setNode($path, $value, $overwrite); - } - - /** - * Get allowed areas - * - * @return array - */ - public function getAreas() - { - return $this->_allowedAreas; - } - - /** - * Identify front name of the requested area. Return current area front name if area code is not specified. - * - * @param string|null $areaCode - * @return string - * @throws \LogicException If front name is not defined. - */ - public function getAreaFrontName($areaCode = null) - { - $areaCode = empty($areaCode) ? $this->_configScope->getCurrentScope() : $areaCode; - $areaConfig = $this->getAreaConfig($areaCode); - if (!isset($areaConfig['frontName'])) { - throw new \LogicException(sprintf( - 'Area "%s" must have front name defined in the application config.', - $areaCode - )); - } - return $areaConfig['frontName']; - } - - /** - * Get module directory by directory type - * - * @param string $type - * @param string $moduleName - * @return string - */ - public function getModuleDir($type, $moduleName) - { - return $this->_moduleReader->getModuleDir($type, $moduleName); - } - - /** - * Retrieve store Ids for $path with checking - * - * if empty $allowValues then retrieve all stores values - * - * return array($storeId => $pathValue) - * - * @param string $path - * @param array $allowedValues - * @param string $keyAttribute - * @return array - * @throws \InvalidArgumentException - */ - public function getStoresConfigByPath($path, $allowedValues = array(), $keyAttribute = 'id') - { - // @todo inject custom store collection that corresponds to the following requirements - if (is_null($this->_storeCollection)) { - $this->_storeCollection = $this->_objectManager->create('Magento\Core\Model\Resource\Store\Collection'); - $this->_storeCollection->setLoadDefault(true); - } - $storeValues = array(); - /** @var $store \Magento\Core\Model\Store */ - foreach ($this->_storeCollection as $store) { - switch ($keyAttribute) { - case 'id': - $key = $store->getId(); - break; - case 'code': - $key = $store->getCode(); - break; - case 'name': - $key = $store->getName(); - break; - default: - throw new \InvalidArgumentException("'{$keyAttribute}' cannot be used as a key."); - break; - } - - $value = $this->getValue($path, 'store', $store->getCode()); - if (empty($allowedValues)) { - $storeValues[$key] = $value; - } elseif (in_array($value, $allowedValues)) { - $storeValues[$key] = $value; - } - } - return $storeValues; - } - - /** - * Determine whether provided name begins from any available modules, according to namespaces priority - * If matched, returns as the matched module "factory" name or a fully qualified module name - * - * @param string $name - * @param bool $asFullModuleName - * @return string - */ - public function determineOmittedNamespace($name, $asFullModuleName = false) - { - if (null === $this->_moduleNamespaces) { - $this->_moduleNamespaces = array(); - foreach ($this->_moduleList->getModules() as $module) { - $moduleName = $module['name']; - $module = strtolower($moduleName); - $this->_moduleNamespaces[substr($module, 0, strpos($module, '_'))][$module] = $moduleName; - } - } - - $explodeString = (strpos($name, \Magento\Autoload\IncludePath::NS_SEPARATOR) === false) ? - '_' : \Magento\Autoload\IncludePath::NS_SEPARATOR; - $name = explode($explodeString, strtolower($name)); - - $partsNum = count($name); - $defaultNamespaceFlag = false; - foreach ($this->_moduleNamespaces as $namespaceName => $namespace) { - // assume the namespace is omitted (default namespace only, which comes first) - if ($defaultNamespaceFlag === false) { - $defaultNamespaceFlag = true; - $defaultNS = $namespaceName . '_' . $name[0]; - if (isset($namespace[$defaultNS])) { - return $asFullModuleName ? $namespace[$defaultNS] : $name[0]; // return omitted as well - } - } - // assume namespace is qualified - if (isset($name[1])) { - $fullNS = $name[0] . '_' . $name[1]; - if (2 <= $partsNum && isset($namespace[$fullNS])) { - return $asFullModuleName ? $namespace[$fullNS] : $fullNS; - } - } - } - return ''; - } - /** * Reinitialize configuration * @@ -330,22 +96,4 @@ class Config implements \Magento\Core\Model\ConfigInterface { $this->_sectionPool->clean(); } - - /** - * Remove configuration cache - */ - public function removeCache() - { - $this->_storage->removeCache(); - } - - /** - * Reload xml configuration data - * @deprecated must be removed after Installation logic is removed from application - */ - public function reloadConfig() - { - $this->_storage->removeCache(); - $this->_config = $this->_storage->getConfiguration(); - } } diff --git a/app/code/Magento/Core/Model/Config/AbstractStorage.php b/app/code/Magento/Core/Model/Config/AbstractStorage.php deleted file mode 100644 index da519d9fe6ae0c43dcaaed95a5321885af102fd3..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Config/AbstractStorage.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -/** - * Application config storage - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Config; - -abstract class AbstractStorage implements \Magento\Core\Model\Config\StorageInterface -{ - /** - * Cache storage object - * - * @var \Magento\Core\Model\Config\Cache - */ - protected $_cache; - - /** - * Configuration loader - * - * @var \Magento\Core\Model\Config\LoaderInterface - */ - protected $_loader; - - /** - * Configuration loader - * - * @var \Magento\Core\Model\Config\BaseFactory - */ - protected $_configFactory; - - /** - * @param \Magento\Core\Model\Config\Cache $cache - * @param \Magento\Core\Model\Config\LoaderInterface $loader - * @param \Magento\Core\Model\Config\BaseFactory $factory - */ - public function __construct( - \Magento\Core\Model\Config\Cache $cache, - \Magento\Core\Model\Config\LoaderInterface $loader, - \Magento\Core\Model\Config\BaseFactory $factory - ) { - $this->_cache = $cache; - $this->_loader = $loader; - $this->_configFactory = $factory; - } - - /** - * Get loaded configuration - * - * @return \Magento\Core\Model\ConfigInterface - */ - public function getConfiguration() - { - $config = $this->_cache->load(); - if (false === $config) { - $config = $this->_configFactory->create('<config/>'); - $this->_loader->load($config); - } - return $config; - } - - /** - * Remove configuration cache - */ - public function removeCache() - { - - } -} diff --git a/app/code/Magento/Core/Model/Config/Base.php b/app/code/Magento/Core/Model/Config/Base.php index cd29bfedd76cbead5ec1b0bb0a776a47278d0677..3c5826867198df9686f6cfa4eec2d6e8f07ee913 100644 --- a/app/code/Magento/Core/Model/Config/Base.php +++ b/app/code/Magento/Core/Model/Config/Base.php @@ -28,7 +28,7 @@ */ namespace Magento\Core\Model\Config; -class Base extends \Magento\Simplexml\Config implements \Magento\Core\Model\ConfigInterface +class Base extends \Magento\Simplexml\Config { /** * List of instances @@ -47,14 +47,6 @@ class Base extends \Magento\Simplexml\Config implements \Magento\Core\Model\Conf self::$instances[] = $this; } - /** - * Reinitialize config object - */ - public function reinit() - { - - } - /** * Cleanup objects because of simplexml memory leak */ diff --git a/app/code/Magento/Core/Model/Config/FileResolver.php b/app/code/Magento/Core/Model/Config/FileResolver.php index 21b798400f58f43ea58a98a3bc94e3477157cebe..ec042016b96fd90c79a3aa6cce47c871fa39fb67 100644 --- a/app/code/Magento/Core/Model/Config/FileResolver.php +++ b/app/code/Magento/Core/Model/Config/FileResolver.php @@ -30,7 +30,7 @@ class FileResolver implements \Magento\Config\FileResolverInterface /** * Module configuration file reader * - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_moduleReader; @@ -40,11 +40,11 @@ class FileResolver implements \Magento\Config\FileResolverInterface protected $_applicationDirs; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader * @param \Magento\App\Dir $applicationDirs */ public function __construct( - \Magento\Core\Model\Config\Modules\Reader $moduleReader, + \Magento\Module\Dir\Reader $moduleReader, \Magento\App\Dir $applicationDirs ) { $this->_moduleReader = $moduleReader; diff --git a/app/code/Magento/Core/Model/Config/Initial/Reader.php b/app/code/Magento/Core/Model/Config/Initial/Reader.php index caa81da9985984651b9f2bf8939650bed7426a6f..d507e71f53e026c0127db178702858c2a605d210 100644 --- a/app/code/Magento/Core/Model/Config/Initial/Reader.php +++ b/app/code/Magento/Core/Model/Config/Initial/Reader.php @@ -62,18 +62,30 @@ class Reader */ protected $_scopePriorityScheme = array('primary', 'global'); + /** + * Path to corresponding XSD file with validation rules for config + * + * @var string + */ + protected $_schemaFile; + /** * @param \Magento\Config\FileResolverInterface $fileResolver - * @param \Magento\Core\Model\Config\Initial\Converter $converter + * @param Converter $converter + * @param SchemaLocator $schemaLocator + * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName * @param string $domDocumentClass */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, - \Magento\Core\Model\Config\Initial\Converter $converter, + Converter $converter, + SchemaLocator $schemaLocator, + \Magento\Config\ValidationStateInterface $validationState, $fileName = 'config.xml', $domDocumentClass = 'Magento\Config\Dom' ) { + $this->_schemaFile = $validationState->isValidated() ? $schemaLocator->getSchema() : null; $this->_fileResolver = $fileResolver; $this->_converter = $converter; $this->_domDocumentClass = $domDocumentClass; @@ -104,7 +116,11 @@ class Reader try { if (is_null($domDocument)) { $class = $this->_domDocumentClass; - $domDocument = new $class(file_get_contents($file)); + $domDocument = new $class( + file_get_contents($file), + array(), + $this->_schemaFile + ); } else { $domDocument->merge(file_get_contents($file)); } diff --git a/app/code/Magento/Core/Model/Route/Config/SchemaLocator.php b/app/code/Magento/Core/Model/Config/Initial/SchemaLocator.php similarity index 70% rename from app/code/Magento/Core/Model/Route/Config/SchemaLocator.php rename to app/code/Magento/Core/Model/Config/Initial/SchemaLocator.php index 566deb4b2449388b5c4b01940829e6560e098a48..d396b16803023bde9af448d3eed630711b3d0c70 100644 --- a/app/code/Magento/Core/Model/Route/Config/SchemaLocator.php +++ b/app/code/Magento/Core/Model/Config/Initial/SchemaLocator.php @@ -1,6 +1,6 @@ <?php /** - * Routes configuration schema locator + * Logging schema locator * * Magento * @@ -23,31 +23,23 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Route\Config; +namespace Magento\Core\Model\Config\Initial; class SchemaLocator implements \Magento\Config\SchemaLocatorInterface { /** - * Path to corresponding XSD file with validation rules for merged config + * Path to corresponding XSD file with validation rules for config * * @var string */ protected $_schema = null; /** - * Path to corresponding XSD file with validation rules for separate config files - * - * @var string - */ - protected $_perFileSchema = null; - - /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { - $this->_perFileSchema = $moduleReader->getModuleDir('etc', 'Magento_Core') . DIRECTORY_SEPARATOR . 'routes.xsd'; - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . DIRECTORY_SEPARATOR . 'routes_merged.xsd'; + $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . '/config.xsd'; } /** @@ -67,6 +59,6 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function getPerFileSchema() { - return $this->_perFileSchema; + return $this->_schema; } } diff --git a/app/code/Magento/Core/Model/Config/Loader.php b/app/code/Magento/Core/Model/Config/Loader.php deleted file mode 100644 index 1362724d00aa3eab58d413c98748ff650b6e6769..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Config/Loader.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Application config loader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Config; - -class Loader implements \Magento\Core\Model\Config\LoaderInterface -{ - /** - * Primary application configuration - * - * @var \Magento\Core\Model\Config\Primary - */ - protected $_primaryConfig; - - /** - * @var \Magento\Core\Model\Config\Modules\Reader - */ - protected $_fileReader; - - /** - * @param \Magento\Core\Model\Config\Primary $primaryConfig - * @param \Magento\Core\Model\Config\Modules\Reader $fileReader - */ - public function __construct( - \Magento\Core\Model\Config\Primary $primaryConfig, - \Magento\Core\Model\Config\Modules\Reader $fileReader - ) { - $this->_primaryConfig = $primaryConfig; - $this->_fileReader = $fileReader; - } - - /** - * Populate configuration object - * - * @param \Magento\Core\Model\Config\Base $config - */ - public function load(\Magento\Core\Model\Config\Base $config) - { - if (!$config->getNode()) { - $config->loadString('<config></config>'); - } - - \Magento\Profiler::start('config'); - \Magento\Profiler::start('load_modules'); - - $config->extend($this->_primaryConfig); - - \Magento\Profiler::start('load_modules_configuration'); - - $this->_fileReader->loadModulesConfiguration(array('config.xml'), $config); - \Magento\Profiler::stop('load_modules_configuration'); - - $config->applyExtends(); - - \Magento\Profiler::stop('load_modules'); - \Magento\Profiler::stop('config'); - } -} diff --git a/app/code/Magento/Core/Model/Config/Loader/Primary.php b/app/code/Magento/Core/Model/Config/Loader/Primary.php deleted file mode 100644 index dd932d491f52b5bd22bddf317694f4f5935858ca..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Config/Loader/Primary.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * Primary configuration loader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Config\Loader; - -class Primary implements \Magento\Core\Model\Config\LoaderInterface -{ - /** - * Config Directory - * - * @var string - */ - protected $_dir; - - /** - * Config factory - * - * @var \Magento\Core\Model\Config\BaseFactory - */ - protected $_prototypeFactory; - - /** - * @param string $dir - */ - public function __construct($dir) - { - $this->_dir = $dir; - } - - /** - * Load primary configuration - * - * @param \Magento\Core\Model\Config\Base $config - */ - public function load(\Magento\Core\Model\Config\Base $config) - { - $etcDir = $this->_dir; - if (!$config->getNode()) { - $config->loadString('<config/>'); - } - $files = glob($etcDir . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . 'config.xml'); - array_unshift($files, $etcDir . DIRECTORY_SEPARATOR . 'config.xml'); - // 1. app/etc/*.xml (except local config) - foreach ($files as $filename) { - $baseConfig = new \Magento\Core\Model\Config\Base('<config/>'); - $baseConfig->loadFile($filename); - $config->extend($baseConfig); - } - } -} diff --git a/app/code/Magento/Core/Model/Config/Primary.php b/app/code/Magento/Core/Model/Config/Primary.php deleted file mode 100644 index 731419ba6811ab212c6a1716e87c27e481245844..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Config/Primary.php +++ /dev/null @@ -1,192 +0,0 @@ -<?php -/** - * Primary application config (app/etc/*.xml) - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Config; - -class Primary extends \Magento\Core\Model\Config\Base -{ - /** - * @var \Magento\Core\Model\Config\Loader\Primary - */ - protected $_loader; - - /** - * Application parameter list - * - * @var array - */ - protected $_params; - - /** - * Directory list - * - * @var \Magento\App\Dir - */ - protected $_dir; - - /** - * @param string $baseDir - * @param array $params - * @param \Magento\App\Dir $dir - * @param \Magento\Core\Model\Config\LoaderInterface $loader - */ - public function __construct( - $baseDir, - array $params, - \Magento\App\Dir $dir = null, - \Magento\Core\Model\Config\LoaderInterface $loader = null - ) { - parent::__construct('<config/>'); - $this->_params = $params; - $this->_dir = $dir ?: new \Magento\App\Dir( - $baseDir, - $this->getParam(\Magento\Core\Model\App::PARAM_APP_URIS, array()), - $this->getParam(\Magento\Core\Model\App::PARAM_APP_DIRS, array()) - ); - \Magento\Autoload\IncludePath::addIncludePath(array( - $this->_dir->getDir(\Magento\App\Dir::GENERATION) - )); - - $this->_loader = $loader ?: new \Magento\Core\Model\Config\Loader\Primary( - $this->_dir->getDir(\Magento\App\Dir::CONFIG) - ); - $this->_loader->load($this); - } - - /** - * Get init param - * - * @param string $name - * @param mixed $defaultValue - * @return mixed - */ - public function getParam($name, $defaultValue = null) - { - return isset($this->_params[$name]) ? $this->_params[$name] : $defaultValue; - } - - /** - * Get application init params - * - * @return array - */ - public function getParams() - { - return $this->_params; - } - - /** - * Retrieve directories - * - * @return \Magento\App\Dir - */ - public function getDirectories() - { - return $this->_dir; - } - - /** - * Reinitialize primary configuration - */ - public function reinit() - { - $this->loadString('<config/>'); - $this->_loader->load($this); - } - - /** - * Retrieve class definition config - * - * @return string - */ - public function getDefinitionPath() - { - $pathInfo = (array) $this->getNode('global/di/definitions'); - if (isset($pathInfo['path'])) { - return $pathInfo['path']; - } else if (isset($pathInfo['relativePath'])) { - return $this->_dir->getDir(\Magento\App\Dir::ROOT) . DIRECTORY_SEPARATOR . $pathInfo['relativePath']; - } else { - return $this->_dir->getDir(\Magento\App\Dir::DI); - } - } - - /** - * Retrieve definition format - * - * @return string - */ - public function getDefinitionFormat() - { - return (string) $this->getNode('global/di/definitions/format'); - } - - /** - * Configure object manager - * - * \Magento\Core\Model\ObjectManager $objectManager - */ - public function configure(\Magento\Core\Model\ObjectManager $objectManager) - { - \Magento\Profiler::start('initial'); - - $objectManager->configure(array( - 'Magento\Core\Model\Config\Loader\Local' => array( - 'parameters' => array( - 'configDirectory' => $this->_dir->getDir(\Magento\App\Dir::CONFIG), - ) - ), - 'Magento\Core\Model\Cache\Frontend\Factory' => array( - 'parameters' => array( - 'decorators' => $this->_getCacheFrontendDecorators(), - ) - ), - )); - - \Magento\Profiler::stop('initial'); - } - - /** - * Retrieve cache frontend decorators configuration - * - * @return array - */ - protected function _getCacheFrontendDecorators() - { - $result = array(); - // mark all cache entries with a special tag to be able to clean only cache belonging to the application - $result[] = array( - 'class' => 'Magento\Cache\Frontend\Decorator\TagScope', - 'parameters' => array('tag' => 'MAGE'), - ); - if (\Magento\Profiler::isEnabled()) { - $result[] = array( - 'class' => 'Magento\Cache\Frontend\Decorator\Profiler', - 'parameters' => array('backendPrefixes' => array('Zend_Cache_Backend_', 'Magento\Cache\Backend\\')), - ); - } - return $result; - } -} diff --git a/app/code/Magento/Core/Model/Config/Storage.php b/app/code/Magento/Core/Model/Config/Storage.php deleted file mode 100644 index bbca49a547191765daadb88181bc99faae6bc009..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Config/Storage.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Application config storage - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Config; - -class Storage extends \Magento\Core\Model\Config\AbstractStorage -{ - /** - * @param \Magento\Core\Model\Config\Cache $cache - * @param \Magento\Core\Model\Config\Loader $loader - * @param \Magento\Core\Model\Config\BaseFactory $factory - */ - public function __construct( - \Magento\Core\Model\Config\Cache $cache, - \Magento\Core\Model\Config\Loader $loader, - \Magento\Core\Model\Config\BaseFactory $factory - ) { - parent::__construct($cache, $loader, $factory); - } - - /** - * Retrieve application configuration - * - * @return \Magento\Core\Model\ConfigInterface - */ - public function getConfiguration() - { - $config = $this->_cache->load(); - if (false === $config) { - $config = $this->_configFactory->create('<config/>'); - $this->_loader->load($config); - $this->_cache->save($config); - } - return $config; - } - - /** - * Remove configuration cache - */ - public function removeCache() - { - $this->_cache->clean(); - } -} diff --git a/app/code/Magento/Core/Model/ConfigInterface.php b/app/code/Magento/Core/Model/ConfigInterface.php index 395f5d43e74df43d57d13288d190f9a0d4674f3b..fb632173c05d3290e34f94a3065f571368c0da2b 100644 --- a/app/code/Magento/Core/Model/ConfigInterface.php +++ b/app/code/Magento/Core/Model/ConfigInterface.php @@ -29,21 +29,24 @@ namespace Magento\Core\Model; interface ConfigInterface { /** - * Get configuration node + * Retrieve config value by path and scope * * @param string $path - * @return \Magento\Simplexml\Element + * @param string $scope + * @param string $scopeCode + * @return mixed */ - public function getNode($path = null); + public function getValue($path = null, $scope = 'default', $scopeCode = null); /** - * Create node by $path and set its value + * Set config value in the corresponding config scope * - * @param string $path separated by slashes - * @param string $value - * @param boolean $overwrite + * @param string $path + * @param mixed $value + * @param string $scope + * @param null|string $scopeCode */ - public function setNode($path, $value, $overwrite = true); + public function setValue($path, $value, $scope = 'default', $scopeCode = null); /** * Reinitialize config object diff --git a/app/code/Magento/Core/Model/Context.php b/app/code/Magento/Core/Model/Context.php index 7fd80fdfd48000fc883eb55caf38a06369bf6ab6..53d13a63eecc3a8d4daf8d32536dca6eeeb9c58d 100644 --- a/app/code/Magento/Core/Model/Context.php +++ b/app/code/Magento/Core/Model/Context.php @@ -33,31 +33,31 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_eventDispatcher; /** - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cacheManager; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @var \Magento\App\State */ protected $_appState; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventDispatcher - * @param \Magento\Core\Model\CacheInterface $cacheManager + * @param \Magento\App\CacheInterface $cacheManager * @param \Magento\App\State $appState */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventDispatcher, - \Magento\Core\Model\CacheInterface $cacheManager, + \Magento\App\CacheInterface $cacheManager, \Magento\App\State $appState ) { $this->_eventDispatcher = $eventDispatcher; @@ -67,7 +67,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\CacheInterface + * @return \Magento\App\CacheInterface */ public function getCacheManager() { @@ -83,7 +83,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\Logger + * @return \Magento\Logger */ public function getLogger() { diff --git a/app/code/Magento/Core/Model/DataService/Config.php b/app/code/Magento/Core/Model/DataService/Config.php index 4381f14533fb1b3aa59f05d2490048da6f79c788..e0a291853be655c9df9c809438d599691bae0b77 100644 --- a/app/code/Magento/Core/Model/DataService/Config.php +++ b/app/code/Magento/Core/Model/DataService/Config.php @@ -42,15 +42,16 @@ class Config implements \Magento\Core\Model\DataService\ConfigInterface /** @var array $_serviceCallNodes */ protected $_serviceCallNodes; - /** @var \Magento\Core\Model\Config\Modules\Reader */ + /** @var \Magento\Module\Dir\Reader */ protected $_moduleReader; /** - * @param \Magento\Core\Model\DataService\Config\Reader\Factory $readerFactory - * @param \Magento\Core\Model\Config\Modules\Reader + * @param Config\Reader\Factory $readerFactory + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\DataService\Config\Reader\Factory $readerFactory, - \Magento\Core\Model\Config\Modules\Reader $moduleReader + public function __construct( + \Magento\Core\Model\DataService\Config\Reader\Factory $readerFactory, + \Magento\Module\Dir\Reader $moduleReader ) { $this->_readerFactory = $readerFactory; $this->_moduleReader = $moduleReader; diff --git a/app/code/Magento/Core/Model/DataService/Config/Reader.php b/app/code/Magento/Core/Model/DataService/Config/Reader.php index 92ccee14bcefb222ccf514462f6af3d9ca95c3b5..71f1a287a60119d236c0d5303c5090f1b8503de4 100644 --- a/app/code/Magento/Core/Model/DataService/Config/Reader.php +++ b/app/code/Magento/Core/Model/DataService/Config/Reader.php @@ -28,16 +28,16 @@ namespace Magento\Core\Model\DataService\Config; class Reader extends \Magento\Config\AbstractXml { /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ private $_modulesReader; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader * @param array $configFiles */ public function __construct( - \Magento\Core\Model\Config\Modules\Reader $moduleReader, + \Magento\Module\Dir\Reader $moduleReader, array $configFiles ) { if (count($configFiles)) { diff --git a/app/code/Magento/Core/Model/Date.php b/app/code/Magento/Core/Model/Date.php index c326688b7785645d65287b0644a71ab5f9c7a462..65ecdaa684acaf93eb0ce0169a95a1ba18747b65 100644 --- a/app/code/Magento/Core/Model/Date.php +++ b/app/code/Magento/Core/Model/Date.php @@ -23,8 +23,6 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - - /** * Date conversion model * @@ -93,20 +91,16 @@ class Date { $result = true; $offset = 0; - - if (!is_null($timezone)){ + if (!is_null($timezone)) { $oldzone = @date_default_timezone_get(); $result = date_default_timezone_set($timezone); } - if ($result === true) { $offset = gmmktime(0, 0, 0, 1, 2, 1970) - mktime(0, 0, 0, 1, 2, 1970); } - - if (!is_null($timezone)){ + if (!is_null($timezone)) { date_default_timezone_set($oldzone); } - return $offset; } @@ -122,13 +116,10 @@ class Date if (is_null($format)) { $format = 'Y-m-d H:i:s'; } - $date = $this->gmtTimestamp($input); - if ($date === false) { return false; } - $result = date($format, $date); return $result; } @@ -146,7 +137,6 @@ class Date if (is_null($format)) { $format = 'Y-m-d H:i:s'; } - $result = date($format, $this->timestamp($input)); return $result; } @@ -161,23 +151,21 @@ class Date { if (is_null($input)) { return gmdate('U'); - } else if (is_numeric($input)) { - $result = $input; } else { - $result = strtotime($input); + if (is_numeric($input)) { + $result = $input; + } else { + $result = strtotime($input); + } } - if ($result === false) { // strtotime() unable to parse string (it's not a date or has incorrect format) return false; } - - $date = $this->_locale->date($result); + $date = $this->_locale->date($result); $timestamp = $date->get(\Zend_Date::TIMESTAMP) - $date->get(\Zend_Date::TIMEZONE_SECS); - unset($date); return $timestamp; - } /** @@ -191,15 +179,15 @@ class Date { if (is_null($input)) { $result = $this->gmtTimestamp(); - } else if (is_numeric($input)) { - $result = $input; } else { - $result = strtotime($input); + if (is_numeric($input)) { + $result = $input; + } else { + $result = strtotime($input); + } } - - $date = $this->_locale->date($result); + $date = $this->_locale->date($result); $timestamp = $date->get(\Zend_Date::TIMESTAMP) + $date->get(\Zend_Date::TIMEZONE_SECS); - unset($date); return $timestamp; } @@ -217,11 +205,9 @@ class Date case 'seconds': default: break; - case 'minutes': $result = $result / 60; break; - case 'hours': $result = $result / 60 / 60; break; diff --git a/app/code/Magento/Core/Model/Design.php b/app/code/Magento/Core/Model/Design.php index 3f6695993aa4777358fdb214f9f3453b192f7656..e9c9032cbf149db67b4edf9bb91565190c6c4d80 100644 --- a/app/code/Magento/Core/Model/Design.php +++ b/app/code/Magento/Core/Model/Design.php @@ -24,6 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model; /** * Design settings change model @@ -38,13 +39,7 @@ * @method \Magento\Core\Model\Design setDateFrom(string $value) * @method string getDateTo() * @method \Magento\Core\Model\Design setDateTo(string $value) - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Model; - class Design extends \Magento\Core\Model\AbstractModel { /** @@ -73,10 +68,16 @@ class Design extends \Magento\Core\Model\AbstractModel */ protected $_locale; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -85,12 +86,14 @@ class Design extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $locale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_locale = $locale; + $this->_dateTime = $dateTime; } /** @@ -111,7 +114,7 @@ class Design extends \Magento\Core\Model\AbstractModel public function loadChange($storeId, $date = null) { if (is_null($date)) { - $date = \Magento\Date::formatDate($this->_locale->storeTimeStamp($storeId), false); + $date = $this->_dateTime->formatDate($this->_locale->storeTimeStamp($storeId), false); } $changeCacheId = 'design_change_' . md5($storeId . $date); diff --git a/app/code/Magento/Core/Model/Email/Template.php b/app/code/Magento/Core/Model/Email/Template.php index 183450178ab1e0d741f5113bc70e76e0a9221a65..61bb9e353039bd65e0118e0a437a661554420e92 100644 --- a/app/code/Magento/Core/Model/Email/Template.php +++ b/app/code/Magento/Core/Model/Email/Template.php @@ -106,7 +106,7 @@ class Template extends \Magento\Core\Model\Template protected $_viewFileSystem; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; diff --git a/app/code/Magento/Core/Model/Email/Template/Config.php b/app/code/Magento/Core/Model/Email/Template/Config.php index 4d31feec561397167f92320743f774262ff8b1b4..64ff7e15c02a1b7dc2e50e252beda6544cd7396a 100644 --- a/app/code/Magento/Core/Model/Email/Template/Config.php +++ b/app/code/Magento/Core/Model/Email/Template/Config.php @@ -33,17 +33,17 @@ class Config protected $_dataStorage; /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_moduleReader; /** * @param \Magento\Core\Model\Email\Template\Config\Data $dataStorage - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ public function __construct( \Magento\Core\Model\Email\Template\Config\Data $dataStorage, - \Magento\Core\Model\Config\Modules\Reader $moduleReader + \Magento\Module\Dir\Reader $moduleReader ) { $this->_dataStorage = $dataStorage; $this->_moduleReader = $moduleReader; diff --git a/app/code/Magento/Core/Model/Email/Template/Config/Reader.php b/app/code/Magento/Core/Model/Email/Template/Config/Reader.php index 0fd11cdb394472122a63872616d8c56cdf81010c..70c9ef739cd40456b036ecd6316fdcb2faeb1bbc 100644 --- a/app/code/Magento/Core/Model/Email/Template/Config/Reader.php +++ b/app/code/Magento/Core/Model/Email/Template/Config/Reader.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Email\Template\Config; class Reader extends \Magento\Config\Reader\Filesystem { /** - * @var \Magento\App\Module\Dir\ReverseResolver + * @var \Magento\Module\Dir\ReverseResolver */ private $_moduleDirResolver; @@ -37,14 +37,14 @@ class Reader extends \Magento\Config\Reader\Filesystem * @param \Magento\Core\Model\Email\Template\Config\Converter $converter * @param \Magento\Core\Model\Email\Template\Config\SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState - * @param \Magento\App\Module\Dir\ReverseResolver $moduleDirResolver + * @param \Magento\Module\Dir\ReverseResolver $moduleDirResolver */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, \Magento\Core\Model\Email\Template\Config\Converter $converter, \Magento\Core\Model\Email\Template\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, - \Magento\App\Module\Dir\ReverseResolver $moduleDirResolver + \Magento\Module\Dir\ReverseResolver $moduleDirResolver ) { $fileName = 'email_templates.xml'; $idAttributes = array( diff --git a/app/code/Magento/Core/Model/Email/Template/Config/SchemaLocator.php b/app/code/Magento/Core/Model/Email/Template/Config/SchemaLocator.php index dd2c7ceb2f99e337a1df9a034a0d78d783d8c3cb..a29c6a87c2a5a6957f882fe631ffa9280d95158e 100644 --- a/app/code/Magento/Core/Model/Email/Template/Config/SchemaLocator.php +++ b/app/code/Magento/Core/Model/Email/Template/Config/SchemaLocator.php @@ -35,9 +35,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface private $_schema; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . '/email_templates.xsd'; } diff --git a/app/code/Magento/Core/Model/Email/Template/Filter.php b/app/code/Magento/Core/Model/Email/Template/Filter.php index 51baf6ce4683137fec7c65ea41e97b25fc4a862a..43aeee2868dbe8f35cc921de166474ff339006d9 100644 --- a/app/code/Magento/Core/Model/Email/Template/Filter.php +++ b/app/code/Magento/Core/Model/Email/Template/Filter.php @@ -67,16 +67,14 @@ class Filter extends \Magento\Filter\Template protected $_viewUrl; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Escaper */ - protected $_coreData = null; + protected $_escaper = null; /** * Core store config @@ -109,26 +107,44 @@ class Filter extends \Magento\Filter\Template protected $_coreStoreConfig; /** - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Helper\Data $coreData + * Layout directive params + * + * @var array + */ + protected $_directiveParams; + + /** + * App state + * + * @var \Magento\App\State + */ + protected $_appState; + + /** + * @param \Magento\Stdlib\String $string + * @param \Magento\Logger $logger + * @param \Magento\Escaper $escaper * @param \Magento\Core\Model\View\Url $viewUrl * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\VariableFactory $coreVariableFactory * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\View\LayoutInterface $layout * @param \Magento\View\LayoutFactory $layoutFactory + * @param \Magento\App\State $appState */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Helper\Data $coreData, + \Magento\Stdlib\String $string, + \Magento\Logger $logger, + \Magento\Escaper $escaper, \Magento\Core\Model\View\Url $viewUrl, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\VariableFactory $coreVariableFactory, \Magento\Core\Model\StoreManager $storeManager, \Magento\View\LayoutInterface $layout, - \Magento\View\LayoutFactory $layoutFactory + \Magento\View\LayoutFactory $layoutFactory, + \Magento\App\State $appState ) { - $this->_coreData = $coreData; + $this->_escaper = $escaper; $this->_viewUrl = $viewUrl; $this->_logger = $logger; $this->_coreStoreConfig = $coreStoreConfig; @@ -137,6 +153,8 @@ class Filter extends \Magento\Filter\Template $this->_storeManager = $storeManager; $this->_layout = $layout; $this->_layoutFactory = $layoutFactory; + $this->_appState = $appState; + parent::__construct($string); } /** @@ -263,15 +281,32 @@ class Filter extends \Magento\Filter\Template */ public function layoutDirective($construction) { - $skipParams = array('handle', 'area'); - $params = $this->_getIncludeParameters($construction[2]); - $layoutParams = array(); - if (isset($params['area'])) { - $layoutParams['area'] = $params['area']; + $this->_directiveParams = $this->_getIncludeParameters($construction[2]); + if (!isset($this->_directiveParams['area'])) { + $this->_directiveParams['area'] = 'frontend'; } + if ($this->_directiveParams['area'] != $this->_appState->getAreaCode()) { + return $this->_appState->emulateAreaCode( + $this->_directiveParams['area'], + array($this, 'emulateAreaCallback') + ); + } else { + return $this->emulateAreaCallback(); + } + } + + /** + * Retrieve layout html directive callback + * + * @return string + */ + public function emulateAreaCallback() + { + $skipParams = array('handle', 'area'); + /** @var $layout \Magento\View\LayoutInterface */ - $layout = $this->_layoutFactory->create($layoutParams); - $layout->getUpdate()->addHandle($params['handle']) + $layout = $this->_layoutFactory->create(); + $layout->getUpdate()->addHandle($this->_directiveParams['handle']) ->load(); $layout->generateXml(); @@ -283,7 +318,7 @@ class Filter extends \Magento\Filter\Template if (!$block->getParentBlock() && !$rootBlock) { $rootBlock = $block; } - foreach ($params as $k => $v) { + foreach ($this->_directiveParams as $k => $v) { if (in_array($k, $skipParams)) { continue; } @@ -399,7 +434,7 @@ class Filter extends \Magento\Filter\Template $allowedTags = preg_split('/\s*\,\s*/', $params['allowed_tags'], 0, PREG_SPLIT_NO_EMPTY); } - return $this->_coreData->escapeHtml($params['var'], $allowedTags); + return $this->_escaper->escapeHtml($params['var'], $allowedTags); } /** diff --git a/app/code/Magento/Core/Model/EntryPoint/Cron.php b/app/code/Magento/Core/Model/EntryPoint/Cron.php deleted file mode 100644 index 99faf24e5b21bc10f1d08a31445324ecd72498af..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/EntryPoint/Cron.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\EntryPoint; - -class Cron extends \Magento\Core\Model\AbstractEntryPoint -{ - /** - * Process request to application - */ - protected function _processRequest() - { - /** @var $app \Magento\Core\Model\App */ - $app = $this->_objectManager->get('Magento\Core\Model\App'); - $app->setUseSessionInUrl(false); - $app->requireInstalledInstance(); - - /** @var $eventManager \Magento\Event\ManagerInterface */ - $eventManager = $this->_objectManager->get('Magento\Event\ManagerInterface'); - /** @var \Magento\Config\Scope $configScope */ - $configScope = $this->_objectManager->get('Magento\Config\ScopeInterface'); - $configScope->setCurrentScope('crontab'); - $eventManager->dispatch('default'); - } -} diff --git a/app/code/Magento/Core/Model/EntryPoint/Http.php b/app/code/Magento/Core/Model/EntryPoint/Http.php deleted file mode 100644 index 054c14c2dba873022c40431b9a30cec9fa61d679..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/EntryPoint/Http.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * Http entry point - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\EntryPoint; - -class Http extends \Magento\Core\Model\AbstractEntryPoint -{ - /** - * Process http request, output html page or proper information about an exception (if any) - */ - public function processRequest() - { - try { - parent::processRequest(); - } catch (\Magento\Core\Model\Session\Exception $e) { - header( - 'Location: ' . $this->_objectManager->get('Magento\Core\Model\StoreManager')->getStore()->getBaseUrl() - ); - } catch (\Magento\Core\Model\Store\Exception $e) { - require $this->_objectManager->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::PUB) . DS . 'errors' . DS . '404.php'; - } catch (\Magento\BootstrapException $e) { - header('Content-Type: text/plain', true, 503); - echo $e->getMessage(); - } catch (\Exception $e) { - $this->processException($e); - } - } - - /** - * Run http application - */ - protected function _processRequest() - { - $request = $this->_objectManager->get('Magento\App\RequestInterface'); - $areas = $this->_objectManager->get('Magento\App\AreaList'); - $areaCode = $areas->getCodeByFrontName($request->getFrontName()); - $this->_objectManager->get('Magento\Config\Scope')->setCurrentScope($areaCode); - $this->_objectManager->configure( - $this->_objectManager->get('Magento\Core\Model\ObjectManager\ConfigLoader')->load($areaCode) - ); - $frontController = $this->_objectManager->get('Magento\App\FrontControllerInterface'); - $frontController->dispatch($request); - } -} diff --git a/app/code/Magento/Core/Model/Fieldset/Config/SchemaLocator.php b/app/code/Magento/Core/Model/Fieldset/Config/SchemaLocator.php index 01c3bbd322433c85bcff7ad4f1f52108b2c8b563..a53b76838c30086668694f82a1527e671e430b80 100644 --- a/app/code/Magento/Core/Model/Fieldset/Config/SchemaLocator.php +++ b/app/code/Magento/Core/Model/Fieldset/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . '/fieldset.xsd'; $this->_perFileSchemaschema = $moduleReader->getModuleDir('etc', 'Magento_Core') . '/fieldset_file.xsd'; diff --git a/app/code/Magento/Core/Model/File/Storage.php b/app/code/Magento/Core/Model/File/Storage.php index f9e3c77f5f9552c40f7853b53948526b8c87d9d5..3ae1327c44487d034af25e33455f7724345e9aad 100644 --- a/app/code/Magento/Core/Model/File/Storage.php +++ b/app/code/Magento/Core/Model/File/Storage.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\File; /** - * File storage model class - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Class Storage */ -namespace Magento\Core\Model\File; - class Storage extends \Magento\Core\Model\AbstractModel { /** @@ -142,13 +137,11 @@ class Storage extends \Magento\Core\Model\AbstractModel /** * Show if there were errors while synchronize process * - * @param \Magento\Core\Model\AbstractModel $sourceModel - * @param \Magento\Core\Model\AbstractModel $destinationModel + * @param $sourceModel + * @param $destinationModel * @return bool */ - protected function _synchronizeHasErrors(\Magento\Core\Model\AbstractModel $sourceModel, - \Magento\Core\Model\AbstractModel $destinationModel - ) { + protected function _synchronizeHasErrors($sourceModel, $destinationModel) { if (!$sourceModel || !$destinationModel) { return true; } @@ -191,8 +184,7 @@ class Storage extends \Magento\Core\Model\AbstractModel break; case self::STORAGE_MEDIA_DATABASE: $connection = (isset($params['connection'])) ? $params['connection'] : null; - $arguments = array('connection' => $connection); - $model = $this->_databaseFactory->create(array('connectionName' => $arguments)); + $model = $this->_databaseFactory->create(array('connectionName' => $connection)); break; default: return false; diff --git a/app/code/Magento/Core/Model/File/Storage/Database.php b/app/code/Magento/Core/Model/File/Storage/Database.php index 56b486632ed739ae270bdfce8b682250d29a5423..e09cb3746361b4587fcb84f369098c95ceb05082 100644 --- a/app/code/Magento/Core/Model/File/Storage/Database.php +++ b/app/code/Magento/Core/Model/File/Storage/Database.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\File\Storage; /** - * File storage database model class - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Class Database */ -namespace Magento\Core\Model\File\Storage; - class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabase { /** @@ -58,32 +53,40 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas protected $_errors = array(); /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** - * @param \Magento\Core\Model\Logger $logger * @var \Magento\Core\Model\File\Storage\Directory\DatabaseFactory */ protected $_directoryFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @var \Magento\Core\Helper\File\Media + */ + protected $_mediaHelper; + + /** + * Class constructor + * + * @param \Magento\Logger $logger * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb + * @param \Magento\Core\Helper\File\Media $mediaHelper * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\Date $dateModel * @param \Magento\Core\Model\App $app * @param \Magento\Core\Model\Resource\File\Storage\Database $resource - * @param \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory + * @param Directory\DatabaseFactory $directoryFactory * @param \Magento\Data\Collection\Db $resourceCollection + * @param string|null $connectionName * @param array $data - * @param string $connectionName */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, + \Magento\Core\Helper\File\Media $mediaHelper, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\Date $dateModel, @@ -91,12 +94,12 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas \Magento\Core\Model\Resource\File\Storage\Database $resource, \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory, \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array(), - $connectionName = null + $connectionName = null, + array $data = array() ) { - $this->_init('Magento\Core\Model\Resource\File\Storage\Database'); $this->_directoryFactory = $directoryFactory; $this->_logger = $logger; + $this->_mediaHelper = $mediaHelper; parent::__construct( $coreFileStorageDb, $context, @@ -105,7 +108,10 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas $app, $resource, $resourceCollection, - $data); + $connectionName, + $data + ); + $this->_init(get_class($this->_resource)); } /** @@ -116,8 +122,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas public function getDirectoryModel() { if (is_null($this->_directoryModel)) { - $arguments = array('connection' => $this->getConnectionName()); - $this->_directoryModel = $this->_directoryFactory->create(array('connectionName' => $arguments)); + $this->_directoryModel = $this->_directoryFactory->create(array('connectionName' => $this->getConnectionName())); } return $this->_directoryModel; @@ -243,9 +248,8 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas try { $file['update_time'] = $dateSingleton->date(); - $arguments = array('connection' => $this->getConnectionName()); $file['directory_id'] = (isset($file['directory']) && strlen($file['directory'])) - ? $this->_directoryFactory->create(array('connectionName' => $arguments)) + ? $this->_directoryFactory->create(array('connectionName' => $this->getConnectionName())) ->loadByPath($file['directory'])->getId() : null; @@ -267,7 +271,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas */ public function saveFile($filename) { - $fileInfo = $this->collectFileInfo($filename); + $fileInfo = $this->_mediaHelper->collectFileInfo($this->getMediaBaseDirectory(), $filename); $filePath = $fileInfo['directory']; $directory = $this->_directoryFactory->create()->loadByPath($filePath); diff --git a/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php b/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php index 7ce82ac2e0bdc5106470d436dbe9eba1196986e1..bf6e7dc21f93ee0c950e5cd7a2b80f002f707976 100644 --- a/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php +++ b/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php @@ -24,24 +24,42 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\File\Storage\Database; /** - * Abstract database storage model class - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Class AbstractDatabase */ -namespace Magento\Core\Model\File\Storage\Database; - -abstract class AbstractDatabase extends \Magento\Core\Model\File\Storage\AbstractStorage +abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel { + /** + * Store media base directory path + * + * @var string + */ + protected $_mediaBaseDirectory = null; + + /** + * Core file storage database + * + * @var \Magento\Core\Helper\File\Storage\Database + */ + protected $_coreFileStorageDb = null; + + /** + * Date model + * + * @var \Magento\Core\Model\Date + */ + protected $_date; + /** * @var \Magento\Core\Model\App */ protected $_app; /** + * Class constructor + * * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -49,6 +67,7 @@ abstract class AbstractDatabase extends \Magento\Core\Model\File\Storage\Abstrac * @param \Magento\Core\Model\App $app * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection + * @param string|null $connectionName * @param array $data */ public function __construct( @@ -59,15 +78,16 @@ abstract class AbstractDatabase extends \Magento\Core\Model\File\Storage\Abstrac \Magento\Core\Model\App $app, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, + $connectionName = null, array $data = array() ) { - parent::__construct($coreFileStorageDb, $context, $registry, $dateModel, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_app = $app; - $connectionName = (isset($data['connection'])) ? $data['connection'] : null; - if (empty($connectionName)) { + $this->_coreFileStorageDb = $coreFileStorageDb; + $this->_date = $dateModel; + if (!$connectionName) { $connectionName = $this->getConfigConnectionName(); } - $this->setConnectionName($connectionName); } @@ -83,7 +103,6 @@ abstract class AbstractDatabase extends \Magento\Core\Model\File\Storage\Abstrac if (empty($connectionName)) { $connectionName = 'default_setup'; } - return $connectionName; } diff --git a/app/code/Magento/Core/Model/File/Storage/Directory/Database.php b/app/code/Magento/Core/Model/File/Storage/Directory/Database.php index 5b86cc1b01e900f141266cd5943c79ebaff875db..8da9f986e50123a9fb14e0ed107d76e49bf3ce9d 100644 --- a/app/code/Magento/Core/Model/File/Storage/Directory/Database.php +++ b/app/code/Magento/Core/Model/File/Storage/Directory/Database.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\File\Storage\Directory; /** - * Directory database storage model class - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Class Database */ -namespace Magento\Core\Model\File\Storage\Directory; - class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabase { /** @@ -56,7 +51,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas protected $_directoryFactory; /** - * Class construct + * Class constructor * * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Core\Model\Context $context @@ -66,8 +61,8 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas * @param \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory * @param \Magento\Core\Model\Resource\File\Storage\Directory\Database $resource * @param \Magento\Data\Collection\Db $resourceCollection + * @param string|null $connectionName * @param array $data - * @param null $connectionName */ public function __construct( \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, @@ -76,18 +71,24 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas \Magento\Core\Model\Date $dateModel, \Magento\Core\Model\App $app, \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory, - \Magento\Core\Model\Resource\File\Storage\Directory\Database $resource = null, + \Magento\Core\Model\Resource\File\Storage\Directory\Database $resource, \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array(), - $connectionName = null + $connectionName = null, + array $data = array() ) { + $this->_directoryFactory = $directoryFactory; parent::__construct( - $coreFileStorageDb, $context, $registry, $dateModel, $app, $resource, $resourceCollection, + $coreFileStorageDb, + $context, + $registry, + $dateModel, + $app, + $resource, + $resourceCollection, + $connectionName, $data ); - - $this->_directoryFactory = $directoryFactory; - $this->_init('Magento\Core\Model\Resource\File\Storage\Directory\Database'); + $this->_init(get_class($this->_resource)); } /** @@ -185,8 +186,8 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas */ public function exportDirectories($offset = 0, $count = 100) { - $offset = ((int) $offset >= 0) ? (int) $offset : 0; - $count = ((int) $count >= 1) ? (int) $count : 1; + $offset = ((int)$offset >= 0) ? (int)$offset : 0; + $count = ((int)$count >= 1) ? (int)$count : 1; $result = $this->_getResource()->exportDirectories($offset, $count); @@ -217,8 +218,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas } try { - $arguments = array('connection' => $this->getConnectionName()); - $directory = $this->_directoryFactory->create(array('connectionName' => $arguments)); + $directory = $this->_directoryFactory->create(array('connectionName' => $this->getConnectionName())); $directory->setPath($dir['path']); $parentId = $directory->getParentId(); @@ -264,7 +264,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas /** * Delete directory from database * - * @param string $path + * @param string $dirPath * @return \Magento\Core\Model\File\Storage\Directory\Database */ public function deleteDirectory($dirPath) diff --git a/app/code/Magento/Core/Model/File/Storage/File.php b/app/code/Magento/Core/Model/File/Storage/File.php index eea5d0782f4c5223913227d5f68fe5d57e41e47e..4d2c6ed91e82c49256bb17a6c70d691b0bc31abf 100644 --- a/app/code/Magento/Core/Model/File/Storage/File.php +++ b/app/code/Magento/Core/Model/File/Storage/File.php @@ -24,17 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\File\Storage; /** - * Abstract model class - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Class File */ -namespace Magento\Core\Model\File\Storage; - -class File extends \Magento\Core\Model\File\Storage\AbstractStorage +class File { /** * Prefix of model events names @@ -43,6 +38,25 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage */ protected $_eventPrefix = 'core_file_storage_file'; + /** + * Store media base directory path + * + * @var string + */ + protected $_mediaBaseDirectory = null; + + /** + * Core file storage database + * + * @var \Magento\Core\Helper\File\Storage\Database + */ + protected $_storageHelper = null; + + /** + * @var \Magento\Core\Helper\File\Media + */ + protected $_mediaHelper = null; + /** * Data at storage * @@ -58,33 +72,26 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage protected $_errors = array(); /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** - * Class construct - * - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb - * @param \Magento\Core\Model\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Core\Model\Resource\File\Storage\File $resource - * @param \Magento\Data\Collection\Db|null $resourceCollection - * @param array $data + * @param \Magento\Logger $logger + * @param \Magento\Core\Helper\File\Storage\Database $storageHelper + * @param \Magento\Core\Helper\File\Media $mediaHelper + * @param \Magento\Core\Model\Resource\File\Storage\File $fileUtility */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, - \Magento\Core\Model\Context $context, - \Magento\Core\Model\Registry $registry, - \Magento\Core\Model\Resource\File\Storage\File $resource, - \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array() + \Magento\Logger $logger, + \Magento\Core\Helper\File\Storage\Database $storageHelper, + \Magento\Core\Helper\File\Media $mediaHelper, + \Magento\Core\Model\Resource\File\Storage\File $fileUtility ) { - parent::__construct($coreFileStorageDb, $context, $registry, $resource, $resourceCollection, $data); - $this->_setResourceModel('Magento\Core\Model\Resource\File\Storage\File'); - $this->_logger = $logger; + $this->_fileUtility = $fileUtility; + $this->_storageHelper = $storageHelper; + $this->_logger = $logger; + $this->_mediaHelper = $mediaHelper; } /** @@ -114,7 +121,7 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage */ public function getStorageData() { - return $this->_getResource()->getStorageData(); + return $this->_fileUtility->getStorageData(); } /** @@ -134,7 +141,7 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage */ public function clear() { - $this->_getResource()->clear(); + $this->_fileUtility->clear(); return $this; } @@ -155,16 +162,25 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage $offset = ((int) $offset >= 0) ? (int) $offset : 0; $count = ((int) $count >= 1) ? (int) $count : 1; - if (is_null($this->_data)) { + if (empty($this->_data)) { $this->_data = $this->getStorageData(); } - $slice = array_slice($this->_data[$type], $offset, $count); - if (empty($slice)) { + if (!array_key_exists($type, $this->_data)) { return false; } + $slice = array_slice($this->_data[$type], $offset, $count); + return $slice ?: false; + } - return $slice; + /** + * Retrieve connection name saved at config + * + * @return null + */ + public function getConfigConnectionName() + { + return null; } /** @@ -197,7 +213,7 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage $result = array(); foreach ($slice as $fileName) { try { - $fileInfo = $this->collectFileInfo($fileName); + $fileInfo = $this->_mediaHelper->collectFileInfo($this->getMediaBaseDirectory(), $fileName); } catch (\Exception $e) { $this->_logger->logException($e); continue; @@ -264,7 +280,7 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage */ public function saveDir($dir) { - return $this->_getResource()->saveDir($dir); + return $this->_fileUtility->saveDir($dir); } /** @@ -285,7 +301,7 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage ? $file['directory'] . DS . $file['filename'] : $file['filename']; - return $this->_getResource() + return $this->_fileUtility ->saveFile($filename, $file['content'], $overwrite); } catch (\Exception $e) { $this->_logger->logException($e); @@ -299,4 +315,17 @@ class File extends \Magento\Core\Model\File\Storage\AbstractStorage return false; } + + /** + * Retrieve media base directory path + * + * @return string + */ + public function getMediaBaseDirectory() + { + if (is_null($this->_mediaBaseDirectory)) { + $this->_mediaBaseDirectory = $this->_storageHelper->getMediaBaseDir(); + } + return $this->_mediaBaseDirectory; + } } diff --git a/app/code/Magento/Core/Model/File/Storage/Response.php b/app/code/Magento/Core/Model/File/Storage/Response.php index f3d41fdeb2d2daafcae1f0b95d06c9ae1d52512a..d168631566c77526835af533372fd1aed4a7f091 100644 --- a/app/code/Magento/Core/Model/File/Storage/Response.php +++ b/app/code/Magento/Core/Model/File/Storage/Response.php @@ -28,7 +28,7 @@ class Response /** * Application object manager * - * @var \Magento\Core\Model\ObjectManager + * @var \Magento\ObjectManager */ protected $_objectManager; diff --git a/app/code/Magento/Core/Model/File/Storage/Synchronization.php b/app/code/Magento/Core/Model/File/Storage/Synchronization.php index f964cd1c7927778bd719b4aba00da9238a7d0ac6..b5067292b051c1d6e2497c076773174e6147d005 100644 --- a/app/code/Magento/Core/Model/File/Storage/Synchronization.php +++ b/app/code/Magento/Core/Model/File/Storage/Synchronization.php @@ -21,8 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Core\Model\File\Storage; +/** + * Class Synchronization + */ class Synchronization { /** diff --git a/app/code/Magento/Core/Model/File/Validator/NotProtectedExtension.php b/app/code/Magento/Core/Model/File/Validator/NotProtectedExtension.php index 8aceae9065f8a196577ea02faa6e6a82d5fd8049..aa1e5d5a1c27dda84fc2b0d1d6354321ccc1b48e 100644 --- a/app/code/Magento/Core/Model/File/Validator/NotProtectedExtension.php +++ b/app/code/Magento/Core/Model/File/Validator/NotProtectedExtension.php @@ -24,20 +24,23 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\File\Validator; /** * Validator for check not protected file extensions - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Model\File\Validator; - class NotProtectedExtension extends \Zend_Validate_Abstract { + /** + * Protected extension message key + */ const PROTECTED_EXTENSION = 'protectedExtension'; + /** + * Protected files config path + */ + const XML_PATH_PROTECTED_FILE_EXTENSIONS = 'general/file/protected_extensions'; + /** * The file extension * @@ -53,23 +56,20 @@ class NotProtectedExtension extends \Zend_Validate_Abstract protected $_protectedFileExtensions = array(); /** - * Core data + * Core store config * - * @var \Magento\Core\Helper\Data + * @var \Magento\Core\Model\Store\Config */ - protected $_coreData = null; + protected $_coreStoreConfig; /** - * Construct + * Init validator * - * - * - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Core\Model\Store\Config $coreStoreConfig */ - public function __construct( - \Magento\Core\Helper\Data $coreData - ) { - $this->_coreData = $coreData; + public function __construct(\Magento\Core\Model\Store\Config $coreStoreConfig) + { + $this->_coreStoreConfig = $coreStoreConfig; $this->_initMessageTemplates(); $this->_initProtectedFileExtensions(); } @@ -97,9 +97,7 @@ class NotProtectedExtension extends \Zend_Validate_Abstract protected function _initProtectedFileExtensions() { if (!$this->_protectedFileExtensions) { - /** @var $helper \Magento\Core\Helper\Data */ - $helper = $this->_coreData; - $extensions = $helper->getProtectedFileExtensions(); + $extensions = $this->getProtectedFileExtensions(); if (is_string($extensions)) { $extensions = explode(',', $extensions); } @@ -111,6 +109,16 @@ class NotProtectedExtension extends \Zend_Validate_Abstract return $this; } + /** + * Return list with protected file extensions + * + * @param \Magento\Core\Model\Store|string|int $store + * @return array + */ + public function getProtectedFileExtensions($store = null) + { + return $this->_coreStoreConfig->getConfig(self::XML_PATH_PROTECTED_FILE_EXTENSIONS, $store); + } /** * Returns true if and only if $value meets the validation requirements diff --git a/app/code/Magento/Core/Model/Input/Filter.php b/app/code/Magento/Core/Model/Input/Filter.php index cf407109b191f0012b46e9a49600ad8361cecacd..6304f4b4883141737af39f430dad20b8eb0e143a 100644 --- a/app/code/Magento/Core/Model/Input/Filter.php +++ b/app/code/Magento/Core/Model/Input/Filter.php @@ -106,17 +106,17 @@ class Filter implements \Zend_Filter_Interface protected $_helperFactory; /** - * @var \Magento\Core\Model\ObjectManager + * @var \Magento\ObjectManager */ protected $_objectManager; /** * @param \Magento\Core\Model\Factory\Helper $helperFactory - * @param \Magento\Core\Model\ObjectManager $objectManager + * @param \Magento\ObjectManager $objectManager */ function __construct( \Magento\Core\Model\Factory\Helper $helperFactory, - \Magento\Core\Model\ObjectManager $objectManager + \Magento\ObjectManager $objectManager ) { $this->_helperFactory = $helperFactory; $this->_objectManager = $objectManager; diff --git a/app/code/Magento/Core/Model/Layout.php b/app/code/Magento/Core/Model/Layout.php index e8d706d56719b43400eaa291069b8cd2ddca0c42..6cbfd64d3b6489b77c9bb9f3a3a9e387b5d745e5 100644 --- a/app/code/Magento/Core/Model/Layout.php +++ b/app/code/Magento/Core/Model/Layout.php @@ -222,7 +222,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn protected $_coreStoreConfig; /** - * @var \Magento\Core\Model\Logger $logger + * @var \Magento\Logger $logger */ protected $_logger; @@ -236,10 +236,15 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn */ protected $_themeFactory; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * @param \Magento\View\Layout\ProcessorFactory $processorFactory * @param Resource\Theme\CollectionFactory $themeFactory - * @param Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param Factory\Helper $factoryHelper * @param \Magento\Core\Helper\Data $coreData @@ -250,12 +255,13 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * @param Layout\ScheduledStructure $scheduledStructure * @param DataService\Graph $dataServiceGraph * @param Store\Config $coreStoreConfig + * @param \Magento\App\State $appState * @param string $area */ public function __construct( \Magento\View\Layout\ProcessorFactory $processorFactory, \Magento\Core\Model\Resource\Theme\CollectionFactory $themeFactory, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\Factory\Helper $factoryHelper, \Magento\Core\Helper\Data $coreData, @@ -266,6 +272,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn \Magento\Core\Model\Layout\ScheduledStructure $scheduledStructure, \Magento\Core\Model\DataService\Graph $dataServiceGraph, \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\State $appState, $area = \Magento\View\DesignInterface::DEFAULT_AREA ) { $this->_eventManager = $eventManager; @@ -274,6 +281,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn $this->_coreStoreConfig = $coreStoreConfig; $this->_design = $design; $this->_blockFactory = $blockFactory; + $this->_appState = $appState; $this->_area = $area; $this->_structure = $structure; $this->_argumentProcessor = $argumentProcessor; @@ -343,16 +351,18 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn /** * Retrieve layout area * + * @deparecated * @return string */ public function getArea() { - return $this->_area; + return $this->_appState->getAreaCode(); } /** * Set area code * + * @deprecated * @param string $areaCode */ public function setArea($areaCode) diff --git a/app/code/Magento/Core/Model/Layout/Merge.php b/app/code/Magento/Core/Model/Layout/Merge.php index 98b69109e8c2ffeedf9c983a5546d64d073d4289..3e10044911220bd0b38fd1d90c72a78186364ebf 100644 --- a/app/code/Magento/Core/Model/Layout/Merge.php +++ b/app/code/Magento/Core/Model/Layout/Merge.php @@ -113,7 +113,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface protected $_layoutValidator; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -127,7 +127,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface * @param \Magento\App\State $appState * @param \Magento\Cache\FrontendInterface $cache * @param \Magento\Adminhtml\Model\LayoutUpdate\Validator $validator - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\View\Design\ThemeInterface $theme Non-injectable theme instance */ public function __construct( @@ -138,7 +138,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface \Magento\App\State $appState, \Magento\Cache\FrontendInterface $cache, \Magento\Adminhtml\Model\LayoutUpdate\Validator $validator, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\View\Design\ThemeInterface $theme = null ) { $this->_theme = $theme ?: $design->getDesignTheme(); @@ -374,7 +374,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface $messages = $this->_layoutValidator->getMessages(); //Add first message to exception $message = array_shift($messages); - $this->_logger->addStreamLog(\Magento\Core\Model\Logger::LOGGER_SYSTEM); + $this->_logger->addStreamLog(\Magento\Logger::LOGGER_SYSTEM); $this->_logger->log('Cache file with merged layout: ' . $cacheId. ': ' . $message, \Zend_Log::ERR); } } diff --git a/app/code/Magento/Core/Model/Layout/Update.php b/app/code/Magento/Core/Model/Layout/Update.php index 617f4e13d01d9843d5835102d145b62ed9667390..02d5d95dba1657c65fd86f1bd3ab8f638348cb4a 100644 --- a/app/code/Magento/Core/Model/Layout/Update.php +++ b/app/code/Magento/Core/Model/Layout/Update.php @@ -24,6 +24,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\Layout; + /** * Layout Update model class * @@ -39,10 +41,33 @@ * @method \Magento\Core\Model\Layout\Update setUpdatedAt() setUpdatedAt(string $updateDateTime) * @method \Magento\Core\Model\Resource\Layout\Update\Collection getCollection() */ -namespace Magento\Core\Model\Layout; - class Update extends \Magento\Core\Model\AbstractModel { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + + /** + * @param \Magento\Core\Model\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Data\Collection\Db $resourceCollection + * @param array $data + */ + public function __construct( + \Magento\Core\Model\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Stdlib\DateTime $dateTime, + \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Data\Collection\Db $resourceCollection = null, + array $data = array() + ) { + $this->_dateTime = $dateTime; + parent::__construct($context, $registry, $resource, $resourceCollection, $data); + } + /** * Layout Update model initialization */ @@ -58,7 +83,7 @@ class Update extends \Magento\Core\Model\AbstractModel */ protected function _beforeSave() { - $this->setUpdatedAt($this->getResource()->formatDate(time())); + $this->setUpdatedAt($this->_dateTime->formatDate(time())); return parent::_beforeSave(); } } diff --git a/app/code/Magento/Core/Model/Locale.php b/app/code/Magento/Core/Model/Locale.php index 3dfcfb390bc097a8d26f683fb4281fbcd756d6f5..99e4e097abdfbb253ed8ad7a92c12fe972eb180f 100644 --- a/app/code/Magento/Core/Model/Locale.php +++ b/app/code/Magento/Core/Model/Locale.php @@ -24,13 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model; + /** * Locale model - * - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Model; - class Locale implements \Magento\Core\Model\LocaleInterface { /** @@ -61,6 +59,9 @@ class Locale implements \Magento\Core\Model\LocaleInterface */ protected $_emulatedLocales = array(); + /** + * @var array + */ protected static $_currencyCache = array(); /** @@ -102,6 +103,11 @@ class Locale implements \Magento\Core\Model\LocaleInterface */ protected $_app; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\Translate $translate @@ -110,6 +116,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale\Config $config * @param \Magento\Core\Model\App $app + * @param \Magento\Stdlib\DateTime $dateTime * @param string $locale */ public function __construct( @@ -120,6 +127,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale\Config $config, \Magento\Core\Model\App $app, + \Magento\Stdlib\DateTime $dateTime, $locale = null ) { $this->_eventManager = $eventManager; @@ -129,6 +137,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface $this->_storeManager = $storeManager; $this->_config = $config; $this->_app = $app; + $this->dateTime = $dateTime; $this->setLocale($locale); } @@ -241,7 +250,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface } /** - * Get options array for locale dropdown in currunt locale + * Get options array for locale dropdown in current locale * * @return array */ @@ -266,7 +275,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface * @param bool $translatedName translation flag * @return array */ - protected function _getOptionLocales($translatedName=false) + protected function _getOptionLocales($translatedName = false) { $options = array(); $locales = $this->getLocale()->getLocaleList(); @@ -274,7 +283,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface $countries = $this->getCountryTranslationList(); $allowed = $this->getAllowLocales(); - foreach ($locales as $code=>$active) { + foreach (array_keys($locales) as $code) { if (strstr($code, '_')) { if (!in_array($code, $allowed)) { continue; @@ -309,7 +318,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface $options= array(); $zones = $this->getTranslationList('windowstotimezone'); ksort($zones); - foreach ($zones as $code=>$name) { + foreach ($zones as $code => $name) { $name = trim($name); $options[] = array( 'label' => empty($name) ? $code : $name . ' (' . $code . ')', @@ -359,7 +368,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface /** * Retrieve currency option list * - * @return unknown + * @return array */ public function getOptionCurrencies() { @@ -367,7 +376,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface $options = array(); $allowed = $this->getAllowCurrencies(); - foreach ($currencies as $name=>$code) { + foreach ($currencies as $name => $code) { if (!in_array($code, $allowed)) { continue; } @@ -383,7 +392,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface /** * Retrieve all currency option list * - * @return unknown + * @return array */ public function getOptionAllCurrencies() { @@ -398,6 +407,10 @@ class Locale implements \Magento\Core\Model\LocaleInterface return $this->_sortOptionArray($options); } + /** + * @param array $option + * @return array + */ protected function _sortOptionArray($option) { $data = array(); @@ -428,12 +441,13 @@ class Locale implements \Magento\Core\Model\LocaleInterface /** * Retrieve array of allowed currencies * - * @return unknown + * @return array */ public function getAllowCurrencies() { if ($this->_appState->isInstalled()) { - $data = $this->_storeManager->getStore()->getConfig(\Magento\Core\Model\LocaleInterface::XML_PATH_ALLOW_CURRENCIES_INSTALLED); + $data = $this->_storeManager->getStore() + ->getConfig(\Magento\Core\Model\LocaleInterface::XML_PATH_ALLOW_CURRENCIES_INSTALLED); return explode(',', $data); } else { $data = $this->_config->getAllowedCurrencies(); @@ -447,7 +461,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface * @param string $type * @return string */ - public function getDateFormat($type=null) + public function getDateFormat($type = null) { return $this->getTranslation($type, 'date'); } @@ -470,7 +484,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface * @param string $type * @return string */ - public function getTimeFormat($type=null) + public function getTimeFormat($type = null) { return $this->getTranslation($type, 'time'); } @@ -491,7 +505,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface * * @param mixed $date * @param string $part - * @param string|Zend_Locale $locale + * @param string|\Zend_Locale $locale * @param bool $useTimezone * @return \Zend_Date */ @@ -507,7 +521,9 @@ class Locale implements \Magento\Core\Model\LocaleInterface } $date = new \Zend_Date($date, $part, $locale); if ($useTimezone) { - if ($timezone = $this->_storeManager->getStore()->getConfig(\Magento\Core\Model\LocaleInterface::XML_PATH_DEFAULT_TIMEZONE)) { + $timezone = $this->_storeManager->getStore() + ->getConfig(\Magento\Core\Model\LocaleInterface::XML_PATH_DEFAULT_TIMEZONE); + if ($timezone) { $date->setTimezone($timezone); } } @@ -525,7 +541,8 @@ class Locale implements \Magento\Core\Model\LocaleInterface */ public function storeDate($store=null, $date=null, $includeTime=false) { - $timezone = $this->_storeManager->getStore($store)->getConfig(\Magento\Core\Model\LocaleInterface::XML_PATH_DEFAULT_TIMEZONE); + $timezone = $this->_storeManager->getStore($store) + ->getConfig(\Magento\Core\Model\LocaleInterface::XML_PATH_DEFAULT_TIMEZONE); $date = new \Zend_Date($date, null, $this->getLocale()); $date->setTimezone($timezone); if (!$includeTime) { @@ -542,7 +559,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface * or in format which was passed as parameter. * * @param mixed $store Information about store - * @param string|integer|Zend_Date|array|null $date date in store's timezone + * @param string|integer|\Zend_Date|array|null $date date in store's timezone * @param boolean $includeTime flag for including time to date * @param null|string $format * @return \Zend_Date @@ -564,7 +581,8 @@ class Locale implements \Magento\Core\Model\LocaleInterface */ public function storeTimeStamp($store=null) { - $timezone = $this->_storeManager->getStore($store)->getConfig(\Magento\Core\Model\LocaleInterface::XML_PATH_DEFAULT_TIMEZONE); + $timezone = $this->_storeManager->getStore($store) + ->getConfig(\Magento\Core\Model\LocaleInterface::XML_PATH_DEFAULT_TIMEZONE); $currentTimezone = @date_default_timezone_get(); @date_default_timezone_set($timezone); $date = date('Y-m-d H:i:s'); @@ -681,7 +699,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface if ($pos !== false){ $requiredPrecision = strlen($t) - $pos - $totalPrecision; } - $group = 0; + if (strrpos($format, ',') !== false) { $group = ($decimalPoint - strrpos($format, ',') - 1); } else { @@ -718,7 +736,7 @@ class Locale implements \Magento\Core\Model\LocaleInterface )); $this->_localeCode = $this->_locale->toString(); - $this->_translate->initTranslate($this->_localeCode, \Magento\Core\Model\App\Area::AREA_FRONTEND, true); + $this->_translate->initTranslate($this->_localeCode, true); } else { $this->_emulatedLocales[] = false; } @@ -726,7 +744,6 @@ class Locale implements \Magento\Core\Model\LocaleInterface /** * Get last locale, used before last emulation - * */ public function revert() { @@ -735,13 +752,13 @@ class Locale implements \Magento\Core\Model\LocaleInterface $this->_locale = $locale; $this->_localeCode = $this->_locale->toString(); - $this->_translate->initTranslate($this->_localeCode, \Magento\Core\Model\App\Area::AREA_ADMINHTML, true); + $this->_translate->initTranslate($this->_localeCode, true); } } /** * Returns localized informations as array, supported are several - * types of informations. + * types of information. * For detailed information about the types look into the documentation * * @param string $path (Optional) Type of information to return @@ -810,8 +827,8 @@ class Locale implements \Magento\Core\Model\LocaleInterface } $result = false; - if (!is_empty_date($dateFrom) && $storeTimeStamp < $fromTimeStamp) { - } elseif (!is_empty_date($dateTo) && $storeTimeStamp > $toTimeStamp) { + if (!$this->dateTime->isEmptyDate($dateFrom) && $storeTimeStamp < $fromTimeStamp) { + } elseif (!$this->dateTime->isEmptyDate($dateTo) && $storeTimeStamp > $toTimeStamp) { } else { $result = true; } diff --git a/app/code/Magento/Core/Model/Locale/Config.php b/app/code/Magento/Core/Model/Locale/Config.php index d22e4c06161eb88ce25809980aa2305fb99bf7a2..6afb000941cf7fa9f270e0e022c52745997c34ef 100644 --- a/app/code/Magento/Core/Model/Locale/Config.php +++ b/app/code/Magento/Core/Model/Locale/Config.php @@ -114,57 +114,38 @@ class Config 'TRL' /*Old Turkish Lira*/,'XPF' /*CFP Franc*/ ); - /** - * @var \Magento\Core\Model\Config - */ - protected $_coreConfig; /** - * Constructor - * - * @param \Magento\Core\Model\Config $coreConfig + * @param array $data */ - public function __construct( - \Magento\Core\Model\Config $coreConfig - ) { - $this->_coreConfig = $coreConfig; + public function __construct(array $data = array()) + { + if (isset($data['allowedLocales']) && is_array($data['allowedLocales'])) { + $this->_allowedLocales = array_merge($this->_allowedLocales, $data['allowedLocales']); + } + + if (isset($data['allowedCurrencies']) && is_array($data['allowedCurrencies'])) { + $this->_allowedCurrencies = array_merge($this->_allowedCurrencies, $data['allowedCurrencies']); + } } /** - * Get list preconfigured allowed locales + * Get list pre-configured allowed locales * * @return array */ public function getAllowedLocales() { - $configData = $this->_coreConfig->getNode(\Magento\Core\Model\LocaleInterface::XML_PATH_ALLOW_CODES); - if ($configData) { - $configData = $configData->asArray(); - } - if ($configData) { - $configData = array_keys($configData); - } else { - $configData = array(); - } - return array_merge($this->_allowedLocales, $configData); + return $this->_allowedLocales; } /** - * Get list preconfigured allowed currencies + * Get list pre-configured allowed currencies * * @return array */ public function getAllowedCurrencies() { - $configData = $this->_coreConfig->getNode(\Magento\Core\Model\LocaleInterface::XML_PATH_ALLOW_CURRENCIES); - if ($configData) { - $configData = $configData->asArray(); - } - if ($configData) { - $configData = array_keys($configData); - } else { - $configData = array(); - } - return array_merge($this->_allowedCurrencies, $configData); + return $this->_allowedCurrencies; } } diff --git a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/SchemaLocator.php b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/SchemaLocator.php index 1b937f16941dab58909262eed5709656cb1cca5b..6e9c8ce18eb153a69f255dde542811f2ea893ae0 100644 --- a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/SchemaLocator.php +++ b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . DIRECTORY_SEPARATOR . 'locale.xsd'; } diff --git a/app/code/Magento/Core/Model/LocaleInterface.php b/app/code/Magento/Core/Model/LocaleInterface.php index b62b376b5a1c376a3611e2de01d280a173dbba6a..8965efa8d1aa7e57f27aa1ed71b3df1f3e812755 100644 --- a/app/code/Magento/Core/Model/LocaleInterface.php +++ b/app/code/Magento/Core/Model/LocaleInterface.php @@ -45,8 +45,6 @@ interface LocaleInterface */ const XML_PATH_DEFAULT_LOCALE = 'general/locale/code'; const XML_PATH_DEFAULT_TIMEZONE = 'general/locale/timezone'; - const XML_PATH_ALLOW_CODES = 'global/locale/allow/codes'; - const XML_PATH_ALLOW_CURRENCIES = 'global/locale/allow/currencies'; const XML_PATH_ALLOW_CURRENCIES_INSTALLED = 'system/currency/installed'; /** diff --git a/app/code/Magento/Core/Model/Log/Adapter.php b/app/code/Magento/Core/Model/Log/Adapter.php index 93c3e4d6ccfed59abdd8be65805cb14930c6dec2..c373aa73a94bcb306d2ff8986131b058259ed814 100644 --- a/app/code/Magento/Core/Model/Log/Adapter.php +++ b/app/code/Magento/Core/Model/Log/Adapter.php @@ -58,17 +58,17 @@ class Adapter protected $_debugReplacePrivateDataKeys = array(); /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** * Set log file name * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param string $fileName */ - public function __construct(\Magento\Core\Model\Logger $logger, $fileName) + public function __construct(\Magento\Logger $logger, $fileName) { $this->_logFileName = $fileName; $this->_logger = $logger; diff --git a/app/code/Magento/Core/Model/ModuleManager.php b/app/code/Magento/Core/Model/ModuleManager.php index 3aa3b8e9a283db0205b4cec78fcef9c99a48de1a..1d81c896cda0756448015fb4e6119d6444a9bcbd 100644 --- a/app/code/Magento/Core/Model/ModuleManager.php +++ b/app/code/Magento/Core/Model/ModuleManager.php @@ -40,7 +40,7 @@ class ModuleManager private $_storeConfig; /** - * @var \Magento\App\ModuleListInterface + * @var \Magento\Module\ModuleListInterface */ private $_moduleList; @@ -51,12 +51,12 @@ class ModuleManager /** * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\ModuleListInterface $moduleList * @param array $outputConfigPaths */ public function __construct( \Magento\Core\Model\Store\ConfigInterface $storeConfig, - \Magento\App\ModuleListInterface $moduleList, + \Magento\Module\ModuleListInterface $moduleList, array $outputConfigPaths = array() ) { $this->_storeConfig = $storeConfig; diff --git a/app/code/Magento/Core/Model/ObjectManager.php b/app/code/Magento/Core/Model/ObjectManager.php deleted file mode 100644 index b06155b6cf359c3d767aaa4fced3d3a331456fdb..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/ObjectManager.php +++ /dev/null @@ -1,181 +0,0 @@ -<?php -/** - * Magento application object manager. Configures and application application - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model; - -/** - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ -class ObjectManager extends \Magento\ObjectManager\ObjectManager -{ - /** - * @var \Magento\Core\Model\ObjectManager - */ - protected static $_instance; - - /** - * @var \Magento\ObjectManager\Relations - */ - protected $_compiledRelations; - - /** - * Retrieve object manager - * - * TODO: Temporary solution for serialization, should be removed when Serialization problem is resolved - * - * @deprecated - * @return \Magento\ObjectManager - * @throws \RuntimeException - */ - public static function getInstance() - { - if (!self::$_instance instanceof \Magento\ObjectManager) { - throw new \RuntimeException('ObjectManager isn\'t initialized'); - } - return self::$_instance; - } - - /** - * Set object manager instance - * - * @param \Magento\ObjectManager $objectManager - * @throws \LogicException - */ - public static function setInstance(\Magento\ObjectManager $objectManager) - { - self::$_instance = $objectManager; - } - - /** - * @param \Magento\Core\Model\Config\Primary $primaryConfig - * @param \Magento\ObjectManager\Config $config - * @param array $sharedInstances - * @param \Magento\Core\Model\ObjectManager\ConfigLoader\Primary $primaryLoader - * @throws \Magento\BootstrapException - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function __construct( - \Magento\Core\Model\Config\Primary $primaryConfig, - \Magento\ObjectManager\Config $config = null, - $sharedInstances = array(), - \Magento\Core\Model\ObjectManager\ConfigLoader\Primary $primaryLoader = null - ) { - $definitionFactory = new \Magento\Core\Model\ObjectManager\DefinitionFactory($primaryConfig); - $definitions = $definitionFactory->createClassDefinition($primaryConfig); - $relations = $definitionFactory->createRelations(); - $config = $config ?: new \Magento\ObjectManager\Config\Config( - $relations, - $definitions - ); - - $localConfig = new \Magento\Core\Model\Config\Local(new \Magento\Core\Model\Config\Loader\Local( - $primaryConfig->getDirectories()->getDir(\Magento\App\Dir::CONFIG), - $primaryConfig->getParam(\Magento\Core\Model\App::PARAM_CUSTOM_LOCAL_CONFIG), - $primaryConfig->getParam(\Magento\Core\Model\App::PARAM_CUSTOM_LOCAL_FILE) - )); - $appMode = $primaryConfig->getParam(\Magento\Core\Model\App::PARAM_MODE, \Magento\App\State::MODE_DEFAULT); - $factory = new \Magento\ObjectManager\Factory\Factory($config, $this, $definitions, array_replace( - $localConfig->getParams(), - $primaryConfig->getParams() - )); - - $sharedInstances['Magento\Core\Model\Config\Local'] = $localConfig; - $sharedInstances['Magento\Core\Model\Config\Primary'] = $primaryConfig; - $sharedInstances['Magento\App\Dir'] = $primaryConfig->getDirectories(); - $sharedInstances['Magento\Core\Model\ObjectManager'] = $this; - - parent::__construct($factory, $config, $sharedInstances); - $primaryConfig->configure($this); - self::setInstance($this); - - \Magento\Profiler::start('global_primary'); - $primaryLoader = $primaryLoader ?: new \Magento\Core\Model\ObjectManager\ConfigLoader\Primary( - $primaryConfig->getDirectories(), - $appMode - ); - try { - $configData = $primaryLoader->load(); - } catch (\Exception $e) { - throw new \Magento\BootstrapException($e->getMessage()); - } - - if ($configData) { - $this->configure($configData); - } - - if ($definitions instanceof \Magento\ObjectManager\Definition\Compiled) { - $interceptorGenerator = null; - } else { - $autoloader = new \Magento\Autoload\IncludePath(); - $interceptorGenerator = new \Magento\Interception\CodeGenerator\CodeGenerator(new \Magento\Code\Generator( - null, - $autoloader, - new \Magento\Code\Generator\Io( - new \Magento\Io\File(), - $autoloader, - $primaryConfig->getDirectories()->getDir(\Magento\App\Dir::GENERATION) - ) - )); - } - - \Magento\Profiler::stop('global_primary'); - $verification = $this->get('Magento\App\Dir\Verification'); - $verification->createAndVerifyDirectories(); - - $this->_config->setCache($this->get('Magento\Core\Model\ObjectManager\ConfigCache')); - $this->configure($this->get('Magento\Core\Model\ObjectManager\ConfigLoader')->load('global')); - - $interceptionConfig = $this->create('Magento\Interception\Config\Config', array( - 'relations' => $definitionFactory->createRelations(), - 'omConfig' => $this->_config, - 'codeGenerator' => $interceptorGenerator, - 'classDefinitions' => $definitions instanceof \Magento\ObjectManager\Definition\Compiled - ? $definitions - : null, - 'cacheId' => 'interception', - )); - - $pluginList = $this->create('Magento\Interception\PluginList\PluginList', array( - 'relations' => $definitionFactory->createRelations(), - 'definitions' => $definitionFactory->createPluginDefinition(), - 'omConfig' => $this->_config, - 'classDefinitions' => $definitions instanceof \Magento\ObjectManager\Definition\Compiled - ? $definitions - : null, - 'scopePriorityScheme' => array('global'), - 'cacheId' => 'pluginlist', - )); - $this->_sharedInstances['Magento\Interception\PluginList\PluginList'] = $pluginList; - $this->_factory = $this->create('Magento\Interception\FactoryDecorator', array( - 'factory' => $this->_factory, - 'config' => $interceptionConfig, - 'pluginList' => $pluginList - )); - $this->get('Magento\Core\Model\Resource')->setConfig($this->get('Magento\Core\Model\Config\Resource')); - - self::setInstance($this); - } -} diff --git a/app/code/Magento/Core/Model/Observer.php b/app/code/Magento/Core/Model/Observer.php index 468be6d48c013cf3fc04b973873982a73d2d9c4f..0f27862cc22d2393e20f20b59579d5f8f61b8a73 100644 --- a/app/code/Magento/Core/Model/Observer.php +++ b/app/code/Magento/Core/Model/Observer.php @@ -64,7 +64,7 @@ class Observer protected $_registration; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -75,7 +75,7 @@ class Observer * @param \Magento\Core\Model\ConfigInterface $config * @param \Magento\Core\Model\Page\Asset\PublicFileFactory $assetFileFactory * @param \Magento\Core\Model\Theme\Registration $registration - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function __construct( \Magento\Core\Model\Cache\Frontend\Pool $cacheFrontendPool, @@ -84,7 +84,7 @@ class Observer \Magento\Core\Model\ConfigInterface $config, \Magento\Core\Model\Page\Asset\PublicFileFactory $assetFileFactory, \Magento\Core\Model\Theme\Registration $registration, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { $this->_cacheFrontendPool = $cacheFrontendPool; $this->_currentTheme = $design->getDesignTheme(); diff --git a/app/code/Magento/Core/Model/Page/Asset/Merged.php b/app/code/Magento/Core/Model/Page/Asset/Merged.php index 8224ff51ffd6c2030a432e3b9961f12ab0f99583..923dba4dac41ef575bddf3c5accdd1e23d9121b6 100644 --- a/app/code/Magento/Core/Model/Page/Asset/Merged.php +++ b/app/code/Magento/Core/Model/Page/Asset/Merged.php @@ -40,7 +40,7 @@ class Merged implements \Iterator private $_objectManager; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ private $_logger; @@ -68,15 +68,15 @@ class Merged implements \Iterator /** * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\Logger $logger, - * @param \Magento\App\Dir $dirs, + * @param \Magento\Logger $logger + * @param \Magento\App\Dir $dirs * @param \Magento\Core\Model\Page\Asset\MergeStrategyInterface $mergeStrategy * @param array $assets * @throws \InvalidArgumentException */ public function __construct( \Magento\ObjectManager $objectManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\App\Dir $dirs, \Magento\Core\Model\Page\Asset\MergeStrategyInterface $mergeStrategy, array $assets diff --git a/app/code/Magento/Core/Model/Page/Asset/Minified.php b/app/code/Magento/Core/Model/Page/Asset/Minified.php index 44594eefa746126a0c58aa26a6c0e6155070ce34..038c2ac108cc92d4e84eedba766987d73066e0a5 100644 --- a/app/code/Magento/Core/Model/Page/Asset/Minified.php +++ b/app/code/Magento/Core/Model/Page/Asset/Minified.php @@ -56,7 +56,7 @@ class Minified implements \Magento\Core\Model\Page\Asset\MergeableInterface protected $_viewUrl; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -64,13 +64,13 @@ class Minified implements \Magento\Core\Model\Page\Asset\MergeableInterface * @param \Magento\Core\Model\Page\Asset\LocalInterface $asset * @param \Magento\Code\Minifier $minifier * @param \Magento\Core\Model\View\Url $viewUrl - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function __construct( \Magento\Core\Model\Page\Asset\LocalInterface $asset, \Magento\Code\Minifier $minifier, \Magento\Core\Model\View\Url $viewUrl, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { $this->_originalAsset = $asset; $this->_minifier = $minifier; diff --git a/app/code/Magento/Core/Model/Resource/AbstractResource.php b/app/code/Magento/Core/Model/Resource/AbstractResource.php index f741acb5c33247f5663db918db7cd842b7e2820f..a9244af25de6c4e047677dddcd19e5824323b0ed 100644 --- a/app/code/Magento/Core/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Core/Model/Resource/AbstractResource.php @@ -132,29 +132,6 @@ abstract class AbstractResource return $this; } - /** - * Format date to internal format - * - * @param string|Zend_Date $date - * @param bool $includeTime - * @return string - */ - public function formatDate($date, $includeTime=true) - { - return \Magento\Date::formatDate($date, $includeTime); - } - - /** - * Convert internal date to UNIX timestamp - * - * @param string $str - * @return int - */ - public function mktime($str) - { - return \Magento\Date::toTimestamp($str); - } - /** * Serialize specified field in an object * @@ -240,7 +217,7 @@ abstract class AbstractResource { $type = strtolower($type); if ($type == 'decimal' || $type == 'numeric' || $type == 'float') { - $value = \Magento\Core\Model\ObjectManager::getInstance()->get('Magento\Core\Model\LocaleInterface') + $value = \Magento\App\ObjectManager::getInstance()->get('Magento\Core\Model\LocaleInterface') ->getNumber($value); } return $value; diff --git a/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php b/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php index 6ff0dc81f5e04923c26b5d73fa8875746756a115..f42c681b907fe0b42a2402ddd3a6dc6eda7d252c 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php +++ b/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php @@ -43,7 +43,7 @@ class Scoped extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollecti /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Config\Data $resource @@ -52,7 +52,7 @@ class Scoped extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollecti */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Config\Data $resource, diff --git a/app/code/Magento/Core/Model/Resource/Db/AbstractDb.php b/app/code/Magento/Core/Model/Resource/Db/AbstractDb.php index c7183640b2cfa3f301ddbc94b748ab02ebf37001..3d69a68fb81779e71b80d2271d5d779d00aba413 100644 --- a/app/code/Magento/Core/Model/Resource/Db/AbstractDb.php +++ b/app/code/Magento/Core/Model/Resource/Db/AbstractDb.php @@ -39,7 +39,7 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Cached resources singleton * - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resources; @@ -140,9 +140,9 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ - public function __construct(\Magento\Core\Model\Resource $resource) + public function __construct(\Magento\App\Resource $resource) { $this->_resources = $resource; parent::__construct(); @@ -165,7 +165,7 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource */ public function __wakeup() { - $this->_resources = \Magento\Core\Model\ObjectManager::getInstance()->get('Magento\Core\Model\Resource'); + $this->_resources = \Magento\App\ObjectManager::getInstance()->get('Magento\App\Resource'); } /** diff --git a/app/code/Magento/Core/Model/Resource/Db/Collection/AbstractCollection.php b/app/code/Magento/Core/Model/Resource/Db/Collection/AbstractCollection.php index 06108c61f90e19ead2371bebbb08511ca88577db..5e672bc3e264ef4e06d5f659d2abce6d3a0921fa 100644 --- a/app/code/Magento/Core/Model/Resource/Db/Collection/AbstractCollection.php +++ b/app/code/Magento/Core/Model/Resource/Db/Collection/AbstractCollection.php @@ -122,14 +122,14 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null @@ -473,7 +473,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db public function getResource() { if (empty($this->_resource)) { - $this->_resource = \Magento\Core\Model\ObjectManager::getInstance()->create($this->getResourceModelName()); + $this->_resource = \Magento\App\ObjectManager::getInstance()->create($this->getResourceModelName()); } return $this->_resource; } @@ -615,16 +615,4 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db } return $this; } - - /** - * Format Date to internal database date format - * - * @param int|string|Zend_Date $date - * @param boolean $includeTime - * @return string - */ - public function formatDate($date, $includeTime = true) - { - return \Magento\Date::formatDate($date, $includeTime); - } } diff --git a/app/code/Magento/Core/Model/Resource/Design.php b/app/code/Magento/Core/Model/Resource/Design.php index c55dcd97555df40ca1a8bc42bdc4ac83474f996b..420ad076a6d000231428493e5282052ae1b2463f 100644 --- a/app/code/Magento/Core/Model/Resource/Design.php +++ b/app/code/Magento/Core/Model/Resource/Design.php @@ -36,6 +36,23 @@ namespace Magento\Core\Model\Resource; class Design extends \Magento\Core\Model\Resource\Db\AbstractDb { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\App\Resource $resource + */ + public function __construct( + \Magento\Stdlib\DateTime $dateTime, + \Magento\App\Resource $resource + ) { + $this->dateTime = $dateTime; + parent::__construct($resource); + } + /** * Define main table and primary key * @@ -55,20 +72,20 @@ class Design extends \Magento\Core\Model\Resource\Db\AbstractDb public function _beforeSave(\Magento\Core\Model\AbstractModel $object) { if ($date = $object->getDateFrom()) { - $object->setDateFrom($this->formatDate($date)); + $object->setDateFrom($this->dateTime->formatDate($date)); } else { $object->setDateFrom(null); } if ($date = $object->getDateTo()) { - $object->setDateTo($this->formatDate($date)); + $object->setDateTo($this->dateTime->formatDate($date)); } else { $object->setDateTo(null); } if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) - && \Magento\Date::toTimestamp($object->getDateFrom()) > \Magento\Date::toTimestamp($object->getDateTo())) { + && $this->dateTime->toTimestamp($object->getDateFrom()) > $this->dateTime->toTimestamp($object->getDateTo())) { throw new \Magento\Core\Exception(__('Start date cannot be greater than end date.')); } diff --git a/app/code/Magento/Core/Model/Resource/Design/Collection.php b/app/code/Magento/Core/Model/Resource/Design/Collection.php index ba7e7d8994574c3c4189f5dcd0a8912ff650d02c..5532e71c107f5ab84d6fdc7259e5aeca62c06359 100644 --- a/app/code/Magento/Core/Model/Resource/Design/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Design/Collection.php @@ -24,21 +24,40 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\Resource\Design; /** * Core Design resource collection - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Model\Resource\Design; - class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Logger $logger + * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy + * @param \Magento\Core\Model\EntityFactory $entityFactory + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + */ + public function __construct( + \Magento\Event\ManagerInterface $eventManager, + \Magento\Logger $logger, + \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, + \Magento\Core\Model\EntityFactory $entityFactory, + \Magento\Stdlib\DateTime $dateTime, + \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + ) { + $this->dateTime = $dateTime; + parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $resource); + } + /** * Core Design resource collection - * */ protected function _construct() { @@ -53,9 +72,10 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl public function joinStore() { return $this->join( - array('cs' => 'core_store'), - 'cs.store_id = main_table.store_id', - array('cs.name')); + array('cs' => 'core_store'), + 'cs.store_id = main_table.store_id', + array('cs.name') + ); } /** @@ -67,9 +87,9 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl public function addDateFilter($date = null) { if (is_null($date)) { - $date = $this->formatDate(true); + $date = $this->dateTime->formatDate(true); } else { - $date = $this->formatDate($date); + $date = $this->dateTime->formatDate($date); } $this->addFieldToFilter('date_from', array('lteq' => $date)); diff --git a/app/code/Magento/Core/Model/Resource/Email/Template.php b/app/code/Magento/Core/Model/Resource/Email/Template.php index 5d0c942f19c4441dc328bf80edbe10f22a7323d1..dcc5f0ef537b89a6f75cdea2b1e57350e28f3a9f 100644 --- a/app/code/Magento/Core/Model/Resource/Email/Template.php +++ b/app/code/Magento/Core/Model/Resource/Email/Template.php @@ -36,6 +36,21 @@ namespace Magento\Core\Model\Resource\Email; class Template extends \Magento\Core\Model\Resource\Db\AbstractDb { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\App\Resource $resource + */ + public function __construct(\Magento\Stdlib\DateTime $dateTime, \Magento\App\Resource $resource) + { + $this->dateTime = $dateTime; + parent::__construct($resource); + } + /** * Initialize email template resource model * @@ -97,15 +112,15 @@ class Template extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Set template type, added at and modified at time * - * @param \Magento\Core\Model\Email\Template $object + * @param \Magento\Core\Model\AbstractModel $object * @return \Magento\Core\Model\Resource\Email\Template */ protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) { if ($object->isObjectNew()) { - $object->setCreatedAt($this->formatDate(true)); + $object->setCreatedAt($this->dateTime->formatDate(true)); } - $object->setModifiedAt($this->formatDate(true)); + $object->setModifiedAt($this->dateTime->formatDate(true)); $object->setTemplateType((int)$object->getTemplateType()); return parent::_beforeSave($object); diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php b/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php index a5fbc55f93b4cd2f3043ea461f35969ea06f130a..f1592f6616676ded64af761fb0fe08e3c7bc2643 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\Resource\File\Storage; /** - * Abstract storage resource model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Class AbstractStorage */ -namespace Magento\Core\Model\Resource\File\Storage; - abstract class AbstractStorage extends \Magento\Core\Model\Resource\Db\AbstractDb { /** diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/Database.php b/app/code/Magento/Core/Model/Resource/File/Storage/Database.php index 4692784c198b7934dc52d18d3a5611b3fc6f986f..b15d5cc14c728c779a063810073f8910ae75ef10 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/Database.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/Database.php @@ -24,30 +24,25 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\Resource\File\Storage; /** - * File storage database resource resource model class - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Class Database */ -namespace Magento\Core\Model\Resource\File\Storage; - class Database extends \Magento\Core\Model\Resource\File\Storage\AbstractStorage { /** - * @var \Magento\Core\Model\Resource\Helper\AbstractHelper + * @var \Magento\Core\Model\Resource\Helper */ protected $_resourceHelper; /** - * @param \Magento\Core\Model\Resource $resource - * @param \Magento\Core\Model\Resource\Helper\AbstractHelper $resourceHelper + * @param \Magento\App\Resource $resource + * @param \Magento\Core\Model\Resource\Helper $resourceHelper */ public function __construct( - \Magento\Core\Model\Resource $resource, - \Magento\Core\Model\Resource\Helper\AbstractHelper $resourceHelper + \Magento\App\Resource $resource, + \Magento\Core\Model\Resource\Helper $resourceHelper ) { parent::__construct($resource); $this->_resourceHelper = $resourceHelper; diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/Directory/Database.php b/app/code/Magento/Core/Model/Resource/File/Storage/Directory/Database.php index e386a1c69b6b7684916d76a631fdc9c829f73aff..76e3a98c3a1dee44e74baddecb1697b673825af8 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/Directory/Database.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/Directory/Database.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\Resource\File\Storage\Directory; /** - * \Directory storage database resource model class - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Class Database */ -namespace Magento\Core\Model\Resource\File\Storage\Directory; - class Database extends \Magento\Core\Model\Resource\File\Storage\AbstractStorage { /** diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/File.php b/app/code/Magento/Core/Model/Resource/File/Storage/File.php index ee13ca750ad4f06019105240f9ae9f532ba3dc56..d65e2714edd258e966995aa9ac891674b7b3f92c 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/File.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/File.php @@ -24,17 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\Resource\File\Storage; /** - * Model for synchronization from DB to filesystem - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Class File */ -namespace Magento\Core\Model\Resource\File\Storage; - -class File extends \Magento\Core\Model\Resource\AbstractResource +class File { /** * Prefix of model events names @@ -54,19 +49,19 @@ class File extends \Magento\Core\Model\Resource\AbstractResource protected $_dbHelper; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Helper\File\Storage\Database $dbHelper - * @param \Magento\Core\Model\Logger $log + * @param \Magento\Logger $log */ public function __construct( \Magento\Filesystem $filesystem, \Magento\Core\Helper\File\Storage\Database $dbHelper, - \Magento\Core\Model\Logger $log + \Magento\Logger $log ) { $this->_dbHelper = $dbHelper; $this->_logger = $log; @@ -202,30 +197,6 @@ class File extends \Magento\Core\Model\Resource\AbstractResource return false; } - /** - * @inheritDoc - */ - protected function _construct() - { - return $this; - } - - /** - * @inheritDoc - */ - protected function _getReadAdapter() - { - return false; - } - - /** - * @inheritDoc - */ - protected function _getWriteAdapter() - { - return false; - } - /** * Get path relative to media base directory * diff --git a/app/code/Magento/Core/Model/Resource/Helper.php b/app/code/Magento/Core/Model/Resource/Helper.php index aafc6432f5d59c52e329210f1f13cafb78e3e22d..4d6e02c0cc6cd641da9ab4852fd9ba0d6b9e4425 100644 --- a/app/code/Magento/Core/Model/Resource/Helper.php +++ b/app/code/Magento/Core/Model/Resource/Helper.php @@ -32,11 +32,11 @@ namespace Magento\Core\Model\Resource; class Helper extends \Magento\Core\Model\Resource\Helper\AbstractHelper { /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param string $modulePrefix */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, $modulePrefix = 'core' ) { parent::__construct($resource, $modulePrefix); diff --git a/app/code/Magento/Core/Model/Resource/Helper/AbstractHelper.php b/app/code/Magento/Core/Model/Resource/Helper/AbstractHelper.php index d9a5b32f501c641a24c91c15e9c9a6e675fc4738..8314fd89e20cc2db95695c20c33779766129558b 100644 --- a/app/code/Magento/Core/Model/Resource/Helper/AbstractHelper.php +++ b/app/code/Magento/Core/Model/Resource/Helper/AbstractHelper.php @@ -53,18 +53,18 @@ abstract class AbstractHelper protected $_modulePrefix; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; /** * Initialize resource helper instance * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param string $modulePrefix */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, $modulePrefix ) { $this->_resource = $resource; diff --git a/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php b/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php index c3ec9ea85c351351237e677dfaec2fe9f230e81f..e4768e3007c52b5da30acfed791ce383cf3e5179 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php @@ -24,13 +24,38 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\Resource\Layout\Link; + /** * Layout update collection model */ -namespace Magento\Core\Model\Resource\Layout\Link; - class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Logger $logger + * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy + * @param \Magento\Core\Model\EntityFactory $entityFactory + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + */ + public function __construct( + \Magento\Event\ManagerInterface $eventManager, + \Magento\Logger $logger, + \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, + \Magento\Core\Model\EntityFactory $entityFactory, + \Magento\Stdlib\DateTime $dateTime, + \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + ) { + $this->dateTime = $dateTime; + parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $resource); + } + /** * Define resource model */ @@ -97,7 +122,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl $datetime = new \DateTime(); $storeInterval = new \DateInterval('P' . $days . 'D'); $datetime->sub($storeInterval); - $formattedDate = $this->formatDate($datetime->getTimestamp()); + $formattedDate = $this->dateTime->formatDate($datetime->getTimestamp()); $this->_joinWithUpdate(); $this->addFieldToFilter('update.updated_at', array('notnull' => true)) diff --git a/app/code/Magento/Core/Model/Resource/Layout/Update.php b/app/code/Magento/Core/Model/Resource/Layout/Update.php index 37b921a5f41b3c468e22f317683725d88116c932..543ba58a6738296277d927e85ab0625c59ecfcab 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Update.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Update.php @@ -37,11 +37,11 @@ class Update extends \Magento\Core\Model\Resource\Db\AbstractDb private $_cache; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Cache\FrontendInterface $cache */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Cache\FrontendInterface $cache ) { parent::__construct($resource); diff --git a/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php b/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php index 3fcb63cfc74df2a21ba75a8e5866e23f78f0e987..849986844c8af55c90c1ebcce8449222b8e57d1e 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php @@ -45,6 +45,31 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ protected $_eventObject = 'layout_update_collection'; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Logger $logger + * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy + * @param \Magento\Core\Model\EntityFactory $entityFactory + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + */ + public function __construct( + \Magento\Event\ManagerInterface $eventManager, + \Magento\Logger $logger, + \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, + \Magento\Core\Model\EntityFactory $entityFactory, + \Magento\Stdlib\DateTime $dateTime, + \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + ) { + $this->dateTime = $dateTime; + parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $resource); + } + /** * Define resource model */ @@ -139,7 +164,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl $datetime = new \DateTime(); $storeInterval = new \DateInterval('P' . $days . 'D'); $datetime->sub($storeInterval); - $formattedDate = $this->formatDate($datetime->getTimestamp()); + $formattedDate = $this->dateTime->formatDate($datetime->getTimestamp()); $this->addFieldToFilter('main_table.updated_at', array('notnull' => true)) ->addFieldToFilter('main_table.updated_at', array('lt' => $formattedDate)); diff --git a/app/code/Magento/Core/Model/Resource/Session.php b/app/code/Magento/Core/Model/Resource/Session.php index 913c2fb12be2b1a4688bf551cef0053685298dc1..184ae7b992ce5d72f71ca5ae58adf5382362e716 100644 --- a/app/code/Magento/Core/Model/Resource/Session.php +++ b/app/code/Magento/Core/Model/Resource/Session.php @@ -65,10 +65,10 @@ class Session implements \Zend_Session_SaveHandler_Interface /** * Constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\App\Dir $dir */ - public function __construct(\Magento\Core\Model\Resource $resource, \Magento\App\Dir $dir) + public function __construct(\Magento\App\Resource $resource, \Magento\App\Dir $dir) { $this->_sessionTable = $resource->getTableName('core_session'); $this->_write = $resource->getConnection('core_write'); diff --git a/app/code/Magento/Core/Model/Resource/Setup.php b/app/code/Magento/Core/Model/Resource/Setup.php index 1bdde6f9065e3fb7eb4f165d60dd9651580128cb..b9d8d40a136d490482cd6d41761919c93ec11d35 100644 --- a/app/code/Magento/Core/Model/Resource/Setup.php +++ b/app/code/Magento/Core/Model/Resource/Setup.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Resource; -class Setup implements \Magento\App\Updater\SetupInterface +class Setup implements \Magento\Module\Updater\SetupInterface { /** * Setup resource name @@ -69,14 +69,14 @@ class Setup implements \Magento\App\Updater\SetupInterface /** * Modules configuration * - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resourceModel; /** * Modules configuration reader * - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_modulesReader; @@ -86,7 +86,7 @@ class Setup implements \Magento\App\Updater\SetupInterface protected $_eventManager; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; diff --git a/app/code/Magento/Core/Model/Resource/Setup/Context.php b/app/code/Magento/Core/Model/Resource/Setup/Context.php index d885f8dd82d5e10405e4ba4ba4bcfffdda0f2fcc..ec0d15c0c9fd498e82fe1a47754fc282c34140fa 100644 --- a/app/code/Magento/Core/Model/Resource/Setup/Context.php +++ b/app/code/Magento/Core/Model/Resource/Setup/Context.php @@ -26,7 +26,7 @@ namespace Magento\Core\Model\Resource\Setup; class Context implements \Magento\ObjectManager\ContextInterface { /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -36,17 +36,17 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_eventManager; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resourceModel; /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_modulesReader; /** - * @var \Magento\App\ModuleListInterface + * @var \Magento\Module\ModuleListInterface */ protected $_moduleList; @@ -71,26 +71,33 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_themeFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @var \Magento\Encryption\EncryptorInterface + */ + protected $_encryptor; + + /** + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource $resource - * @param \Magento\Core\Model\Config\Modules\Reader $modulesReader - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\App\Resource $resource + * @param \Magento\Module\Dir\Reader $modulesReader + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\Resource\Resource $resourceResource * @param \Magento\Core\Model\Resource\Setup\MigrationFactory $migrationFactory * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory * @param \Magento\Core\Model\Theme\CollectionFactory $themeFactory + * @param \Magento\Encryption\EncryptorInterface $encryptor */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource $resource, - \Magento\Core\Model\Config\Modules\Reader $modulesReader, - \Magento\App\ModuleListInterface $moduleList, + \Magento\App\Resource $resource, + \Magento\Module\Dir\Reader $modulesReader, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\Resource\Resource $resourceResource, \Magento\Core\Model\Resource\Setup\MigrationFactory $migrationFactory, \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory, - \Magento\Core\Model\Theme\CollectionFactory $themeFactory + \Magento\Core\Model\Theme\CollectionFactory $themeFactory, + \Magento\Encryption\EncryptorInterface $encryptor ) { $this->_logger = $logger; $this->_eventManager = $eventManager; @@ -101,6 +108,7 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_migrationFactory = $migrationFactory; $this->_themeResourceFactory = $themeResourceFactory; $this->_themeFactory = $themeFactory; + $this->_encryptor = $encryptor; } /** @@ -112,7 +120,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\Logger + * @return \Magento\Logger $logger */ public function getLogger() { @@ -120,7 +128,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\App\ModuleListInterface + * @return \Magento\Module\ModuleListInterface */ public function getModuleList() { @@ -128,7 +136,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\Config\Modules\Reader + * @return \Magento\Module\Dir\Reader */ public function getModulesReader() { @@ -136,7 +144,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\Resource + * @return \Magento\App\Resource */ public function getResourceModel() { @@ -174,4 +182,12 @@ class Context implements \Magento\ObjectManager\ContextInterface { return $this->_themeResourceFactory; } + + /** + * @return \Magento\Encryption\EncryptorInterface + */ + public function getEncryptor() + { + return $this->_encryptor; + } } diff --git a/app/code/Magento/Core/Model/Resource/Translate.php b/app/code/Magento/Core/Model/Resource/Translate.php index 215efc0aff9cbe39b5cf4dab5e6f34ed5cd3edc0..e554b91bf26d118e240612affb417bcac3fca429 100644 --- a/app/code/Magento/Core/Model/Resource/Translate.php +++ b/app/code/Magento/Core/Model/Resource/Translate.php @@ -47,12 +47,12 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_storeManager; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\App\State $appState * @param \Magento\Core\Model\StoreManager $storeManager */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\App\State $appState, \Magento\Core\Model\StoreManager $storeManager ) { diff --git a/app/code/Magento/Core/Model/Resource/Translate/String.php b/app/code/Magento/Core/Model/Resource/Translate/String.php index 9947009037f2ffaeaad41c782da8511cfbc3c7a0..121c84331ccb1596bbe85fba3c9a085f69a3b7c2 100644 --- a/app/code/Magento/Core/Model/Resource/Translate/String.php +++ b/app/code/Magento/Core/Model/Resource/Translate/String.php @@ -47,12 +47,12 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_storeManager; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Core\Model\StoreManager $storeManager */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\LocaleInterface $locale, \Magento\Core\Model\StoreManager $storeManager ) { diff --git a/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php b/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php index b0540c2c950a8bb34f62f1174737558f5eca7c5d..fb2c95f97380d64db6632ff8765140f1fb1929c7 100644 --- a/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php +++ b/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php @@ -24,7 +24,7 @@ namespace Magento\Core\Model\Resource\Type\Db\Pdo; class Mysql extends \Magento\Core\Model\Resource\Type\Db - implements \Magento\Core\Model\Resource\ConnectionAdapterInterface + implements \Magento\App\Resource\ConnectionAdapterInterface { /** * Dirs instance @@ -33,6 +33,16 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db */ protected $_dirs; + /** + * @var \Magento\Stdlib\String + */ + protected $string; + + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @var array */ @@ -50,6 +60,8 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db /** * @param \Magento\App\Dir $dirs + * @param \Magento\Stdlib\String $string + * @param \Magento\Stdlib\DateTime $dateTime * @param string $host * @param string $username * @param string $password @@ -61,6 +73,8 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db */ public function __construct( \Magento\App\Dir $dirs, + \Magento\Stdlib\String $string, + \Magento\Stdlib\DateTime $dateTime, $host, $username, $password, @@ -71,6 +85,8 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db $active = false ) { $this->_dirs = $dirs; + $this->string = $string; + $this->dateTime = $dateTime; $this->_connectionConfig = array( 'host' => $host, 'username' => $username, @@ -120,7 +136,7 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db protected function _getDbAdapterInstance() { $className = $this->_getDbAdapterClassName(); - $adapter = new $className($this->_dirs, $this->_connectionConfig); + $adapter = new $className($this->_dirs, $this->string, $this->dateTime, $this->_connectionConfig); return $adapter; } diff --git a/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php b/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php index 63d5e9da94e4f7ab86b8a59f4f35837908fd0f37..9f8d128b74554eaa719269c13f75e1f5ac95014b 100644 --- a/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php @@ -43,7 +43,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\StoreManager $storeManager @@ -51,7 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManager $storeManager, diff --git a/app/code/Magento/Core/Model/Route/Config.php b/app/code/Magento/Core/Model/Route/Config.php deleted file mode 100644 index bcef10fa580a4e8068b5db71a81277f72dd87a1b..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Route/Config.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php -/** - * Routes configuration model - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Route; - -class Config implements \Magento\Core\Model\Route\ConfigInterface -{ - /** - * @var \Magento\Core\Model\Route\Config\Reader - */ - protected $_reader; - - /** - * @var \Magento\Cache\FrontendInterface - */ - protected $_cache; - - /** - * @var string - */ - protected $_cacheId; - - /** - * @param \Magento\Core\Model\Route\Config\Reader $reader - * @param \Magento\Config\CacheInterface $cache - * @param string $cacheId - */ - public function __construct( - \Magento\Core\Model\Route\Config\Reader $reader, - \Magento\Config\CacheInterface $cache, - $cacheId = 'RoutesConfig' - ) { - $this->_reader = $reader; - $this->_cache = $cache; - $this->_cacheId = $cacheId; - } - - /** - * Fetch routes from configs by area code and router id - * - * @param string $areaCode - * @param string $routerId - * @return array - */ - public function getRoutes($areaCode, $routerId) - { - $cacheId = $areaCode . '::' . $this->_cacheId . '-' . $routerId; - $cachedRoutes = unserialize($this->_cache->load($cacheId)); - if (is_array($cachedRoutes)) { - return $cachedRoutes; - } - - $routes = array(); - $areaConfig = $this->_reader->read($areaCode); - if (array_key_exists($routerId, $areaConfig)) { - $routes = $areaConfig[$routerId]['routes']; - $this->_cache->save(serialize($routes), $cacheId); - } - - return $routes; - } -} diff --git a/app/code/Magento/Core/Model/Session.php b/app/code/Magento/Core/Model/Session.php index d4ca885fc172258ef2e1f5351d80fe6b490175be..7dce363aafc82bf168a56534c664839ad71a4655 100644 --- a/app/code/Magento/Core/Model/Session.php +++ b/app/code/Magento/Core/Model/Session.php @@ -39,25 +39,24 @@ namespace Magento\Core\Model; class Session extends \Magento\Core\Model\Session\AbstractSession { /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Math\Random */ - protected $_coreData; + protected $mathRandom; /** * @param \Magento\Core\Model\Session\Context $context - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Math\Random $mathRandom * @param array $data * @param string|null $sessionName + * @internal param \Magento\Core\Helper\Data $coreData */ public function __construct( \Magento\Core\Model\Session\Context $context, - \Magento\Core\Helper\Data $coreData, + \Magento\Math\Random $mathRandom, array $data = array(), $sessionName = null ) { - $this->_coreData = $coreData; + $this->mathRandom = $mathRandom; parent::__construct($context, $data); $this->init('core', $sessionName); } @@ -70,7 +69,7 @@ class Session extends \Magento\Core\Model\Session\AbstractSession public function getFormKey() { if (!$this->getData('_form_key')) { - $this->setData('_form_key', $this->_coreData->getRandomString(16)); + $this->setData('_form_key', $this->mathRandom->getRandomString(16)); } return $this->getData('_form_key'); } diff --git a/app/code/Magento/Core/Model/Session/AbstractSession.php b/app/code/Magento/Core/Model/Session/AbstractSession.php index 3760d5fd63664f4f2f55363ede94a9e9a69a9cfc..68190b051df64c19339e2a49c7f9f2121b761682 100644 --- a/app/code/Magento/Core/Model/Session/AbstractSession.php +++ b/app/code/Magento/Core/Model/Session/AbstractSession.php @@ -65,17 +65,10 @@ class AbstractSession extends \Magento\Object protected $_skipSessionIdFlag = false; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; - /** - * Core http - * - * @var \Magento\Core\Helper\Http - */ - protected $_coreHttp = null; - /** * Core event manager proxy * @@ -169,7 +162,6 @@ class AbstractSession extends \Magento\Object ) { $this->_validator = $context->getValidator(); $this->_eventManager = $context->getEventManager(); - $this->_coreHttp = $context->getHttpHelper(); $this->_logger = $context->getLogger(); $this->_coreStoreConfig = $context->getStoreConfig(); $this->_savePath = $this->_savePath ?: $context->getSavePath(); @@ -211,7 +203,7 @@ class AbstractSession extends \Magento\Object case 'db': ini_set('session.save_handler', 'user'); /* @var $sessionResource \Magento\Core\Model\Resource\Session */ - $sessionResource = \Magento\Core\Model\ObjectManager::getInstance() + $sessionResource = \Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Model\Resource\Session'); $sessionResource->setSaveHandler(); break; diff --git a/app/code/Magento/Core/Model/Session/Context.php b/app/code/Magento/Core/Model/Session/Context.php index 530e968a78fd91ec146f0c8ec49fd9f3a27516fa..8fd753c920421ea9b562e85c7221d993fab3611e 100644 --- a/app/code/Magento/Core/Model/Session/Context.php +++ b/app/code/Magento/Core/Model/Session/Context.php @@ -33,7 +33,7 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_validator; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -42,11 +42,6 @@ class Context implements \Magento\ObjectManager\ContextInterface */ protected $_eventManager; - /** - * @var \Magento\Core\Helper\Http - */ - protected $_httpHelper; - /** * @var \Magento\Core\Model\Store\Config */ @@ -122,9 +117,8 @@ class Context implements \Magento\ObjectManager\ContextInterface /** * @param \Magento\Core\Model\Session\Validator $validator - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Message\CollectionFactory $messageFactory * @param \Magento\Core\Model\Message $message @@ -141,9 +135,8 @@ class Context implements \Magento\ObjectManager\ContextInterface */ public function __construct( \Magento\Core\Model\Session\Validator $validator, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Message\CollectionFactory $messageFactory, \Magento\Core\Model\Message $message, @@ -161,7 +154,6 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_validator = $validator; $this->_logger = $logger; $this->_eventManager = $eventManager; - $this->_httpHelper = $coreHttp; $this->_storeConfig = $coreStoreConfig; $this->_saveMethod = $saveMethod; $this->_savePath = $savePath; @@ -186,15 +178,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Helper\Http - */ - public function getHttpHelper() - { - return $this->_httpHelper; - } - - /** - * @return \Magento\Core\Model\Logger + * @return \\Magento\Logger */ public function getLogger() { diff --git a/app/code/Magento/Core/Model/Session/Validator.php b/app/code/Magento/Core/Model/Session/Validator.php index 5bd36fba9c76164d6bfbea3493cee55d416529cf..47f5e35ee94b3222cee224b180aef73647c4ef0d 100644 --- a/app/code/Magento/Core/Model/Session/Validator.php +++ b/app/code/Magento/Core/Model/Session/Validator.php @@ -42,9 +42,9 @@ class Validator protected $_storeConfig; /** - * @var \Magento\Core\Helper\Http + * @var \Magento\HTTP\PhpEnvironment\RemoteAddress */ - protected $_helper; + protected $_remoteAddress; /** * @var array @@ -53,16 +53,16 @@ class Validator /** * @param \Magento\Core\Model\Store\Config $storeConfig - * @param \Magento\Core\Helper\Http $helper + * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress * @param array $skippedUserAgentList */ public function __construct( \Magento\Core\Model\Store\Config $storeConfig, - \Magento\Core\Helper\Http $helper, + \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress, array $skippedUserAgentList = array() ) { $this->_storeConfig = $storeConfig; - $this->_helper = $helper; + $this->_remoteAddress = $remoteAddress; $this->_skippedAgentList = $skippedUserAgentList; } @@ -143,8 +143,8 @@ class Validator ); // collect ip data - if ($this->_helper->getRemoteAddr()) { - $parts[self::VALIDATOR_REMOTE_ADDR_KEY] = $this->_helper->getRemoteAddr(); + if ($this->_remoteAddress->getRemoteAddress()) { + $parts[self::VALIDATOR_REMOTE_ADDR_KEY] = $this->_remoteAddress->getRemoteAddress(); } if (isset($_ENV['HTTP_VIA'])) { $parts[self::VALIDATOR_HTTP_VIA_KEY] = (string)$_ENV['HTTP_VIA']; diff --git a/app/code/Magento/Core/Model/Store.php b/app/code/Magento/Core/Model/Store.php index 990294d8f77fea04ac0e4a0b1a4c3acb7ce37ed2..fef96aefcfd4aa24fc5aee9c1a24aef9267cd9f7 100644 --- a/app/code/Magento/Core/Model/Store.php +++ b/app/code/Magento/Core/Model/Store.php @@ -287,7 +287,7 @@ class Store extends \Magento\Core\Model\AbstractModel /** * @var \Magento\Core\Model\Config */ - protected $_coreConfig; + protected $_config; /** * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase @@ -334,7 +334,7 @@ class Store extends \Magento\Core\Model\AbstractModel $this->_configDataResource = $configDataResource; $this->_isCustomEntryPoint = $isCustomEntryPoint; $this->_dir = $dir; - $this->_coreConfig = $coreConfig; + $this->_config = $coreConfig; parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_storeManager = $storeManager; } @@ -358,15 +358,15 @@ class Store extends \Magento\Core\Model\AbstractModel public function __wakeup() { parent::__wakeup(); - $this->_eventDispatcher = \Magento\Core\Model\ObjectManager::getInstance() + $this->_eventDispatcher = \Magento\App\ObjectManager::getInstance() ->get('Magento\Event\ManagerInterface'); - $this->_cacheManager = \Magento\Core\Model\ObjectManager::getInstance() - ->get('Magento\Core\Model\CacheInterface'); - $this->_coreStoreConfig = \Magento\Core\Model\ObjectManager::getInstance() + $this->_cacheManager = \Magento\App\ObjectManager::getInstance() + ->get('Magento\App\CacheInterface'); + $this->_coreStoreConfig = \Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Model\Store\Config'); - $this->_coreConfig = \Magento\Core\Model\ObjectManager::getInstance() + $this->_config = \Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Model\Config'); - $this->_coreFileStorageDatabase = \Magento\Core\Model\ObjectManager::getInstance() + $this->_coreFileStorageDatabase = \Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Helper\File\Storage\Database'); } @@ -386,7 +386,7 @@ class Store extends \Magento\Core\Model\AbstractModel protected function _getSession() { if (!$this->_session) { - $this->_session = \Magento\Core\Model\ObjectManager::getInstance()->create('Magento\Core\Model\Session') + $this->_session = \Magento\App\ObjectManager::getInstance()->create('Magento\Core\Model\Session') ->init('store_'.$this->getCode()); } return $this->_session; @@ -452,15 +452,11 @@ class Store extends \Magento\Core\Model\AbstractModel */ public function getConfig($path) { - $config = $this->_coreConfig; - $data = $config->getValue($path, 'store', $this->getCode()); + $data = $this->_config->getValue($path, 'store', $this->getCode()); if (!$data && !$this->_appState->isInstalled()) { - $data = $config->getValue($path, 'default'); + $data = $this->_config->getValue($path, 'default'); } - if ($data === false) { - return null; - } - return $data; + return ($data === false) ? null : $data; } /** @@ -474,7 +470,7 @@ class Store extends \Magento\Core\Model\AbstractModel */ public function setConfig($path, $value) { - $this->_coreConfig->setValue($path, $value, 'store', $this->getCode()); + $this->_config->setValue($path, $value, 'store', $this->getCode()); return $this; } @@ -714,7 +710,7 @@ class Store extends \Magento\Core\Model\AbstractModel public function isAdminUrlSecure() { if ($this->_isAdminSecure === null) { - $this->_isAdminSecure = (boolean) (int) (string) $this->_coreConfig + $this->_isAdminSecure = (boolean) (int) (string) $this->_config ->getValue(\Magento\Core\Model\Url::XML_PATH_SECURE_IN_ADMIN, 'default'); } return $this->_isAdminSecure; @@ -742,7 +738,7 @@ class Store extends \Magento\Core\Model\AbstractModel public function isCurrentlySecure() { $standardRule = !empty($_SERVER['HTTPS']) && ('off' != $_SERVER['HTTPS']); - $offloaderHeader = trim((string) $this->_coreConfig->getValue(self::XML_PATH_OFFLOADER_HEADER, 'default')); + $offloaderHeader = trim((string) $this->_config->getValue(self::XML_PATH_OFFLOADER_HEADER, 'default')); if ((!empty($offloaderHeader) && !empty($_SERVER[$offloaderHeader])) || $standardRule) { return true; @@ -780,7 +776,7 @@ class Store extends \Magento\Core\Model\AbstractModel { $configValue = $this->getConfig(\Magento\Core\Model\Store::XML_PATH_PRICE_SCOPE); if ($configValue == \Magento\Core\Model\Store::PRICE_SCOPE_GLOBAL) { - return \Magento\Core\Model\ObjectManager::getInstance() + return \Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Model\App')->getBaseCurrencyCode(); } else { return $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); @@ -796,7 +792,7 @@ class Store extends \Magento\Core\Model\AbstractModel { $currency = $this->getData('base_currency'); if (is_null($currency)) { - $currency = \Magento\Core\Model\ObjectManager::getInstance()->create('Magento\Directory\Model\Currency') + $currency = \Magento\App\ObjectManager::getInstance()->create('Magento\Directory\Model\Currency') ->load($this->getBaseCurrencyCode()); $this->setData('base_currency', $currency); } @@ -823,7 +819,7 @@ class Store extends \Magento\Core\Model\AbstractModel { $currency = $this->getData('default_currency'); if (is_null($currency)) { - $currency = \Magento\Core\Model\ObjectManager::getInstance()->create('Magento\Directory\Model\Currency') + $currency = \Magento\App\ObjectManager::getInstance()->create('Magento\Directory\Model\Currency') ->load($this->getDefaultCurrencyCode()); $this->setData('default_currency', $currency); } @@ -842,10 +838,10 @@ class Store extends \Magento\Core\Model\AbstractModel if (in_array($code, $this->getAvailableCurrencyCodes())) { $this->_getSession()->setCurrencyCode($code); if ($code == $this->getDefaultCurrency()) { - \Magento\Core\Model\ObjectManager::getInstance() + \Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Model\App')->getCookie()->delete(self::COOKIE_CURRENCY, $code); } else { - \Magento\Core\Model\ObjectManager::getInstance() + \Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Model\App')->getCookie()->set(self::COOKIE_CURRENCY, $code); } } @@ -924,7 +920,7 @@ class Store extends \Magento\Core\Model\AbstractModel $currency = $this->getData('current_currency'); if (is_null($currency)) { - $currency = \Magento\Core\Model\ObjectManager::getInstance()->create('Magento\Directory\Model\Currency') + $currency = \Magento\App\ObjectManager::getInstance()->create('Magento\Directory\Model\Currency') ->load($this->getCurrentCurrencyCode()); $baseCurrency = $this->getBaseCurrency(); @@ -1107,7 +1103,7 @@ class Store extends \Magento\Core\Model\AbstractModel { $sidQueryParam = $this->_getSession()->getSessionIdQueryParam(); $requestString = $this->getUrlModel()->escape(ltrim( - \Magento\Core\Model\ObjectManager::getInstance() + \Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Model\App')->getRequest()->getRequestString(), '/' )); @@ -1183,7 +1179,7 @@ class Store extends \Magento\Core\Model\AbstractModel protected function _beforeDelete() { $this->_protectFromNonAdmin(); - \Magento\Core\Model\ObjectManager::getInstance()->get('Magento\Index\Model\Indexer') + \Magento\App\ObjectManager::getInstance()->get('Magento\Index\Model\Indexer') ->logEvent($this, self::ENTITY, \Magento\Index\Model\Event::TYPE_DELETE); $this->_configDataResource->clearStoreData(array($this->getId())); return parent::_beforeDelete(); @@ -1209,7 +1205,7 @@ class Store extends \Magento\Core\Model\AbstractModel protected function _afterDeleteCommit() { parent::_afterDeleteCommit(); - \Magento\Core\Model\ObjectManager::getInstance()->get('Magento\Index\Model\Indexer') + \Magento\App\ObjectManager::getInstance()->get('Magento\Index\Model\Indexer') ->indexEvents(self::ENTITY, \Magento\Index\Model\Event::TYPE_DELETE); return $this; } @@ -1221,7 +1217,7 @@ class Store extends \Magento\Core\Model\AbstractModel */ public function resetConfig() { - $this->_coreConfig->reinit(); + $this->_config->reinit(); $this->_dirCache = array(); $this->_baseUrlCache = array(); $this->_urlCache = array(); diff --git a/app/code/Magento/Core/Model/Store/Config.php b/app/code/Magento/Core/Model/Store/Config.php index c9906eea1e8d2333c2d31680a9ff631c0239d316..60c99949a22d0fbaebf2ce669b2afc2c6030ba12 100644 --- a/app/code/Magento/Core/Model/Store/Config.php +++ b/app/code/Magento/Core/Model/Store/Config.php @@ -33,13 +33,34 @@ class Config implements \Magento\Core\Model\Store\ConfigInterface */ protected $_storeManager; + /** + * @var \Magento\Core\Model\ConfigInterface + */ + protected $_config; + + /** + * @var \Magento\Core\Model\Resource\Store\Collection + */ + protected $_storeCollection; + + /** + * @var \Magento\Core\Model\Resource\Store\CollectionFactory + */ + protected $_factory; + /** * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Model\ConfigInterface $config + * @param \Magento\Core\Model\Resource\Store\CollectionFactory $factory */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\Model\ConfigInterface $config, + \Magento\Core\Model\Resource\Store\CollectionFactory $factory ) { $this->_storeManager = $storeManager; + $this->_config = $config; + $this->_factory = $factory; } /** @@ -66,4 +87,51 @@ class Config implements \Magento\Core\Model\Store\ConfigInterface $flag = strtolower($this->getConfig($path, $store)); return !empty($flag) && 'false' !== $flag; } + + /** + * Retrieve store Ids for $path with checking + * + * if empty $allowValues then retrieve all stores values + * + * return array($storeId => $pathValue) + * + * @param string $path + * @param array $allowedValues + * @param string $keyAttribute + * @return array + * @throws \InvalidArgumentException + */ + public function getStoresConfigByPath($path, $allowedValues = array(), $keyAttribute = 'id') + { + if (is_null($this->_storeCollection)) { + $this->_storeCollection = $this->_factory->create(); + $this->_storeCollection->setLoadDefault(true); + } + $storeValues = array(); + /** @var $store \Magento\Core\Model\Store */ + foreach ($this->_storeCollection as $store) { + switch ($keyAttribute) { + case 'id': + $key = $store->getId(); + break; + case 'code': + $key = $store->getCode(); + break; + case 'name': + $key = $store->getName(); + break; + default: + throw new \InvalidArgumentException("'{$keyAttribute}' cannot be used as a key."); + break; + } + + $value = $this->_config->getValue($path, 'store', $store->getCode()); + if (empty($allowedValues)) { + $storeValues[$key] = $value; + } elseif (in_array($value, $allowedValues)) { + $storeValues[$key] = $value; + } + } + return $storeValues; + } } diff --git a/app/code/Magento/Core/Model/Store/Storage/Db.php b/app/code/Magento/Core/Model/Store/Storage/Db.php index 48006d75d331ff29094db2b588de344f74fbe8a8..eaff6813981d92b907bc7cc9276e0916183e5bb3 100644 --- a/app/code/Magento/Core/Model/Store/Storage/Db.php +++ b/app/code/Magento/Core/Model/Store/Storage/Db.php @@ -25,7 +25,22 @@ */ namespace Magento\Core\Model\Store\Storage; -class Db implements \Magento\Core\Model\Store\StorageInterface +use Magento\Backend\Model\Url\Proxy; +use Magento\Core\Exception; +use Magento\App\State; +use Magento\Core\Model\AppInterface; +use Magento\Core\Model\Config; +use Magento\Core\Model\Cookie; +use Magento\Core\Model\Store; +use Magento\Core\Model\Store\StorageInterface; +use Magento\Core\Model\Store\Group; +use Magento\Core\Model\Store\Exception as StoreException; +use Magento\Core\Model\StoreFactory; +use Magento\Core\Model\StoreManagerInterface; +use Magento\Core\Model\Website; +use Magento\Profiler; + +class Db implements StorageInterface { /** * Requested scope code @@ -58,42 +73,42 @@ class Db implements \Magento\Core\Model\Store\StorageInterface /** * Application store object * - * @var \Magento\Core\Model\Store + * @var Store */ protected $_store; /** * Stores cache * - * @var \Magento\Core\Model\Store[] + * @var Store[] */ protected $_stores = array(); /** * Application website object * - * @var \Magento\Core\Model\Website + * @var Website */ protected $_website; /** * Websites cache * - * @var \Magento\Core\Model\Website[] + * @var Website[] */ protected $_websites = array(); /** * Groups cache * - * @var \Magento\Core\Model\Store\Group[] + * @var Group */ protected $_groups = array(); /** * Config model * - * @var \Magento\Core\Model\Config + * @var Config */ protected $_config; @@ -107,55 +122,55 @@ class Db implements \Magento\Core\Model\Store\StorageInterface /** * Store factory * - * @var \Magento\Core\Model\StoreFactory + * @var StoreFactory */ protected $_storeFactory; /** * Website factory * - * @var \Magento\Core\Model\Website\Factory + * @var Website\Factory */ protected $_websiteFactory; /** * Group factory * - * @var \Magento\Core\Model\Store\Group\Factory + * @var Group\Factory */ protected $_groupFactory; /** * Cookie model * - * @var \Magento\Core\Model\Cookie + * @var Cookie */ protected $_cookie; /** * Application state model * - * @var \Magento\App\State + * @var State */ protected $_appState; /** * @var \Magento\Backend\Model\Url\Proxy */ - protected $_proxy; + protected $_url; /** - * @param \Magento\Core\Model\StoreFactory $storeFactory - * @param \Magento\Core\Model\Website\Factory $websiteFactory - * @param \Magento\Core\Model\Store\Group\Factory $groupFactory - * @param \Magento\Core\Model\Config $config - * @param \Magento\Core\Model\Cookie $cookie - * @param \Magento\App\State $appState - * @param \Magento\Backend\Model\Url\Proxy $proxy - * @param bool $isSingleStoreAllowed - * @param string $scopeCode - * @param string $scopeType - * @param string $currentStore + * @param StoreFactory $storeFactory + * @param Website\Factory $websiteFactory + * @param Group\Factory $groupFactory + * @param Config $config + * @param Cookie $cookie + * @param State $appState + * @param \Magento\Backend\Model\Url $url + * @param $isSingleStoreAllowed + * @param $scopeCode + * @param $scopeType + * @param null $currentStore */ public function __construct( \Magento\Core\Model\StoreFactory $storeFactory, @@ -164,7 +179,7 @@ class Db implements \Magento\Core\Model\Store\StorageInterface \Magento\Core\Model\Config $config, \Magento\Core\Model\Cookie $cookie, \Magento\App\State $appState, - \Magento\Backend\Model\Url\Proxy $proxy, + \Magento\Backend\Model\Url $url, $isSingleStoreAllowed, $scopeCode, $scopeType, @@ -174,12 +189,12 @@ class Db implements \Magento\Core\Model\Store\StorageInterface $this->_websiteFactory = $websiteFactory; $this->_groupFactory = $groupFactory; $this->_scopeCode = $scopeCode; - $this->_scopeType = $scopeType ?: \Magento\Core\Model\StoreManagerInterface::SCOPE_TYPE_STORE; + $this->_scopeType = $scopeType ?: StoreManagerInterface::SCOPE_TYPE_STORE; $this->_config = $config; $this->_isSingleStoreAllowed = $isSingleStoreAllowed; $this->_appState = $appState; $this->_cookie = $cookie; - $this->_proxy = $proxy; + $this->_url = $url; if ($currentStore) { $this->_currentStore = $currentStore; } @@ -188,14 +203,14 @@ class Db implements \Magento\Core\Model\Store\StorageInterface /** * Get default store * - * @return \Magento\Core\Model\Store + * @return Store */ protected function _getDefaultStore() { if (empty($this->_store)) { $this->_store = $this->_storeFactory->create() - ->setId(\Magento\Core\Model\AppInterface::DISTRO_STORE_ID) - ->setCode(\Magento\Core\Model\AppInterface::DISTRO_STORE_CODE); + ->setId(AppInterface::DISTRO_STORE_ID) + ->setCode(AppInterface::DISTRO_STORE_CODE); } return $this->_store; } @@ -203,26 +218,26 @@ class Db implements \Magento\Core\Model\Store\StorageInterface /** * Initialize currently ran store * - * @throws \Magento\Core\Model\Store\Exception + * @throws StoreException */ public function initCurrentStore() { - \Magento\Profiler::start('init_stores'); + Profiler::start('init_stores'); $this->_initStores(); - \Magento\Profiler::stop('init_stores'); + Profiler::stop('init_stores'); if (empty($this->_scopeCode) && false == is_null($this->_website)) { $this->_scopeCode = $this->_website->getCode(); - $this->_scopeType = \Magento\Core\Model\StoreManagerInterface::SCOPE_TYPE_WEBSITE; + $this->_scopeType = StoreManagerInterface::SCOPE_TYPE_WEBSITE; } switch ($this->_scopeType) { - case \Magento\Core\Model\StoreManagerInterface::SCOPE_TYPE_STORE: + case StoreManagerInterface::SCOPE_TYPE_STORE: $this->_currentStore = $this->_scopeCode; break; - case \Magento\Core\Model\StoreManagerInterface::SCOPE_TYPE_GROUP: + case StoreManagerInterface::SCOPE_TYPE_GROUP: $this->_currentStore = $this->_getStoreByGroup($this->_scopeCode); break; - case \Magento\Core\Model\StoreManagerInterface::SCOPE_TYPE_WEBSITE: + case StoreManagerInterface::SCOPE_TYPE_WEBSITE: $this->_currentStore = $this->_getStoreByWebsite($this->_scopeCode); break; default: @@ -276,9 +291,9 @@ class Db implements \Magento\Core\Model\Store\StorageInterface if ($this->_currentStore == $store) { $store = $this->getStore($store); if ($store->getWebsite()->getDefaultStore()->getId() == $store->getId()) { - $this->_cookie->delete(\Magento\Core\Model\Store::COOKIE_NAME); + $this->_cookie->delete(Store::COOKIE_NAME); } else { - $this->_cookie->set(\Magento\Core\Model\Store::COOKIE_NAME, $this->_currentStore, true); + $this->_cookie->set(Store::COOKIE_NAME, $this->_currentStore, true); } } return; @@ -295,7 +310,7 @@ class Db implements \Magento\Core\Model\Store\StorageInterface return; } - $store = $this->_cookie->get(\Magento\Core\Model\Store::COOKIE_NAME); + $store = $this->_cookie->get(Store::COOKIE_NAME); if ($store && isset($this->_stores[$store]) && $this->_stores[$store]->getId() && $this->_stores[$store]->getIsActive() @@ -384,7 +399,7 @@ class Db implements \Magento\Core\Model\Store\StorageInterface $groupStores = array(); foreach ($storeCollection as $store) { - /** @var $store \Magento\Core\Model\Store */ + /** @var $store Store */ $store->setWebsite($websiteCollection->getItemById($store->getWebsiteId())); $store->setGroup($groupCollection->getItemById($store->getGroupId())); @@ -399,12 +414,12 @@ class Db implements \Magento\Core\Model\Store\StorageInterface } if (0 == $store->getId()) { - $store->setUrlModel($this->_proxy); + $store->setUrlModel($this->_url); } } foreach ($groupCollection as $group) { - /* @var $group \Magento\Core\Model\Store\Group */ + /* @var $group Group */ if (!isset($groupStores[$group->getId()])) { $groupStores[$group->getId()] = array(); } @@ -417,7 +432,7 @@ class Db implements \Magento\Core\Model\Store\StorageInterface } foreach ($websiteCollection as $website) { - /* @var $website \Magento\Core\Model\Website */ + /* @var $website Website */ if (!isset($websiteGroups[$website->getId()])) { $websiteGroups[$website->getId()] = array(); } @@ -458,9 +473,9 @@ class Db implements \Magento\Core\Model\Store\StorageInterface /** * Retrieve application store object * - * @param null|string|bool|int|\Magento\Core\Model\Store $storeId - * @return \Magento\Core\Model\Store - * @throws \Magento\Core\Model\Store\Exception + * @param null|string|bool|int|Store $storeId + * @return Store + * @throws StoreException */ public function getStore($storeId = null) { @@ -475,7 +490,7 @@ class Db implements \Magento\Core\Model\Store\StorageInterface if (!isset($storeId) || '' === $storeId || $storeId === true) { $storeId = $this->_currentStore; } - if ($storeId instanceof \Magento\Core\Model\Store) { + if ($storeId instanceof Store) { return $storeId; } if (!isset($storeId)) { @@ -504,7 +519,7 @@ class Db implements \Magento\Core\Model\Store\StorageInterface * * @param bool $withDefault * @param bool $codeKey - * @return \Magento\Core\Model\Store[] + * @return Store[] */ public function getStores($withDefault = false, $codeKey = false) { @@ -526,15 +541,15 @@ class Db implements \Magento\Core\Model\Store\StorageInterface /** * Retrieve application website object * - * @param null|bool|int|string|\Magento\Core\Model\Website $websiteId - * @return \Magento\Core\Model\Website - * @throws \Magento\Core\Exception + * @param null|bool|int|string|Website $websiteId + * @return Website + * @throws Exception */ public function getWebsite($websiteId = null) { - if (is_null($websiteId)) { + if ($websiteId === null || $websiteId === '') { $websiteId = $this->getStore()->getWebsiteId(); - } elseif ($websiteId instanceof \Magento\Core\Model\Website) { + } elseif ($websiteId instanceof Website) { return $websiteId; } elseif ($websiteId === true) { return $this->_website; @@ -545,7 +560,7 @@ class Db implements \Magento\Core\Model\Store\StorageInterface // load method will load website by code if given ID is not a numeric value $website->load($websiteId); if (!$website->hasWebsiteId()) { - throw new \Magento\Core\Exception('Invalid website id/code requested.'); + throw new Exception('Invalid website id/code requested.'); } $this->_websites[$website->getWebsiteId()] = $website; $this->_websites[$website->getCode()] = $website; @@ -558,7 +573,7 @@ class Db implements \Magento\Core\Model\Store\StorageInterface * * @param bool $withDefault * @param bool|string $codeKey - * @return \Magento\Core\Model\Website[] + * @return Website[] */ public function getWebsites($withDefault = false, $codeKey = false) { @@ -581,15 +596,15 @@ class Db implements \Magento\Core\Model\Store\StorageInterface /** * Retrieve application store group object * - * @param null|\Magento\Core\Model\Store\Group|string $groupId - * @return \Magento\Core\Model\Store\Group - * @throws \Magento\Core\Exception + * @param null|Group|string $groupId + * @return Group + * @throws Exception */ public function getGroup($groupId = null) { if (is_null($groupId)) { $groupId = $this->getStore()->getGroupId(); - } elseif ($groupId instanceof \Magento\Core\Model\Store\Group) { + } elseif ($groupId instanceof Group) { return $groupId; } if (empty($this->_groups[$groupId])) { @@ -597,7 +612,7 @@ class Db implements \Magento\Core\Model\Store\StorageInterface if (is_numeric($groupId)) { $group->load($groupId); if (!$group->hasGroupId()) { - throw new \Magento\Core\Exception('Invalid store group id requested.'); + throw new Exception('Invalid store group id requested.'); } } $this->_groups[$group->getGroupId()] = $group; @@ -612,14 +627,14 @@ class Db implements \Magento\Core\Model\Store\StorageInterface * * @param bool $withDefault * @param bool $codeKey - * @return \Magento\Core\Model\Store\Group[] + * @return Group */ public function getGroups($withDefault = false, $codeKey = false) { $groups = array(); if (is_array($this->_groups)) { foreach ($this->_groups as $group) { - /** @var $group \Magento\Core\Model\Store\Group */ + /** @var $group Group */ if (!$withDefault && $group->getId() == 0) { continue; } @@ -644,12 +659,12 @@ class Db implements \Magento\Core\Model\Store\StorageInterface /** * Retrieve default store for default group and website * - * @return \Magento\Core\Model\Store + * @return Store */ public function getDefaultStoreView() { foreach ($this->getWebsites() as $_website) { - /** @var $_website \Magento\Core\Model\Website */ + /** @var $_website Website */ if ($_website->getIsDefault()) { $_defaultStore = $this->getGroup($_website->getDefaultGroupId())->getDefaultStore(); if ($_defaultStore) { @@ -663,13 +678,13 @@ class Db implements \Magento\Core\Model\Store\StorageInterface /** * Unset website by id from app cache * - * @param null|bool|int|string|\Magento\Core\Model\Website $websiteId + * @param null|bool|int|string|Website $websiteId */ public function clearWebsiteCache($websiteId = null) { if (is_null($websiteId)) { $websiteId = $this->getStore()->getWebsiteId(); - } elseif ($websiteId instanceof \Magento\Core\Model\Website) { + } elseif ($websiteId instanceof Website) { $websiteId = $websiteId->getId(); } elseif ($websiteId === true) { $websiteId = $this->_website->getId(); @@ -686,7 +701,7 @@ class Db implements \Magento\Core\Model\Store\StorageInterface /** * Get either default or any store view * - * @return \Magento\Core\Model\Store|null + * @return Store|null */ public function getAnyStoreView() { @@ -712,11 +727,11 @@ class Db implements \Magento\Core\Model\Store\StorageInterface } /** - * @throws \Magento\Core\Model\Store\Exception + * @throws StoreException */ public function throwStoreException() { - throw new \Magento\Core\Model\Store\Exception(''); + throw new StoreException(''); } /** diff --git a/app/code/Magento/Core/Model/Store/StorageFactory.php b/app/code/Magento/Core/Model/Store/StorageFactory.php index 4abf47faceff6a86c7fff51c07e05909eb2647c4..e2c0285a87c1452ae9db29ea942d3ac3e7c766ec 100644 --- a/app/code/Magento/Core/Model/Store/StorageFactory.php +++ b/app/code/Magento/Core/Model/Store/StorageFactory.php @@ -55,15 +55,10 @@ class StorageFactory protected $_eventManager; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_log; - /** - * @var \Magento\Core\Model\ConfigInterface - */ - protected $_config; - /** * @var \Magento\Core\Model\AppInterface */ @@ -74,34 +69,39 @@ class StorageFactory */ protected $_appState; + /** + * @var string + */ + protected $_writerModel; + /** * @param \Magento\ObjectManager $objectManager * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $log - * @param \Magento\Core\Model\ConfigInterface $config + * @param \Magento\Logger $logger * @param \Magento\Core\Model\AppInterface $app * @param \Magento\App\State $appState * @param string $defaultStorageClassName * @param string $installedStoreClassName + * @param string $writerModel */ public function __construct( \Magento\ObjectManager $objectManager, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $log, - \Magento\Core\Model\ConfigInterface $config, + \Magento\Logger $logger, \Magento\Core\Model\AppInterface $app, \Magento\App\State $appState, $defaultStorageClassName = 'Magento\Core\Model\Store\Storage\DefaultStorage', - $installedStoreClassName = 'Magento\Core\Model\Store\Storage\Db' + $installedStoreClassName = 'Magento\Core\Model\Store\Storage\Db', + $writerModel = '' ) { $this->_objectManager = $objectManager; $this->_defaultStorageClassName = $defaultStorageClassName; $this->_installedStoreClassName = $installedStoreClassName; $this->_eventManager = $eventManager; - $this->_log = $log; + $this->_log = $logger; $this->_appState = $appState; - $this->_config = $config; $this->_app = $app; + $this->_writerModel = $writerModel; } /** @@ -123,7 +123,7 @@ class StorageFactory if (false === ($instance instanceof \Magento\Core\Model\Store\StorageInterface)) { throw new \InvalidArgumentException($className - . ' doesn\'t implement \Magento\Core\Model\Store\StorageInterface' + . ' doesn\'t implement \Magento\Core\Model\Store\StorageInterface' ); } $this->_cache[$className] = $instance; @@ -135,7 +135,18 @@ class StorageFactory $this->_eventManager->dispatch('core_app_init_current_store_after'); - $this->_log->initForStore($instance->getStore(true), $this->_config); + $store = $instance->getStore(true); + if ($store->getConfig('dev/log/active')) { + + $this->_log->unsetLoggers(); + $this->_log->addStreamLog( + \Magento\Logger::LOGGER_SYSTEM, $store->getConfig('dev/log/file'), $this->_writerModel); + $this->_log->addStreamLog( + \Magento\Logger::LOGGER_EXCEPTION, + $store->getConfig('dev/log/exception_file'), + $this->_writerModel + ); + } } } return $this->_cache[$className]; diff --git a/app/code/Magento/Core/Model/Theme.php b/app/code/Magento/Core/Model/Theme.php index 38fc8e2c31829d3ca7f2b0b4323fb5b32d1681ab..2bd65ac51513b3e84d26d2910bfe2bacd2501ffa 100644 --- a/app/code/Magento/Core/Model/Theme.php +++ b/app/code/Magento/Core/Model/Theme.php @@ -49,7 +49,6 @@ namespace Magento\Core\Model; * @method \Magento\View\Design\ThemeInterface setThemeCode(string $themeCode) * @method \Magento\View\Design\ThemeInterface setThemePath(string $themePath) * @method \Magento\View\Design\ThemeInterface setThemeVersion(string $themeVersion) - * @method \Magento\View\Design\ThemeInterface setArea(string $area) * @method \Magento\View\Design\ThemeInterface setThemeTitle(string $themeTitle) * @method \Magento\View\Design\ThemeInterface setType(int $type) * @method \Magento\View\Design\ThemeInterface setCode(string $code) @@ -115,6 +114,11 @@ class Theme extends \Magento\Core\Model\AbstractModel implements \Magento\View\D */ protected $_customFactory; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * All possible types of a theme * @@ -136,6 +140,7 @@ class Theme extends \Magento\Core\Model\AbstractModel implements \Magento\View\D * @param \Magento\Core\Model\Theme\ImageFactory $imageFactory * @param \Magento\Core\Model\Theme\Validator $validator * @param \Magento\Core\Model\Theme\CustomizationFactory $customizationFactory + * @param \Magento\App\State $appState * @param \Magento\Core\Model\Resource\Theme $resource * @param \Magento\Core\Model\Resource\Theme\Collection $resourceCollection * @param array $data @@ -150,6 +155,7 @@ class Theme extends \Magento\Core\Model\AbstractModel implements \Magento\View\D \Magento\Core\Model\Theme\ImageFactory $imageFactory, \Magento\Core\Model\Theme\Validator $validator, \Magento\Core\Model\Theme\CustomizationFactory $customizationFactory, + \Magento\App\State $appState, \Magento\Core\Model\Resource\Theme $resource = null, \Magento\Core\Model\Resource\Theme\Collection $resourceCollection = null, array $data = array() @@ -160,10 +166,10 @@ class Theme extends \Magento\Core\Model\AbstractModel implements \Magento\View\D $this->_imageFactory = $imageFactory; $this->_validator = $validator; $this->_customFactory = $customizationFactory; + $this->_appState = $appState; $this->addData(array( - 'type' => self::TYPE_VIRTUAL, - 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND + 'type' => self::TYPE_VIRTUAL )); } @@ -297,10 +303,11 @@ class Theme extends \Magento\Core\Model\AbstractModel implements \Magento\View\D /** * {@inheritdoc} + * @deprecated */ public function getArea() { - return $this->getData('area'); + return $this->_appState->getAreaCode(); } /** diff --git a/app/code/Magento/Core/Model/Theme/Data.php b/app/code/Magento/Core/Model/Theme/Data.php new file mode 100644 index 0000000000000000000000000000000000000000..539c2577d56ac247b3efa28c057ad9f148c3a122 --- /dev/null +++ b/app/code/Magento/Core/Model/Theme/Data.php @@ -0,0 +1,43 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Core + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Core\Model\Theme; + +/** + * Data model for themes + * + * @method \Magento\View\Design\ThemeInterface setArea(string $area) + */ +class Data extends \Magento\Core\Model\Theme +{ + /** + * {@inheritdoc} + */ + public function getArea() + { + return $this->getData('area'); + } +} diff --git a/app/code/Magento/Core/Model/Theme/Domain/Virtual.php b/app/code/Magento/Core/Model/Theme/Domain/Virtual.php index 491a5f0708753160ff3cfc30a19fdd7865a84256..bf1579275a30a749d0558d15db066d9216cac231 100644 --- a/app/code/Magento/Core/Model/Theme/Domain/Virtual.php +++ b/app/code/Magento/Core/Model/Theme/Domain/Virtual.php @@ -142,7 +142,6 @@ class Virtual 'theme_title' => sprintf('%s - Staging', $this->_theme->getThemeTitle()), 'preview_image' => $this->_theme->getPreviewImage(), 'is_featured' => $this->_theme->getIsFeatured(), - 'area' => $this->_theme->getArea(), 'type' => \Magento\Core\Model\Theme::TYPE_STAGING )); $stagingTheme->save(); diff --git a/app/code/Magento/Core/Model/Theme/Image.php b/app/code/Magento/Core/Model/Theme/Image.php index 19c0909655ee2e72078b90f040a804e859c2acfa..648093074d6fa087fafc6b641e5ac46d9a942f8b 100644 --- a/app/code/Magento/Core/Model/Theme/Image.php +++ b/app/code/Magento/Core/Model/Theme/Image.php @@ -52,7 +52,7 @@ class Image protected $_imageFactory; /** - * @var \Magento\Core\Model\Theme\Image\UploaderProxy + * @var \Magento\Core\Model\Theme\Image\Uploader */ protected $_uploader; @@ -62,7 +62,7 @@ class Image protected $_themeImagePath; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -78,7 +78,7 @@ class Image * @param \Magento\Core\Model\Image\Factory $imageFactory * @param \Magento\Core\Model\Theme\Image\Uploader $uploader * @param \Magento\Core\Model\Theme\Image\Path $themeImagePath - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\View\Design\ThemeInterface $theme */ public function __construct( @@ -86,7 +86,7 @@ class Image \Magento\Core\Model\Image\Factory $imageFactory, \Magento\Core\Model\Theme\Image\Uploader $uploader, \Magento\Core\Model\Theme\Image\Path $themeImagePath, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\View\Design\ThemeInterface $theme = null ) { $this->_filesystem = $filesystem; diff --git a/app/code/Magento/Core/Model/Translate.php b/app/code/Magento/Core/Model/Translate.php index ea8f4e757c7edfc2decdb577f13a37ca6d2e1828..d83df445b104b0330da393b669be5bf9d49e1df6 100644 --- a/app/code/Magento/Core/Model/Translate.php +++ b/app/code/Magento/Core/Model/Translate.php @@ -164,12 +164,12 @@ class Translate protected $_placeholderRender; /** - * @var \Magento\App\ModuleList + * @var \Magento\Module\ModuleList */ protected $_moduleList; /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_modulesReader; @@ -188,6 +188,11 @@ class Translate */ protected $_app; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\Core\Model\Locale\Hierarchy\Config $config @@ -195,12 +200,13 @@ class Translate * @param \Magento\Cache\FrontendInterface $cache * @param \Magento\Core\Model\View\FileSystem $viewFileSystem * @param \Magento\Phrase\Renderer\Placeholder $placeholderRender - * @param \Magento\App\ModuleList $moduleList - * @param \Magento\Core\Model\Config\Modules\Reader $modulesReader + * @param \Magento\Module\ModuleList $moduleList + * @param \Magento\Module\Dir\Reader $modulesReader * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Resource\Translate $translate * @param \Magento\Core\Model\App $app + * @param \Magento\App\State $appState * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -211,12 +217,13 @@ class Translate \Magento\Cache\FrontendInterface $cache, \Magento\Core\Model\View\FileSystem $viewFileSystem, \Magento\Phrase\Renderer\Placeholder $placeholderRender, - \Magento\App\ModuleList $moduleList, - \Magento\Core\Model\Config\Modules\Reader $modulesReader, + \Magento\Module\ModuleList $moduleList, + \Magento\Module\Dir\Reader $modulesReader, \Magento\Core\Model\Config $coreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Resource\Translate $translate, - \Magento\Core\Model\App $app + \Magento\Core\Model\App $app, + \Magento\App\State $appState ) { $this->_viewDesign = $viewDesign; $this->_localeHierarchy = $config->getHierarchy(); @@ -230,6 +237,7 @@ class Translate $this->_storeManager = $storeManager; $this->_translateResource = $translate; $this->_app = $app; + $this->_appState = $appState; } /** @@ -240,12 +248,13 @@ class Translate * @param bool $forceReload * @return \Magento\Core\Model\Translate */ - public function init($area, $initParams = null, $forceReload = false) + public function init($area = null, $initParams = null, $forceReload = false) { + $area = isset($area) ? $area : $this->_appState->getAreaCode(); $this->setConfig(array(self::CONFIG_KEY_AREA => $area)); $this->_translateInline = $this->getInlineObject($initParams)->isAllowed( - $area == \Magento\Backend\Helper\Data::BACKEND_AREA_CODE ? 'admin' : null); + $area == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE ? 'admin' : null); if (!$forceReload) { $this->_data = $this->_loadCache(); diff --git a/app/code/Magento/Core/Model/Translate/Inline.php b/app/code/Magento/Core/Model/Translate/Inline.php index ec89a025037c8ef2e3ba417b23f142b0c865d800..73c570bc9929a35782f755e36de4678a419225f7 100644 --- a/app/code/Magento/Core/Model/Translate/Inline.php +++ b/app/code/Magento/Core/Model/Translate/Inline.php @@ -84,6 +84,11 @@ class Inline implements \Magento\Core\Model\Translate\InlineInterface */ protected $_coreStoreConfig; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * Initialize inline translation model * @@ -93,6 +98,7 @@ class Inline implements \Magento\Core\Model\Translate\InlineInterface * @param \Magento\Core\Model\Url $url * @param \Magento\View\LayoutInterface $layout * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\State $appState */ public function __construct( \Magento\Core\Model\Translate\InlineParser $parser, @@ -100,7 +106,8 @@ class Inline implements \Magento\Core\Model\Translate\InlineInterface \Magento\Backend\Model\Url $backendUrl, \Magento\Core\Model\Url $url, \Magento\View\LayoutInterface $layout, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\State $appState ) { $this->_coreStoreConfig = $coreStoreConfig; $this->_parser = $parser; @@ -108,6 +115,7 @@ class Inline implements \Magento\Core\Model\Translate\InlineInterface $this->_backendUrl = $backendUrl; $this->_url = $url; $this->_layout = $layout; + $this->_appState = $appState; } /** @@ -147,7 +155,7 @@ class Inline implements \Magento\Core\Model\Translate\InlineInterface { $this->_parser->setIsJson($isJson); if (!$this->isAllowed()) { - if ($this->_parser->getDesignPackage()->getArea() == \Magento\Backend\Helper\Data::BACKEND_AREA_CODE) { + if ($this->_appState->getAreaCode() == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { $this->_stripInlineTranslations($body); } return $this; @@ -188,7 +196,7 @@ class Inline implements \Magento\Core\Model\Translate\InlineInterface $store = $this->_parser->getStoreManager()->getStore(); if ($store->isAdmin()) { - $urlPrefix = \Magento\Backend\Helper\Data::BACKEND_AREA_CODE; + $urlPrefix = \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE; $urlModel = $this->_backendUrl; } else { $urlPrefix = 'core'; diff --git a/app/code/Magento/Core/Model/Translate/InlineParser.php b/app/code/Magento/Core/Model/Translate/InlineParser.php index 9591182193869827afe0217897bed9f6ad464600..1ad7a39f9964ba4c8538ab09a6d9ec85f493b8ff 100644 --- a/app/code/Magento/Core/Model/Translate/InlineParser.php +++ b/app/code/Magento/Core/Model/Translate/InlineParser.php @@ -149,6 +149,11 @@ class InlineParser */ protected $_inputFilter; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * Initialize base inline translation model * @@ -157,19 +162,22 @@ class InlineParser * @param \Magento\View\DesignInterface $design * @param \Magento\Core\Helper\Data $helper * @param \Zend_Filter_Interface $inputFilter + * @param \Magento\App\State $appState */ public function __construct( \Magento\Core\Model\Resource\Translate\String $resource, \Magento\View\DesignInterface $design, \Magento\Core\Helper\Data $helper, \Magento\Core\Model\StoreManager $storeManager, - \Zend_Filter_Interface $inputFilter + \Zend_Filter_Interface $inputFilter, + \Magento\App\State $appState ) { $this->_resource = $resource; $this->_design = $design; $this->_helper = $helper; $this->_storeManager = $storeManager; $this->_inputFilter = $inputFilter; + $this->_appState = $appState; } /** @@ -216,7 +224,7 @@ class InlineParser $validStoreId = $this->_storeManager->getStore()->getId(); foreach ($translateParams as $param) { - if ($this->_design->getArea() == \Magento\Backend\Helper\Data::BACKEND_AREA_CODE) { + if ($this->_appState->getAreaCode() == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { $storeId = 0; } else if (empty($param['perstore'])) { $this->_resource->deleteTranslate($param['original'], null, false); diff --git a/app/code/Magento/Core/Model/Url.php b/app/code/Magento/Core/Model/Url.php index 6b458f92202604b96fba631dbceb10ee907cef87..5fcfd9e4c6cf24ddd3b7216255a9c6f3eaeacb45 100644 --- a/app/code/Magento/Core/Model/Url.php +++ b/app/code/Magento/Core/Model/Url.php @@ -131,13 +131,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface */ protected $_urlSecurityInfo; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * @var \Magento\Core\Model\Store\Config */ @@ -159,42 +152,47 @@ class Url extends \Magento\Object implements \Magento\UrlInterface protected $_session; /** - * Router list + * Constructor * - * @var \Magento\App\RouterListInterface + * @var \Magento\App\Route\ConfigInterface + */ + protected $_routeConfig; + + /** + * @var string */ - protected $_routerList; + protected $_areaCode; /** - * @param \Magento\App\RouterListInterface $routerList + * @param \Magento\App\Route\ConfigInterface $routeConfig * @param \Magento\App\RequestInterface $request * @param Url\SecurityInfoInterface $urlSecurityInfo * @param Store\Config $coreStoreConfig - * @param \Magento\Core\Helper\Data $coreData * @param App $app * @param StoreManager $storeManager * @param Session $session + * @param null $areaCode * @param array $data */ public function __construct( - \Magento\App\RouterListInterface $routerList, + \Magento\App\Route\ConfigInterface $routeConfig, \Magento\App\RequestInterface $request, Url\SecurityInfoInterface $urlSecurityInfo, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\App $app, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Session $session, + $areaCode = null, array $data = array() ) { $this->_request = $request; - $this->_routerList = $routerList; + $this->_routeConfig = $routeConfig; $this->_urlSecurityInfo = $urlSecurityInfo; $this->_coreStoreConfig = $coreStoreConfig; - $this->_coreData = $coreData; $this->_app = $app; $this->_storeManager = $storeManager; $this->_session = $session; + $this->_areaCode = $areaCode; parent::__construct($data); } @@ -596,10 +594,7 @@ class Url extends \Magento\Object implements \Magento\UrlInterface public function getRouteFrontName() { if (!$this->hasData('route_front_name')) { - $routeId = $this->getRouteName(); - $router = $this->_routerList->getRouterByRoute($routeId); - $frontName = $router->getFrontNameByRoute($routeId); - + $frontName = $this->_routeConfig->getRouteFrontName($this->getRouteName(), $this->_areaCode); $this->setRouteFrontName($frontName); } @@ -834,10 +829,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface $session = $this->_session; if (!$session->isValidForHost($this->getHost())) { if (!self::$_encryptedSessionId) { - $helper = $this->_coreData; - if (!$helper) { - return $this; - } self::$_encryptedSessionId = $session->getEncryptedSessionId(); } $this->setQueryParam($session->getSessionIdQueryParam(), self::$_encryptedSessionId); @@ -854,10 +845,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface public function addSessionParam() { if (!self::$_encryptedSessionId) { - $helper = $this->_coreData; - if (!$helper) { - return $this; - } self::$_encryptedSessionId = $this->_session->getEncryptedSessionId(); } $this->setQueryParam($this->_session->getSessionIdQueryParam(), self::$_encryptedSessionId); diff --git a/app/code/Magento/Core/Model/Validator/Factory.php b/app/code/Magento/Core/Model/Validator/Factory.php index 1d67c84c32befa21538285dcc02ad4b726cdaf42..c09108a60cbda7475d9463165bb5b165356768e0 100644 --- a/app/code/Magento/Core/Model/Validator/Factory.php +++ b/app/code/Magento/Core/Model/Validator/Factory.php @@ -48,12 +48,12 @@ class Factory * Initialize dependencies * * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader * @param \Magento\Core\Model\Translate $translator */ public function __construct( \Magento\ObjectManager $objectManager, - \Magento\Core\Model\Config\Modules\Reader $moduleReader, + \Magento\Module\Dir\Reader $moduleReader, \Magento\Core\Model\Translate $translator ) { $this->_objectManager = $objectManager; diff --git a/app/code/Magento/Core/Model/Variable.php b/app/code/Magento/Core/Model/Variable.php index 71be28e2aab7c295cf07baf8cafdfac9e50512fa..4e798263e457fc158f99eaff96ca5cc8ad8d62df 100644 --- a/app/code/Magento/Core/Model/Variable.php +++ b/app/code/Magento/Core/Model/Variable.php @@ -48,14 +48,12 @@ class Variable extends \Magento\Core\Model\AbstractModel protected $_storeId = 0; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Escaper */ - protected $_coreData = null; + protected $_escaper = null; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\Resource\Variable $resource @@ -63,14 +61,14 @@ class Variable extends \Magento\Core\Model\AbstractModel * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\Resource\Variable $resource, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreData = $coreData; + $this->_escaper = $escaper; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -132,7 +130,7 @@ class Variable extends \Magento\Core\Model\AbstractModel $value = $this->getData('plain_value'); //escape html if type is html, but html value is not defined if ($type == self::TYPE_HTML) { - $value = nl2br($this->_coreData->escapeHtml($value)); + $value = nl2br($this->_escaper->escapeHtml($value)); } return $value; } diff --git a/app/code/Magento/Core/Model/View/Config.php b/app/code/Magento/Core/Model/View/Config.php index 628d99c58c0dc53da6686b6e5c9af3cdbccc2b09..f847aed013cccee96e9a1b72ef2dcd0e4b5d106e 100644 --- a/app/code/Magento/Core/Model/View/Config.php +++ b/app/code/Magento/Core/Model/View/Config.php @@ -41,7 +41,7 @@ class Config implements \Magento\View\ConfigInterface /** * Module configuration reader * - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_moduleReader; @@ -65,13 +65,13 @@ class Config implements \Magento\View\ConfigInterface /** * View config model * - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\View\Service $viewService * @param \Magento\Core\Model\View\FileSystem $viewFileSystem */ public function __construct( - \Magento\Core\Model\Config\Modules\Reader $moduleReader, + \Magento\Module\Dir\Reader $moduleReader, \Magento\Filesystem $filesystem, \Magento\Core\Model\View\Service $viewService, \Magento\Core\Model\View\FileSystem $viewFileSystem diff --git a/app/code/Magento/Core/Model/View/Design.php b/app/code/Magento/Core/Model/View/Design.php index 9ee5dafee23fb33d78beb742ae822bcdc5d03c6a..7f924d65fb4ad1095a1bc63271745b014aeee54b 100644 --- a/app/code/Magento/Core/Model/View/Design.php +++ b/app/code/Magento/Core/Model/View/Design.php @@ -85,7 +85,7 @@ class Design implements \Magento\View\DesignInterface protected $_flyweightFactory; /** - * @var \Magento\Core\Model\Theme + * @var \Magento\Core\Model\ThemeFactory */ protected $_themeFactory; @@ -104,6 +104,11 @@ class Design implements \Magento\View\DesignInterface */ protected $_app; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Theme\FlyweightFactory $flyweightFactory @@ -111,6 +116,7 @@ class Design implements \Magento\View\DesignInterface * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig * @param \Magento\Core\Model\ThemeFactory $themeFactory * @param \Magento\Core\Model\App $app + * @param \Magento\App\State $appState * @param array $themes */ public function __construct( @@ -120,6 +126,7 @@ class Design implements \Magento\View\DesignInterface \Magento\Core\Model\Store\ConfigInterface $storeConfig, \Magento\Core\Model\ThemeFactory $themeFactory, \Magento\Core\Model\App $app, + \Magento\App\State $appState, array $themes ) { $this->_storeManager = $storeManager; @@ -127,6 +134,7 @@ class Design implements \Magento\View\DesignInterface $this->_themeFactory = $themeFactory; $this->_config = $config; $this->_storeConfig = $storeConfig; + $this->_appState = $appState; $this->_themes = $themes; $this->_app = $app; } @@ -134,6 +142,7 @@ class Design implements \Magento\View\DesignInterface /** * Set package area * + * @deprecated * @param string $area * @return \Magento\Core\Model\View\Design */ @@ -147,14 +156,12 @@ class Design implements \Magento\View\DesignInterface /** * Retrieve package area * + * @deprecated * @return string */ public function getArea() { - if (is_null($this->_area)) { - $this->_area = self::DEFAULT_AREA; - } - return $this->_area; + return $this->_appState->getAreaCode(); } /** @@ -168,12 +175,14 @@ class Design implements \Magento\View\DesignInterface { if ($area) { $this->setArea($area); + } else { + $area = $this->getArea(); } if ($theme instanceof \Magento\Core\Model\Theme) { $this->_theme = $theme; } else { - $this->_theme = $this->_flyweightFactory->create($theme, $this->getArea()); + $this->_theme = $this->_flyweightFactory->create($theme, $area); } return $this; @@ -278,7 +287,7 @@ class Design implements \Magento\View\DesignInterface public function getDesignParams() { $params = array( - 'area' => $this->getArea(), + 'area' => $this->_appState->getAreaCode(), 'themeModel' => $this->getDesignTheme(), 'locale' => $this->_app->getLocale()->getLocaleCode() ); diff --git a/app/code/Magento/Core/Model/View/Design/Proxy.php b/app/code/Magento/Core/Model/View/Design/Proxy.php index cae0f470c428e5a52856f9388841245c92030f1d..e671a3901769e6df162ee3037eb9643040447c7e 100644 --- a/app/code/Magento/Core/Model/View/Design/Proxy.php +++ b/app/code/Magento/Core/Model/View/Design/Proxy.php @@ -63,6 +63,7 @@ class Proxy implements \Magento\View\DesignInterface /** * Set package area * + * @deprecated * @param string $area * @return \Magento\View\DesignInterface */ @@ -74,6 +75,7 @@ class Proxy implements \Magento\View\DesignInterface /** * Retrieve package area * + * @deprecated * @return string */ public function getArea() diff --git a/app/code/Magento/Core/Model/View/Publisher.php b/app/code/Magento/Core/Model/View/Publisher.php index 1385462c67073f2aeb3e23407db10e4408e6951e..9bfa48b2abd4e4e70a4cfca27c6fe742a9ab278c 100644 --- a/app/code/Magento/Core/Model/View/Publisher.php +++ b/app/code/Magento/Core/Model/View/Publisher.php @@ -77,7 +77,7 @@ class Publisher implements \Magento\Core\Model\View\PublicFilesManagerInterface protected $_viewFileSystem; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -94,30 +94,30 @@ class Publisher implements \Magento\Core\Model\View\PublicFilesManagerInterface protected $_dir; /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_modulesReader; /** * View files publisher model * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Helper\Css $cssHelper * @param \Magento\Core\Model\View\Service $viewService * @param \Magento\Core\Model\View\FileSystem $viewFileSystem * @param \Magento\App\Dir $dir - * @param \Magento\Core\Model\Config\Modules\Reader $modulesReader + * @param \Magento\Module\Dir\Reader $modulesReader * @param $allowFilesDuplication */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Filesystem $filesystem, \Magento\Core\Helper\Css $cssHelper, \Magento\Core\Model\View\Service $viewService, \Magento\Core\Model\View\FileSystem $viewFileSystem, \Magento\App\Dir $dir, - \Magento\Core\Model\Config\Modules\Reader $modulesReader, + \Magento\Module\Dir\Reader $modulesReader, $allowFilesDuplication ) { $this->_filesystem = $filesystem; diff --git a/app/code/Magento/Core/Model/Website.php b/app/code/Magento/Core/Model/Website.php index 0a61ef52f9683ceb57605fae73e40c27df77986d..a67d2280841d6455a1759ac5c1b3b5457df09195 100644 --- a/app/code/Magento/Core/Model/Website.php +++ b/app/code/Magento/Core/Model/Website.php @@ -526,7 +526,6 @@ class Website extends \Magento\Core\Model\AbstractModel { $this->_storeManager->clearWebsiteCache($this->getId()); parent::_afterDelete(); - $this->_coreConfig->removeCache(); return $this; } diff --git a/app/code/Magento/Core/etc/config.xml b/app/code/Magento/Core/etc/config.xml index 95fa1fc257fe1772e8909965197fc7b87ecb01f2..f79a59e106164106a5053a017069e88db799c2ad 100644 --- a/app/code/Magento/Core/etc/config.xml +++ b/app/code/Magento/Core/etc/config.xml @@ -59,6 +59,9 @@ </js> </dev> <system> + <filesystem> + <media>{{media_dir}}</media> + </filesystem> <smtp> <disable>0</disable> <host>localhost</host> @@ -156,6 +159,8 @@ <locale> <firstday>0</firstday> <weekend>0,6</weekend> + <code>en_US</code> + <timezone>America/Los_Angeles</timezone> </locale> <file> <protected_extensions> diff --git a/app/code/Magento/Core/etc/config.xsd b/app/code/Magento/Core/etc/config.xsd new file mode 100644 index 0000000000000000000000000000000000000000..8642130de5eeae08b64bfd99d1237b1b975d9d53 --- /dev/null +++ b/app/code/Magento/Core/etc/config.xsd @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * This schema must be used to validate config.xml files + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:element name="config" type="configType" /> + <xs:complexType name="configType" mixed="true"> + <xs:choice maxOccurs="unbounded" minOccurs="0"> + <xs:element name="default" type="mixedDataType" /> + <xs:element name="stores" type="mixedDataType" /> + <xs:element name="websites" type="mixedDataType" /> + </xs:choice> + </xs:complexType> + <xs:complexType name="mixedDataType"> + <xs:choice> + <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" /> + </xs:choice> + </xs:complexType> +</xs:schema> diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index 4fbddcb7a2bca04bdace44e828d32f9e7f0198dc..2d9f468fa862b0bed83426390c3b8e625b00babf 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -25,8 +25,8 @@ --> <config> <preference for="Magento\Acl\CacheInterface" type="Magento\Core\Model\Acl\Cache" /> - <preference for="Magento\App\Updater\SetupInterface" type="Magento\Core\Model\Resource\Setup" /> - <preference for="Magento\App\Module\ResourceResolverInterface" type="Magento\App\Module\ResourceResolver" /> + <preference for="Magento\Module\Updater\SetupInterface" type="Magento\Core\Model\Resource\Setup" /> + <preference for="Magento\Module\ResourceResolverInterface" type="Magento\Module\ResourceResolver" /> <preference for="Magento\AuthorizationInterface" type="Magento\Authorization" /> <preference for="Magento\Authorization\Policy" type="Magento\Authorization\Policy\DefaultPolicy" /> <preference for="Magento\Authorization\RoleLocator" type="Magento\Authorization\RoleLocator\DefaultRoleLocator" /> @@ -43,15 +43,24 @@ <preference for="Magento\Config\ConverterInterface" type="Magento\Config\Converter\Dom"/> <preference for="Magento\Phrase\RendererInterface" type="Magento\Phrase\Renderer\Composite" /> <preference for="Magento\Core\Model\Url\SecurityInfoInterface" type="Magento\Core\Model\Url\SecurityInfo\Proxy" /> - <type name="Magento\App\FrontController"> - <plugin name="install" type="Magento\Core\App\FrontController\Plugin\Install" sortOrder="40"/> - <plugin name="requestPreprocessor" type="Magento\Core\App\FrontController\Plugin\RequestPreprocessor" sortOrder="50"/> + <preference for="Magento\App\DefaultPathInterface" type="Magento\App\DefaultPath\DefaultPath" /> + <preference for="Magento\Encryption\EncryptorInterface" type="Magento\Encryption\Encryptor" /> + <preference for="Magento\Filter\Encrypt\AdapterInterface" type=" Magento\Filter\Encrypt\Basic" /> + <type name="Magento\App\DefaultPath\DefaultPath"> + <param name="parts"> + <value> + <module>core</module> + <controller>index</controller> + <action>index</action> + </value> + </param> </type> <type name="Magento\App\AreaList"> <param name="areas"> <value> <frontend> <frontName /> + <router>standard</router> </frontend> </value> </param> @@ -223,7 +232,7 @@ </type> <type name="Magento\Core\Model\Theme\Image"> <param name="uploader"> - <instance type="Magento\Core\Model\Theme\Image\UploaderProxy" /> + <instance type="Magento\Core\Model\Theme\Image\Uploader\Proxy" /> </param> </type> <type name="Magento\Phrase\Renderer\Composite"> @@ -256,29 +265,7 @@ <instance type="Magento\Core\Model\Config\SectionPool\Proxy" /> </param> </type> - <type name="Magento\App\RouterList" shared="true"> - <param name="routerList"> - <value> - <standard> - <instance>Magento\Core\Controller\Varien\Router\Base</instance> - <disable type="bool">false</disable> - <sortOrder>20</sortOrder> - </standard> - <default> - <instance>Magento\App\Router\DefaultRouter</instance> - <disable type="bool">false</disable> - <sortOrder>100</sortOrder> - </default> - </value> - </param> - </type> - <type name="Magento\Core\Controller\Varien\Router\Base"> - <param name="areaCode"> - <value>frontend</value> - </param> - <param name="baseController"> - <value>Magento\Core\Controller\Varien\Action</value> - </param> + <type name="Magento\Core\App\Router\Base"> <param name="routerId"> <value>standard</value> </param> @@ -347,9 +334,6 @@ </param> </type> <type name="Magento\Core\Helper\Data"> - <param name="encryptor"> - <instance type="Magento\Core\Model\Encryption" /> - </param> <param name="locale"> <instance type="Magento\Core\Model\Locale\Proxy" /> </param> @@ -362,9 +346,9 @@ <value>app/etc/aliases_to_classes_map.json</value> </param> </type> - <type name="Magento\Core\Model\Encryption"> + <type name="Magento\Encryption\Encryptor"> <param name="cryptKey"> - <value type="argument">Magento\Core\Model\Encryption::PARAM_CRYPT_KEY</value> + <value type="argument">Magento\Encryption\Encryptor::PARAM_CRYPT_KEY</value> </param> </type> <type name="Magento\Core\Model\Session\Context"> @@ -399,11 +383,6 @@ <instance type="Magento\App\Request\Http\Proxy" /> </param> </type> - <type name="Magento\Core\Helper\String"> - <param name="locale"> - <instance type="Magento\Core\Model\Locale\Proxy" /> - </param> - </type> <type name="Magento\Core\Helper\File\Storage"> <param name="storage"> <instance type="Magento\Core\Model\File\Storage\Proxy" /> @@ -422,4 +401,17 @@ <type name="Magento\View\TemplateEngineFactory"> <plugin name="debug_hints" type="Magento\Core\Model\TemplateEngine\Plugin\DebugHints" sortOrder="10"/> </type> + <type name="Magento\Core\Model\Store\Storage\Db"> + <param name="url"> + <instance type="Magento\Backend\Model\Url\Proxy" /> + </param> + </type> + <type name="Magento\Core\Model\App"> + <param name="frontController"> + <instance type="Magento\App\FrontController\Proxy" /> + </param> + </type> + <type name="Magento\App\FrontController"> + <plugin name="dispatchExceptionHandler" type="Magento\Core\App\FrontController\Plugin\DispatchExceptionHandler" sortOrder="30"/> + </type> </config> diff --git a/app/code/Magento/Core/etc/frontend/di.xml b/app/code/Magento/Core/etc/frontend/di.xml index c0321b6804c3aadc74a29774b19608f1ce7386f3..e4378c51458cb96f47f4d5d576ef7c47e246c768 100644 --- a/app/code/Magento/Core/etc/frontend/di.xml +++ b/app/code/Magento/Core/etc/frontend/di.xml @@ -34,4 +34,24 @@ <value>frontend</value> </param> </type> + <type name="Magento\App\FrontController"> + <plugin name="requestPreprocessor" type="Magento\Core\App\FrontController\Plugin\RequestPreprocessor" sortOrder="50"/> + <plugin name="urlRewrite" type="Magento\Core\App\FrontController\Plugin\UrlRewrite" sortOrder="60"/> + </type> + <type name="Magento\App\RouterList" shared="true"> + <param name="routerList"> + <value> + <standard> + <instance>Magento\Core\App\Router\Base</instance> + <disable type="bool">false</disable> + <sortOrder>20</sortOrder> + </standard> + <default> + <instance>Magento\App\Router\DefaultRouter</instance> + <disable type="bool">false</disable> + <sortOrder>100</sortOrder> + </default> + </value> + </param> + </type> </config> diff --git a/app/code/Magento/Core/etc/layouts.xsd b/app/code/Magento/Core/etc/layouts.xsd index a4c8593c6b42f3df1d09ad58a2007085618312bd..4a7a5d954c5d9ff7b34f95d681e82424f3fa8589 100644 --- a/app/code/Magento/Core/etc/layouts.xsd +++ b/app/code/Magento/Core/etc/layouts.xsd @@ -55,8 +55,6 @@ <xs:element ref="move" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute type="xs:string" name="type"/> - <xs:attribute type="xs:string" name="parent"/> - <xs:attribute type="xs:string" name="owner"/> <xs:attribute type="xs:string" name="label"/> </xs:complexType> diff --git a/app/code/Magento/Core/functions.php b/app/code/Magento/Core/functions.php deleted file mode 100644 index c8264b4e4ede2db94e74ff5a9b8a30f134fa6053..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/functions.php +++ /dev/null @@ -1,309 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Object destructor - * - * @param mixed $object - */ -function destruct($object) -{ - if (is_array($object)) { - foreach ($object as $obj) { - destruct($obj); - } - } - unset($object); -} - -/** - * Tiny function to enhance functionality of ucwords - * - * Will capitalize first letters and convert separators if needed - * - * @param string $str - * @param string $destSep - * @param string $srcSep - * @return string - */ -function uc_words($str, $destSep = '_', $srcSep = '_') -{ - return str_replace(' ', $destSep, ucwords(str_replace($srcSep, ' ', $str))); -} - -/** - * Simple sql format date - * - * @param bool $dayOnly - * @return string - */ -function now($dayOnly = false) -{ - return date($dayOnly ? 'Y-m-d' : 'Y-m-d H:i:s'); -} - -/** - * Check whether sql date is empty - * - * @param string $date - * @return boolean - */ -function is_empty_date($date) -{ - return preg_replace('#[ 0:-]#', '', $date) === ''; -} - -/** - * Custom error handler - * - * @param integer $errorNo - * @param string $errorStr - * @param string $errorFile - * @param integer $errorLine - * @return bool - * @throws \Exception - */ -function mageCoreErrorHandler($errorNo, $errorStr, $errorFile, $errorLine) -{ - if (strpos($errorStr, 'DateTimeZone::__construct') !== false) { - // there's no way to distinguish between caught system exceptions and warnings - return false; - } - - $errorNo = $errorNo & error_reporting(); - if ($errorNo == 0) { - return false; - } - - // PEAR specific message handling - if (stripos($errorFile . $errorStr, 'pear') !== false) { - // ignore strict and deprecated notices - if (($errorNo == E_STRICT) || ($errorNo == E_DEPRECATED)) { - return true; - } - // ignore attempts to read system files when open_basedir is set - if ($errorNo == E_WARNING && stripos($errorStr, 'open_basedir') !== false) { - return true; - } - } - - $errorMessage = ''; - - switch ($errorNo) { - case E_ERROR: - $errorMessage .= "Error"; - break; - case E_WARNING: - $errorMessage .= "Warning"; - break; - case E_PARSE: - $errorMessage .= "Parse Error"; - break; - case E_NOTICE: - $errorMessage .= "Notice"; - break; - case E_CORE_ERROR: - $errorMessage .= "Core Error"; - break; - case E_CORE_WARNING: - $errorMessage .= "Core Warning"; - break; - case E_COMPILE_ERROR: - $errorMessage .= "Compile Error"; - break; - case E_COMPILE_WARNING: - $errorMessage .= "Compile Warning"; - break; - case E_USER_ERROR: - $errorMessage .= "User Error"; - break; - case E_USER_WARNING: - $errorMessage .= "User Warning"; - break; - case E_USER_NOTICE: - $errorMessage .= "User Notice"; - break; - case E_STRICT: - $errorMessage .= "Strict Notice"; - break; - case E_RECOVERABLE_ERROR: - $errorMessage .= "Recoverable Error"; - break; - case E_DEPRECATED: - $errorMessage .= "Deprecated functionality"; - break; - default: - $errorMessage .= "Unknown error ($errorNo)"; - break; - } - - $errorMessage .= ": {$errorStr} in {$errorFile} on line {$errorLine}"; - $exception = new \Exception($errorMessage); - $errorMessage .= $exception->getTraceAsString(); - $appState = \Magento\Core\Model\ObjectManager::getInstance()->get('Magento\App\State'); - if ($appState == \Magento\App\State::MODE_DEVELOPER) { - throw $exception; - } else { - $dirs = new \Magento\App\Dir('.'); - $fileSystem = new \Magento\Io\File(); - $logger = new \Magento\Core\Model\Logger($dirs, $fileSystem); - $logger->log($errorMessage, \Zend_Log::ERR); - } -} - -/** - * Pretty debug backtrace - * - * @param bool $return - * @param bool $html - * @param bool $showFirst - * @return string - */ -function mageDebugBacktrace($return = false, $html = true, $showFirst = false) -{ - $backTrace = debug_backtrace(); - $out = ''; - if ($html) { - $out .= "<pre>"; - } - - foreach ($backTrace as $index => $trace) { - if (!$showFirst && $index == 0) { - continue; - } - // sometimes there is undefined index 'file' - @$out .= "[$index] {$trace['file']}:{$trace['line']}\n"; - } - - if ($html) { - $out .= "</pre>"; - } - - if ($return) { - return $out; - } else { - echo $out; - } -} - -/** - * Delete folder recursively - * - * @param string $path - */ -function mageDelTree($path) -{ - if (is_dir($path)) { - $entries = scandir($path); - foreach ($entries as $entry) { - if ($entry != '.' && $entry != '..') { - mageDelTree($path . DS . $entry); - } - } - @rmdir($path); - } else { - @unlink($path); - } -} - -/** - * Parse csv file - * - * @param string $string - * @param string $delimiter - * @param string $enclosure - * @return array - */ -function mageParseCsv($string, $delimiter = ",", $enclosure = '"') -{ - $elements = explode($delimiter, $string); - for ($i = 0; $i < count($elements); $i++) { - $nQuotes = substr_count($elements[$i], $enclosure); - if ($nQuotes %2 == 1) { - for ($j = $i+1; $j < count($elements); $j++) { - if (substr_count($elements[$j], $enclosure) > 0) { - // Put the quoted string's pieces back together again - array_splice($elements, $i, $j - $i + 1, - implode($delimiter, array_slice($elements, $i, $j - $i + 1))); - break; - } - } - } - if ($nQuotes > 0) { - // Remove first and last quotes, then merge pairs of quotes - $qStr =& $elements[$i]; - $qStr = substr_replace($qStr, '', strpos($qStr, $enclosure), 1); - $qStr = substr_replace($qStr, '', strrpos($qStr, $enclosure), 1); - $qStr = str_replace($enclosure.$enclosure, $enclosure, $qStr); - } - } - return $elements; -} - -/** - * Check is directory writable or not - * - * @param string $dir - * @return bool - */ -function is_dir_writeable($dir) -{ - if (is_dir($dir) && is_writable($dir)) { - if (stripos(PHP_OS, 'win') === 0) { - $dir = ltrim($dir, DIRECTORY_SEPARATOR); - $file = $dir . DIRECTORY_SEPARATOR . uniqid(mt_rand()) . '.tmp'; - $exist = file_exists($file); - $fileResource = @fopen($file, 'a'); - if ($fileResource === false) { - return false; - } - fclose($fileResource); - if (!$exist) { - unlink($file); - } - } - return true; - } - return false; -} - -/** - * Create value-object \Magento\Phrase - * - * @return string - */ -function __() -{ - $argc = func_get_args(); - - /** - * Type casting to string is a workaround. - * Many places in client code at the moment are unable to handle the \Magento\Phrase object properly. - * The intended behavior is to use __toString(), - * so that rendering of the phrase happens only at the last moment when needed - */ - return (string)new \Magento\Phrase(array_shift($argc), $argc); -} diff --git a/app/code/Magento/Core/i18n/de_DE.csv b/app/code/Magento/Core/i18n/de_DE.csv index 62922555b1b9e76a17143b190dd7d17223bd4e56..ac6e17a6ec9e404e6718f02852604585858923f4 100644 --- a/app/code/Magento/Core/i18n/de_DE.csv +++ b/app/code/Magento/Core/i18n/de_DE.csv @@ -163,8 +163,8 @@ "Locale","Sprachumgebung" "Locale Options","locale Einstellungen" "Log Settings","Log-Einstellungen" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","Logging von \Magento\Core\Model\Logger befindet sich in {{base_dir}}/var/log" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","Logging von \Magento\Core\Model\Logger. Die Datei befinden sich in {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","Logging von \Magento\Logger befindet sich in {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","Logging von \Magento\Logger. Die Datei befinden sich in {{base_dir}}/var/log" "Login is Case Sensitive","Login ist Case Sensitive" "Logo Image","Logobild" "Logo Image Alt","Logo Alt" diff --git a/app/code/Magento/Core/i18n/en_US.csv b/app/code/Magento/Core/i18n/en_US.csv index 328cbccdc7402c51f708be34ced994ee674970b5..0c74a9ea88ba494a4c92c1ee889be3e97c86cf12 100644 --- a/app/code/Magento/Core/i18n/en_US.csv +++ b/app/code/Magento/Core/i18n/en_US.csv @@ -165,8 +165,8 @@ "Locale","Locale" "Locale Options","Locale Options" "Log Settings","Log Settings" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","Logging from \Magento\Logger. File is located in {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","Logging from \Magento\Logger. File is located in {{base_dir}}/var/log" "Login is Case Sensitive","Login is Case Sensitive" "Logo Image","Logo Image" "Logo Image Alt","Logo Image Alt" diff --git a/app/code/Magento/Core/i18n/es_ES.csv b/app/code/Magento/Core/i18n/es_ES.csv index e22a2434edb2e501637fe39466f56327c9e442d3..2afaec1031b41d2a939cc6425b0c1b6097336cf7 100644 --- a/app/code/Magento/Core/i18n/es_ES.csv +++ b/app/code/Magento/Core/i18n/es_ES.csv @@ -163,8 +163,8 @@ "Locale","Configuración regional" "Locale Options","Opciones de configuración regional" "Log Settings","Configuración de registro" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","Registro desde \Magento\Core\Model\Logger. El archivo se encuentra ubicado en {{base_dir}}/var/log" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","Registro desde \Magento\Core\Model\Logger. El archivo se encuentra ubicado en {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","Registro desde \Magento\Logger. El archivo se encuentra ubicado en {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","Registro desde \Magento\Logger. El archivo se encuentra ubicado en {{base_dir}}/var/log" "Login is Case Sensitive","Se distinguen mayúsculas al iniciar sesión." "Logo Image","Imagen del Logo" "Logo Image Alt","Imagen del logotipo alternativa" diff --git a/app/code/Magento/Core/i18n/fr_FR.csv b/app/code/Magento/Core/i18n/fr_FR.csv index 9ef05bfa27ff58db859a299f59106998e8054a3c..2672553f605f7329ed8bf6522e5024868c855da6 100644 --- a/app/code/Magento/Core/i18n/fr_FR.csv +++ b/app/code/Magento/Core/i18n/fr_FR.csv @@ -163,8 +163,8 @@ "Locale","Paramètres régionaux" "Locale Options","Options régionales" "Log Settings","Réglages de journalisation" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","En cours de journalisation de \Magento\Core\Model\Logger. Le fichier est situé à {{base_dir}}/var/log" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","En cours de journalisation de \Magento\Core\Model\Logger. Le fichier est situé à {{base_dir}}/var/log." +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","En cours de journalisation de \Magento\Logger. Le fichier est situé à {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","En cours de journalisation de \Magento\Logger. Le fichier est situé à {{base_dir}}/var/log." "Login is Case Sensitive","Le login est sensible à la casse." "Logo Image","Image du logo" "Logo Image Alt","Image logo alt" diff --git a/app/code/Magento/Core/i18n/nl_NL.csv b/app/code/Magento/Core/i18n/nl_NL.csv index 3578279fcd2c409b80d5a71d9ab0d1fc60725f74..4c33382551668410939ca1c9201da766a2c89209 100644 --- a/app/code/Magento/Core/i18n/nl_NL.csv +++ b/app/code/Magento/Core/i18n/nl_NL.csv @@ -163,8 +163,8 @@ "Locale","Lokaal" "Locale Options","Lokale Opties" "Log Settings","Log Instellingen" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","Logging van \Magento\Core\Model\Logger. Bestand bevindt zich in {{base_dir}}/var/log" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","Logging van \Magento\Core\Model\Logger. Bestand bevindt zich in {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","Logging van \Magento\Logger. Bestand bevindt zich in {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","Logging van \Magento\Logger. Bestand bevindt zich in {{base_dir}}/var/log" "Login is Case Sensitive","Inloggen is hoofdlettergevoelig" "Logo Image","Logo afbeelding" "Logo Image Alt","Logo afbeelding Alt" diff --git a/app/code/Magento/Core/i18n/pt_BR.csv b/app/code/Magento/Core/i18n/pt_BR.csv index 9ebd32b99261d451038a913b885e201e5921c39a..76060da0892ffc90ab7826773fe42907441e388a 100644 --- a/app/code/Magento/Core/i18n/pt_BR.csv +++ b/app/code/Magento/Core/i18n/pt_BR.csv @@ -165,8 +165,8 @@ local até que o processo de sincronização esteja completo." "Locale","Locale" "Locale Options","Opções Locais" "Log Settings","Configurações de Registro" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","Registro de \Magento\Core\Model\Logger. Arquivo está localizado em {{base_dir}}/var/log" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","Registro de \Magento\Core\Model\Logger. Arquivo está localizado em {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","Registro de \Magento\Logger. Arquivo está localizado em {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","Registro de \Magento\Logger. Arquivo está localizado em {{base_dir}}/var/log" "Login is Case Sensitive","Acesso (Login) Diferencia Maiúsculas e Minúsculas" "Logo Image","Imagem da Logo" "Logo Image Alt","Alt da Imagem do Logotipo" diff --git a/app/code/Magento/Core/i18n/zh_CN.csv b/app/code/Magento/Core/i18n/zh_CN.csv index d03ae800ecd76cd303faf8097497b99ae65635de..64a3e96fbac4f5edbcdfcdb8c1a8cc94ca7bb132 100644 --- a/app/code/Magento/Core/i18n/zh_CN.csv +++ b/app/code/Magento/Core/i18n/zh_CN.csv @@ -163,8 +163,8 @@ "Locale","区域" "Locale Options","区域选项" "Log Settings","日志设置" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","登录自 \Magento\Core\Model\Logger。文件ä½äºŽ {{base_dir}}/var/log" -"Logging from \Magento\Core\Model\Logger. File is located in {{base_dir}}/var/log","登录自 \Magento\Core\Model\Logger。文件ä½äºŽ {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","登录自 \Magento\Logger。文件ä½äºŽ {{base_dir}}/var/log" +"Logging from \Magento\Logger. File is located in {{base_dir}}/var/log","登录自 \Magento\Logger。文件ä½äºŽ {{base_dir}}/var/log" "Login is Case Sensitive","登录信æ¯å¤§å°å†™æ•感" "Logo Image","å¾½æ ‡å›¾åƒ" "Logo Image Alt","å¤‡é€‰å¾½æ ‡å›¾åƒ" diff --git a/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php b/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php new file mode 100644 index 0000000000000000000000000000000000000000..0a35b6720fa61f27791d05586483f803d081933c --- /dev/null +++ b/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php @@ -0,0 +1,59 @@ +<?php +/** + * Cron application plugin + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Cron\App\Cron\Plugin; + +use \Magento\Core\Model\AppInterface; + +class ApplicationInitializer +{ + /** + * @var \Magento\Core\Model\AppInterface + */ + protected $_application; + + /** + * @param AppInterface $application + */ + public function __construct( + AppInterface $application + ) { + $this->_application = $application; + } + + /** + * Perform required checks before cron run + * + * @param array $methodArguments + * @return array + */ + public function beforeExecute(array $methodArguments) + { + $this->_application->setUseSessionInUrl(false); + $this->_application->requireInstalledInstance(); + return $methodArguments; + } +} + diff --git a/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php b/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php index bf631678ceb20141606caf0fe99f77bbcad1878c..6fc3b5ab9cfcefebdeaa5368cd0e40ca34920f29 100644 --- a/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php +++ b/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php @@ -50,6 +50,11 @@ class Alert extends \Magento\Core\Model\Config\Value */ protected $_configValueFactory; + /** + * @var string + */ + protected $_runModelPath = ''; + /** * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory * @param \Magento\Core\Model\Context $context @@ -58,6 +63,7 @@ class Alert extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection + * @param string $runModelPath * @param array $data */ public function __construct( @@ -68,8 +74,10 @@ class Alert extends \Magento\Core\Model\Config\Value \Magento\Core\Model\Config $config, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, + $runModelPath = '', array $data = array() ) { + $this->_runModelPath = $runModelPath; $this->_configValueFactory = $configValueFactory; parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); } @@ -101,7 +109,7 @@ class Alert extends \Magento\Core\Model\Config\Value ->save(); $this->_configValueFactory->create() ->load(self::CRON_MODEL_PATH, 'path') - ->setValue((string) $this->_config->getNode(self::CRON_MODEL_PATH)) + ->setValue($this->_runModelPath) ->setPath(self::CRON_MODEL_PATH) ->save(); } catch (\Exception $e) { diff --git a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php index 7cc0db6ddd8085592acc835f5c747db3e6e36bce..1b01472f3315a25d5fa86c71576ebf846185e199 100644 --- a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php +++ b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php @@ -50,6 +50,11 @@ class Sitemap extends \Magento\Core\Model\Config\Value */ protected $_configValueFactory; + /** + * @var string + */ + protected $_runModelPath = ''; + /** * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory * @param \Magento\Core\Model\Context $context @@ -58,6 +63,7 @@ class Sitemap extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection + * @param string $runModelPath * @param array $data */ public function __construct( @@ -68,8 +74,10 @@ class Sitemap extends \Magento\Core\Model\Config\Value \Magento\Core\Model\Config $config, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, + $runModelPath = '', array $data = array() ) { + $this->_runModelPath = $runModelPath; $this->_configValueFactory = $configValueFactory; parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); } @@ -101,7 +109,7 @@ class Sitemap extends \Magento\Core\Model\Config\Value ->save(); $this->_configValueFactory->create() ->load(self::CRON_MODEL_PATH, 'path') - ->setValue((string)$this->_config->getNode(self::CRON_MODEL_PATH)) + ->setValue($this->_runModelPath) ->setPath(self::CRON_MODEL_PATH) ->save(); } catch (\Exception $e) { diff --git a/app/code/Magento/Cron/Model/Config/SchemaLocator.php b/app/code/Magento/Cron/Model/Config/SchemaLocator.php index 850a5468fb3855f0b18dd5073587bd675bab41c0..d1d0b23e0205f60aae6be861db25ee12b7fab89a 100644 --- a/app/code/Magento/Cron/Model/Config/SchemaLocator.php +++ b/app/code/Magento/Cron/Model/Config/SchemaLocator.php @@ -46,9 +46,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Cron') . '/' . 'crontab.xsd'; } diff --git a/app/code/Magento/Cron/Model/Observer.php b/app/code/Magento/Cron/Model/Observer.php index fbea8b797fa3b256860a0ae8654457516625e8b4..fae500f53932a485247e7174ad51ae34f20c533f 100644 --- a/app/code/Magento/Cron/Model/Observer.php +++ b/app/code/Magento/Cron/Model/Observer.php @@ -60,7 +60,9 @@ class Observer /** @var \Magento\Cron\Model\ConfigInterface */ protected $_config; - /** @var \Magento\Core\Model\ObjectManager */ + /** + * @var \Magento\App\ObjectManager + */ protected $_objectManager; /** @var \Magento\Core\Model\App */ diff --git a/app/code/Magento/Cron/etc/di.xml b/app/code/Magento/Cron/etc/di.xml index 2a0f0c9f40e2e13c59a9c1802ae53b10f803b456..f11d8c630fe12e118abb5cb3aec1fc575c317e9c 100644 --- a/app/code/Magento/Cron/etc/di.xml +++ b/app/code/Magento/Cron/etc/di.xml @@ -38,12 +38,7 @@ <instance type="Magento\Cron\Model\Config\SchemaLocator" /> </param> </type> - <type name="Magento\Cron\Model\Observer"> - <param name="objectManager"> - <instance type="Magento\Core\Model\ObjectManager" /> - </param> - <param name="app"> - <instance type="Magento\Core\Model\App" /> - </param> + <type name="Magento\App\Cron"> + <plugin name="application_initializer" type="Magento\Cron\App\Cron\Plugin\ApplicationInitializer" sortOrder="10"/> </type> </config> diff --git a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency/Rate/Matrix.php b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency/Rate/Matrix.php index 000a9fb6a18fba9bdffce023816700cf232308c5..027aec655486859bd606d92f40bd4104d7d362d1 100644 --- a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency/Rate/Matrix.php +++ b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency/Rate/Matrix.php @@ -43,19 +43,19 @@ class Matrix extends \Magento\Backend\Block\Template protected $_adminSession; /** - * @var \Magento\Directory\Model\Currency\Factory + * @var \Magento\Directory\Model\CurrencyFactory */ protected $_dirCurrencyFactory; /** - * @param \Magento\Directory\Model\Currency\Factory $dirCurrencyFactory + * @param \Magento\Directory\Model\CurrencyFactory $dirCurrencyFactory * @param \Magento\Backend\Model\Session $adminSession * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data */ public function __construct( - \Magento\Directory\Model\Currency\Factory $dirCurrencyFactory, + \Magento\Directory\Model\CurrencyFactory $dirCurrencyFactory, \Magento\Backend\Model\Session $adminSession, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, diff --git a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php index eb36be1c0030406cee2398eb44a0cf366493c225..4817b7b765ec75880ca4a4be3d6a694a3cdc1c06 100644 --- a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php +++ b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php @@ -36,18 +36,18 @@ namespace Magento\CurrencySymbol\Block\Adminhtml\System; class Currencysymbol extends \Magento\Backend\Block\Widget\Form { /** - * @var \Magento\CurrencySymbol\Model\System\Currencysymbol\Factory + * @var \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory */ protected $_symbolSystemFactory; /** - * @param \Magento\CurrencySymbol\Model\System\Currencysymbol\Factory $symbolSystemFactory + * @param \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory $symbolSystemFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data */ public function __construct( - \Magento\CurrencySymbol\Model\System\Currencysymbol\Factory $symbolSystemFactory, + \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory $symbolSystemFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol.php b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol.php index 54665f5c2ece3870445fc48fc5d99d971d369e99..10604df09c06ab920242b1016aa12d2a20d9df5a 100644 --- a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol.php +++ b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currencysymbol.php @@ -64,7 +64,9 @@ class Currencysymbol extends \Magento\Backend\Controller\Adminhtml\Action $symbolsDataArray = $this->getRequest()->getParam('custom_currency_symbol', null); if (is_array($symbolsDataArray)) { foreach ($symbolsDataArray as &$symbolsData) { - $symbolsData = $this->_objectManager->get('Magento\Adminhtml\Helper\Data')->stripTags($symbolsData); + /** @var $filterManager \Magento\Filter\FilterManager */ + $filterManager = $this->_objectManager->get('Magento\Filter\FilterManager'); + $symbolsData = $filterManager->stripTags($symbolsData); } } diff --git a/app/code/Magento/CurrencySymbol/Helper/Data.php b/app/code/Magento/CurrencySymbol/Helper/Data.php index 6bf937958825ee88c3fa148772b1ededf8a82298..414c06f31f16ad92f3ca9ec216944f4653cd85a0 100644 --- a/app/code/Magento/CurrencySymbol/Helper/Data.php +++ b/app/code/Magento/CurrencySymbol/Helper/Data.php @@ -36,42 +36,42 @@ namespace Magento\CurrencySymbol\Helper; class Data extends \Magento\Core\Helper\Data { /** - * @var \Magento\CurrencySymbol\Model\System\Currencysymbol\Factory + * @var \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory */ protected $_symbolFactory; /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor - * @param \Magento\CurrencySymbol\Model\System\Currencysymbol\Factory $symbolFactory + * @param \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory $symbolFactory * @param bool $dbCompatibleMode */ public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, - \Magento\CurrencySymbol\Model\System\Currencysymbol\Factory $symbolFactory, + \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory $symbolFactory, $dbCompatibleMode = true - ) - { + ) { $this->_symbolFactory = $symbolFactory; - parent::__construct($context, $eventManager, $coreHttp, $config, $coreStoreConfig, $storeManager, - $locale, $dateModel, $appState, $encryptor, $dbCompatibleMode + parent::__construct( + $context, + $eventManager, + $coreStoreConfig, + $storeManager, + $locale, + $dateModel, + $appState, + $dbCompatibleMode ); } @@ -85,7 +85,7 @@ class Data extends \Magento\Core\Helper\Data { $currencyOptions = array(); $currencySymbol = $this->_symbolFactory->create(); - if($currencySymbol) { + if ($currencySymbol) { $customCurrencySymbol = $currencySymbol->getCurrencySymbol($baseCode); if ($customCurrencySymbol) { diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/grid.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/grid.phtml index 658bb74ade6dc0462521627cd2a982cd6fa094dc..bc5d9523390601e5a56caedf3c1cf44acf5a5437 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/grid.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/grid.phtml @@ -52,8 +52,8 @@ </td> <td class="col-symbol"> <div class="control"> - <input id="custom_currency_symbol<?php echo $code; ?>" class=" required-entry input-text" type="text" value="<?php echo $this->helper('Magento\Core\Helper\Data')->quoteEscape($data['displaySymbol']); ?>"<?php echo $data['inherited'] ? ' disabled="disabled"' : '';?> name="custom_currency_symbol[<?php echo $code; ?>]"> - <input id="custom_currency_symbol_inherit<?php echo $code; ?>" class="checkbox config-inherit" type="checkbox" onclick="toggleUseDefault(<?php echo '\'' . $code . '\',\'' . $this->helper('Magento\Core\Helper\Data')->quoteEscape($data['parentSymbol'], true) . '\''; ?>)"<?php echo $data['inherited'] ? ' checked="checked"' : ''; ?> value="1" name="inherit_custom_currency_symbol[<?php echo $code; ?>]"> + <input id="custom_currency_symbol<?php echo $code; ?>" class=" required-entry input-text" type="text" value="<?php echo $this->escapeQuote($data['displaySymbol']); ?>"<?php echo $data['inherited'] ? ' disabled="disabled"' : '';?> name="custom_currency_symbol[<?php echo $code; ?>]"> + <input id="custom_currency_symbol_inherit<?php echo $code; ?>" class="checkbox config-inherit" type="checkbox" onclick="toggleUseDefault(<?php echo '\'' . $code . '\',\'' . $this->escapeQuote($data['parentSymbol'], true) . '\''; ?>)"<?php echo $data['inherited'] ? ' checked="checked"' : ''; ?> value="1" name="inherit_custom_currency_symbol[<?php echo $code; ?>]"> <label class="label" for="custom_currency_symbol_inherit<?php echo $code; ?>"><?php echo $this->getInheritText(); ?></label> </div> </td> diff --git a/app/code/Magento/Customer/Block/Address/Edit.php b/app/code/Magento/Customer/Block/Address/Edit.php index c558fbf9c6b8120e4509106a2c9a33c234833a27..aaf3d5da1f8fa7188a2320bc30c94388ed7c7359 100644 --- a/app/code/Magento/Customer/Block/Address/Edit.php +++ b/app/code/Magento/Customer/Block/Address/Edit.php @@ -223,15 +223,6 @@ class Edit extends \Magento\Directory\Block\Data } } - /** - * @param string $path - * @return \Magento\Core\Model\Config\Element - */ - public function getConfigNode($path) - { - return $this->_config->getNode($path); - } - /** * Get config * diff --git a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php index caaf308db8512fcc39bd75cddb9c2dc327e45173..562fe204b05ba84582354a2f7538be28bd783d23 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php @@ -57,25 +57,33 @@ class DefaultRenderer */ protected $_attrDataFactory; + /** + * @var \Magento\Filter\FilterManager + */ + protected $_filterManager; + /** * @param \Magento\Customer\Helper\Address $customerAddress * @param \Magento\Core\Block\Context $context * @param \Magento\Eav\Model\AttributeDataFactory $attrDataFactory + * @param \Magento\Filter\FilterManager $filterManager * @param array $data */ public function __construct( \Magento\Customer\Helper\Address $customerAddress, \Magento\Core\Block\Context $context, \Magento\Eav\Model\AttributeDataFactory $attrDataFactory, + \Magento\Filter\FilterManager $filterManager, array $data = array() ) { $this->_customerAddress = $customerAddress; $this->_attrDataFactory = $attrDataFactory; + $this->_filterManager = $filterManager; parent::__construct($context, $data); } /** - * Retrive format type object + * Retrieve format type object * * @return \Magento\Object */ @@ -85,7 +93,7 @@ class DefaultRenderer } /** - * Retrive format type object + * Retrieve format type object * * @param \Magento\Object $type * @return \Magento\Customer\Block\Address\Renderer\DefaultRenderer @@ -128,7 +136,6 @@ class DefaultRenderer break; } - $formater = new \Magento\Filter\Template(); $attributes = $this->_customerAddress->getAttributes(); $data = array(); @@ -161,11 +168,8 @@ class DefaultRenderer $data[$key] = $this->escapeHtml($value); } } - - $formater->setVariables($data); - $format = !is_null($format) ? $format : $this->getFormat($address); - return $formater->filter($format); + return $this->_filterManager->template($format, array('variables' => $data)); } } diff --git a/app/code/Magento/Adminhtml/Block/Customer.php b/app/code/Magento/Customer/Block/Adminhtml/Customer.php similarity index 86% rename from app/code/Magento/Adminhtml/Block/Customer.php rename to app/code/Magento/Customer/Block/Adminhtml/Customer.php index 246543c311e99dec1959e5960e676debf93ef86c..a0cbb4661969504930ccc4fabff57a84fc6f3f3c 100644 --- a/app/code/Magento/Adminhtml/Block/Customer.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Customer.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,18 +28,19 @@ * Adminhtml customers list block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block; +namespace Magento\Customer\Block\Adminhtml; class Customer extends \Magento\Adminhtml\Block\Widget\Grid\Container { protected function _construct() { - $this->_controller = 'customer'; + $this->_controller = 'adminhtml'; + $this->_blockGroup = 'Magento_Customer'; $this->_headerText = __('Customers'); $this->_addButtonLabel = __('Add New Customer'); parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit.php b/app/code/Magento/Customer/Block/Adminhtml/Edit.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/Customer/Edit.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit.php index bbcbc7391ec367636b3ea0cc7fae1a6d9ea7b452..4f07cc0a83dabf062a088cd0362398e78f5e86ac 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Customer edit block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer; +namespace Magento\Customer\Block\Adminhtml; class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -61,7 +61,8 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container protected function _construct() { $this->_objectId = 'id'; - $this->_controller = 'customer'; + $this->_controller = 'adminhtml'; + $this->_blockGroup = 'Magento_Customer'; if ($this->getCustomerId() && $this->_authorization->isAllowed('Magento_Sales::create')) { $this->_addButton('order', array( @@ -87,7 +88,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container } if ($customer && $customer->getId()) { - $url = $this->getUrl('adminhtml/*/resetPassword', array('customer_id' => $customer->getId())); + $url = $this->getUrl('customer/index/resetPassword', array('customer_id' => $customer->getId())); $this->_addButton('reset_password', array( 'label' => __('Reset Password'), 'onclick' => 'setLocation(\'' . $url . '\')', @@ -131,7 +132,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container public function getValidationUrl() { - return $this->getUrl('adminhtml/*/validate', array('_current' => true)); + return $this->getUrl('customer/*/validate', array('_current' => true)); } protected function _prepareLayout() @@ -153,7 +154,7 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container protected function _getSaveAndContinueUrl() { - return $this->getUrl('adminhtml/*/save', array( + return $this->getUrl('customer/index/save', array( '_current' => true, 'back' => 'edit', 'tab' => '{{tab_id}}' diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Form.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Form.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php index 0ba93d6db6fb3a4c4032b1a43c32c15a8c639dc1..0b41cfa26b474e8328979983770fdbcd7441d011 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Form.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +27,7 @@ /** * Adminhtml customer edit form block */ -namespace Magento\Adminhtml\Block\Customer\Edit; +namespace Magento\Customer\Block\Adminhtml\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { @@ -37,7 +37,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $form = $this->_formFactory->create(array( 'attributes' => array( 'id' => 'edit_form', - 'action' => $this->getData('action'), + 'action' => $this->getUrl('customer/*/save'), 'method' => 'post', 'enctype' => 'multipart/form-data', )) diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Renderer/Attribute/Group.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Renderer/Attribute/Group.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php index 566fe76b6bd655660f74d025845135753b769f4c..33d966bacd76ed2fb475e83f2f9d8a3aedc9ee43 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Renderer/Attribute/Group.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Attribute/Group.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,15 +28,15 @@ * Renderer for customer group ID * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Renderer\Attribute; +namespace Magento\Customer\Block\Adminhtml\Edit\Renderer\Attribute; class Group extends \Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset\Element { - protected $_template = 'customer/edit/tab/account/form/renderer/group.phtml'; + protected $_template = 'edit/tab/account/form/renderer/group.phtml'; /** * Customer address diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Newpass.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Newpass.php index 3b5e65c499678ead77c54cb0ec4e4201a82eb2e2..28f4ae9a8842f9052607e51cef532769d272c234 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Newpass.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Customer new password field renderer * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Renderer; +namespace Magento\Customer\Block\Adminhtml\Edit\Renderer; class Newpass extends \Magento\Backend\Block\AbstractBlock diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Renderer/Region.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Renderer/Region.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php index 33fc27b5d25d7088ab609b69bbc19cc617ed3603..c95fd8e2ae39470bd866095cefdb759f0f8cde46 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Renderer/Region.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,7 +29,7 @@ * * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Renderer; +namespace Magento\Customer\Block\Adminhtml\Edit\Renderer; class Region extends \Magento\Backend\Block\AbstractBlock diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Account.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Account.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php index 2b1d1d9883f4e705b7fa065be276d991732ee920..fcacd7a01424a7fe39c0a7a4e92b5343774c7f84 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Account.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,12 +28,12 @@ * Customer account form block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> * * @SuppressWarnings(PHPMD.DepthOfInheritance) */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab; /** * @SuppressWarnings(PHPMD.DepthOfInheritance) @@ -59,7 +59,7 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Customer\Model\FormFactory $customerFactory * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -68,7 +68,7 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Customer\Model\FormFactory $customerFactory, \Magento\Core\Model\System\Store $systemStore, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -81,7 +81,7 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic /** * Initialize form * - * @return \Magento\Adminhtml\Block\Customer\Edit\Tab\Account + * @return \Magento\Customer\Block\Adminhtml\Edit\Tab\Account */ public function initForm() { @@ -101,7 +101,7 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic $this->_setFieldset($attributes, $fieldset, array(self::DISABLE_ATTRIBUTE_NAME)); $form->getElement('group_id')->setRenderer($this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Customer\Edit\Renderer\Attribute\Group') + ->createBlock('Magento\Customer\Block\Adminhtml\Edit\Renderer\Attribute\Group') ->setDisableAutoGroupChangeAttribute($customerForm->getAttribute(self::DISABLE_ATTRIBUTE_NAME)) ->setDisableAutoGroupChangeAttributeValue($customer->getData(self::DISABLE_ATTRIBUTE_NAME)) ); @@ -166,9 +166,9 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic protected function _getAdditionalElementTypes() { return array( - 'file' => 'Magento\Adminhtml\Block\Customer\Form\Element\File', - 'image' => 'Magento\Adminhtml\Block\Customer\Form\Element\Image', - 'boolean' => 'Magento\Adminhtml\Block\Customer\Form\Element\Boolean', + 'file' => 'Magento\Customer\Block\Adminhtml\Form\Element\File', + 'image' => 'Magento\Customer\Block\Adminhtml\Form\Element\Image', + 'boolean' => 'Magento\Customer\Block\Adminhtml\Form\Element\Boolean', ); } @@ -402,7 +402,7 @@ class Account extends \Magento\Backend\Block\Widget\Form\Generic ) ); $field->setRenderer( - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Customer\Edit\Renderer\Newpass') + $this->getLayout()->createBlock('Magento\Customer\Block\Adminhtml\Edit\Renderer\Newpass') ); } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Addresses.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Addresses.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php index 52da89105967f301ef6e5cb878c257bfe33c8b8a..00ae692a3550cda1072d8876e8bcc26664a588f1 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Addresses.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,14 +28,14 @@ * Customer addresses forms * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab; class Addresses extends \Magento\Backend\Block\Widget\Form\Generic { - protected $_template = 'customer/tab/addresses.phtml'; + protected $_template = 'tab/addresses.phtml'; /** * Adminhtml addresses @@ -45,11 +45,11 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic protected $_adminhtmlAddresses = null; /** - * @param \Magento\Adminhtml\Model\Customer\Renderer\RegionFactory $regionFactory + * @param \Magento\Customer\Model\Renderer\RegionFactory $regionFactory * @param \Magento\Customer\Model\AddressFactory $addressFactory * @param \Magento\Customer\Model\FormFactory $customerFactory * @param \Magento\Core\Model\System\Store $systemStore - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context @@ -57,11 +57,11 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic * @param array $data */ public function __construct( - \Magento\Adminhtml\Model\Customer\Renderer\RegionFactory $regionFactory, + \Magento\Customer\Model\Renderer\RegionFactory $regionFactory, \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Customer\Model\FormFactory $customerFactory, \Magento\Core\Model\System\Store $systemStore, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, @@ -128,7 +128,7 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic /** * Initialize form object * - * @return \Magento\Adminhtml\Block\Customer\Edit\Tab\Addresses + * @return \Magento\Customer\Block\Adminhtml\Edit\Tab\Addresses */ public function initForm() { @@ -253,9 +253,9 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic protected function _getAdditionalElementTypes() { return array( - 'file' => 'Magento\Adminhtml\Block\Customer\Form\Element\File', - 'image' => 'Magento\Adminhtml\Block\Customer\Form\Element\Image', - 'boolean' => 'Magento\Adminhtml\Block\Customer\Form\Element\Boolean', + 'file' => 'Magento\Customer\Block\Adminhtml\Form\Element\File', + 'image' => 'Magento\Customer\Block\Adminhtml\Form\Element\Image', + 'boolean' => 'Magento\Customer\Block\Adminhtml\Form\Element\Boolean', ); } @@ -282,7 +282,7 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic * Add specified values to name prefix element values * * @param string|int|array $values - * @return \Magento\Adminhtml\Block\Customer\Edit\Tab\Addresses + * @return \Magento\Customer\Block\Adminhtml\Edit\Tab\Addresses */ public function addValuesToNamePrefixElement($values) { @@ -296,7 +296,7 @@ class Addresses extends \Magento\Backend\Block\Widget\Form\Generic * Add specified values to name suffix element values * * @param string|int|array $values - * @return \Magento\Adminhtml\Block\Customer\Edit\Tab\Addresses + * @return \Magento\Customer\Block\Adminhtml\Edit\Tab\Addresses */ public function addValuesToNameSuffixElement($values) { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Cart.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Cart.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php index 75c47ece9df4be5285abbfd079f0f3211c3c2e84..6a45dccbf8d208550124d496b5bd6d967e3153d3 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Cart.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customer orders grid block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab; /** * @SuppressWarnings(PHPMD.LongVariable) @@ -86,7 +86,7 @@ class Cart extends \Magento\Adminhtml\Block\Widget\Grid parent::_construct(); $this->setUseAjax(true); $this->_parentTemplate = $this->getTemplate(); - $this->setTemplate('customer/tab/cart.phtml'); + $this->setTemplate('tab/cart.phtml'); } /** @@ -136,7 +136,7 @@ class Cart extends \Magento\Adminhtml\Block\Widget\Grid $this->addColumn('name', array( 'header' => __('Product'), 'index' => 'name', - 'renderer' => 'Magento\Adminhtml\Block\Customer\Edit\Tab\View\Grid\Renderer\Item' + 'renderer' => 'Magento\Customer\Block\Adminhtml\Edit\Tab\View\Grid\Renderer\Item' )); $this->addColumn('sku', array( @@ -169,7 +169,7 @@ class Cart extends \Magento\Adminhtml\Block\Widget\Grid $this->addColumn('action', array( 'header' => __('Action'), 'index' => 'quote_item_id', - 'renderer' => 'Magento\Adminhtml\Block\Customer\Grid\Renderer\Multiaction', + 'renderer' => 'Magento\Customer\Block\Adminhtml\Grid\Renderer\Multiaction', 'filter' => false, 'sortable' => false, 'actions' => array( @@ -205,7 +205,7 @@ class Cart extends \Magento\Adminhtml\Block\Widget\Grid */ public function getGridUrl() { - return $this->getUrl('adminhtml/*/cart', array('_current'=>true, 'website_id' => $this->getWebsiteId())); + return $this->getUrl('customer/*/cart', array('_current'=>true, 'website_id' => $this->getWebsiteId())); } /** diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Carts.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Carts.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php index de68dc5f202145d2300e3921b9a0cdfb20fb50f8..cb7d707b7690bbae527daf6e840eb6493d6fdab9 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Carts.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +28,7 @@ * Obtain all carts contents for specified client * */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab; class Carts extends \Magento\Backend\Block\Template { @@ -58,7 +58,7 @@ class Carts extends \Magento\Backend\Block\Template /** * Add shopping cart grid of each website * - * @return \Magento\Adminhtml\Block\Customer\Edit\Tab\Carts + * @return \Magento\Customer\Block\Adminhtml\Edit\Tab\Carts */ protected function _prepareLayout() { @@ -66,7 +66,7 @@ class Carts extends \Magento\Backend\Block\Template $isShared = count($sharedWebsiteIds) > 1; foreach ($sharedWebsiteIds as $websiteId) { $blockName = 'customer_cart_' . $websiteId; - $block = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Customer\Edit\Tab\Cart', + $block = $this->getLayout()->createBlock('Magento\Customer\Block\Adminhtml\Edit\Tab\Cart', $blockName, array('data' => array('website_id' => $websiteId))); if ($isShared) { $websiteName = $this->_storeManager->getWebsite($websiteId)->getName(); diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php index 654d502d6d6f96f8840b02f7fe02514110e22211..12724484f5e982144e0a9504d7bff93ebc8d9476 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,14 +28,14 @@ * Customer account form block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab; class Newsletter extends \Magento\Backend\Block\Widget\Form\Generic { - protected $_template = 'customer/tab/newsletter.phtml'; + protected $_template = 'tab/newsletter.phtml'; /** * @var \Magento\Newsletter\Model\SubscriberFactory @@ -45,7 +45,7 @@ class Newsletter extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -53,7 +53,7 @@ class Newsletter extends \Magento\Backend\Block\Widget\Form\Generic public function __construct( \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -115,7 +115,7 @@ class Newsletter extends \Magento\Backend\Block\Widget\Form\Generic { $this->setChild('grid', $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Customer\Edit\Tab\Newsletter\Grid', 'newsletter.grid') + ->createBlock('Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid', 'newsletter.grid') ); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php index 657d4f8a46ddff7e136fbd0f30b2a3316fa142db..810b8a4c7279527071da3f3d07643d968b98686a 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml newsletter queue grid block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\Newsletter; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter; class Grid extends \Magento\Adminhtml\Block\Widget\Grid { @@ -85,7 +85,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function getGridUrl() { - return $this->getUrl('adminhtml/*/newsletter', array('_current' => true)); + return $this->getUrl('customer/*/newsletter', array('_current' => true)); } protected function _prepareCollection() @@ -144,9 +144,9 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid $this->addColumn('status', array( 'header' => __('Status'), 'align' => 'center', - 'filter' => 'Magento\Adminhtml\Block\Customer\Edit\Tab\Newsletter\Grid\Filter\Status', + 'filter' => 'Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Filter\Status', 'index' => 'queue_status', - 'renderer' => 'Magento\Adminhtml\Block\Customer\Edit\Tab\Newsletter\Grid\Renderer\Status' + 'renderer' => 'Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer\Status' )); $this->addColumn('action', array( @@ -154,7 +154,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid 'align' => 'center', 'filter' => false, 'sortable' => false, - 'renderer' => 'Magento\Adminhtml\Block\Customer\Edit\Tab\Newsletter\Grid\Renderer\Action' + 'renderer' => 'Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer\Action' )); return parent::_prepareColumns(); diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Filter/Status.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Filter/Status.php index 7e6ca92b18fbbcb729f34ac91b2e8d546aaf6499..1595d4fc3e831e46a059ec17839992ff60818e2c 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Filter/Status.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml newsletter subscribers grid website filter * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\Newsletter\Grid\Filter; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Filter; class Status extends \Magento\Adminhtml\Block\Widget\Grid\Column\Filter\Select { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php index c783cb637ecd3d5a0ce257e8385ee7f5d5b36d5c..07d33b4df090d90cd260b2daf9e5083f5187b148 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Action.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml newsletter queue grid block action item renderer * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\Newsletter\Grid\Renderer; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer; class Action extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php index 4a964f393f5b9f17ee4c2455424236bbf90159c2..0c59248c49567c70e51852357d4f8b61894ecc57 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Newsletter/Grid/Renderer/Status.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml newsletter queue grid block status item renderer * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\Newsletter\Grid\Renderer; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid\Renderer; class Status extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Orders.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Orders.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php index fa531814ee7688db17a4d5fed906933a68cc00cf..e93d4db5440152ef82131e64b49c752ddd47b5ec 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Orders.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customer orders grid block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab; class Orders extends \Magento\Adminhtml\Block\Widget\Grid { @@ -167,6 +167,6 @@ class Orders extends \Magento\Adminhtml\Block\Widget\Grid public function getGridUrl() { - return $this->getUrl('adminhtml/*/orders', array('_current' => true)); + return $this->getUrl('customer/*/orders', array('_current' => true)); } } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Reviews.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Reviews.php similarity index 83% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Reviews.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Reviews.php index e2c8d11d831c174364eb11b1eb6ac2d956d1a558..4408372a05762bd64ba835373c4686b0bde01b21 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Reviews.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Reviews.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,17 +28,17 @@ * Adminhtml customer orders grid block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab; class Reviews extends \Magento\Adminhtml\Block\Review\Grid { /** * Hide grid mass action elements * - * @return \Magento\Adminhtml\Block\Customer\Edit\Tab\Reviews + * @return \Magento\Customer\Block\Adminhtml\Edit\Tab\Reviews */ protected function _prepareMassaction() { @@ -52,6 +52,6 @@ class Reviews extends \Magento\Adminhtml\Block\Review\Grid */ public function getGridUrl() { - return $this->getUrl('adminhtml/*/productReviews', array('_current' => true)); + return $this->getUrl('customer/*/productReviews', array('_current' => true)); } } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php similarity index 84% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php index ba95384527a6942886bbbbc5d06968c06f9d81ac..713dc37aa9bd706de6729989115a2129838060b1 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php @@ -19,26 +19,28 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Customer\Block\Adminhtml\Edit\Tab; + /** * Customer account form block - * - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab; - class View extends \Magento\Adminhtml\Block\Template implements \Magento\Adminhtml\Block\Widget\Tab\TabInterface { + /** + * @var \Magento\Log\Model\Customer + */ protected $_customer; + /** + * @var \Magento\Log\Model\Customer + */ protected $_customerLog; /** @@ -46,7 +48,7 @@ class View * * @var \Magento\Core\Model\Registry */ - protected $_coreRegistry = null; + protected $_coreRegistry; /** * @param \Magento\Core\Helper\Data $coreData @@ -64,6 +66,11 @@ class View */ protected $_logFactory; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Customer\Model\GroupFactory $groupFactory * @param \Magento\Log\Model\CustomerFactory $logFactory @@ -71,6 +78,7 @@ class View * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Log\Model\Visitor $modelVisitor + * @param \Magento\Stdlib\DateTime $dateTime * @param array $data */ public function __construct( @@ -80,15 +88,20 @@ class View \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Log\Model\Visitor $modelVisitor, + \Magento\Stdlib\DateTime $dateTime, array $data = array() ) { $this->_coreRegistry = $registry; $this->_modelVisitor = $modelVisitor; $this->_groupFactory = $groupFactory; $this->_logFactory = $logFactory; + $this->dateTime = $dateTime; parent::__construct($coreData, $context, $data); } + /** + * @return \Magento\Log\Model\Customer + */ public function getCustomer() { if (!$this->_customer) { @@ -97,6 +110,9 @@ class View return $this->_customer; } + /** + * @return int + */ public function getGroupName() { $groupId = $this->getCustomer()->getGroupId(); @@ -135,6 +151,9 @@ class View ); } + /** + * @return string + */ public function getStoreCreateDate() { $date = $this->_locale->storeDate( @@ -145,6 +164,9 @@ class View return $this->formatDate($date, \Magento\Core\Model\LocaleInterface::FORMAT_TYPE_MEDIUM, true); } + /** + * @return string + */ public function getStoreCreateDateTimezone() { return $this->_storeConfig->getConfig( @@ -171,6 +193,9 @@ class View return __('Never'); } + /** + * @return string + */ public function getStoreLastLoginDate() { $date = $this->getCustomerLog()->getLoginAtTimestamp(); @@ -185,6 +210,9 @@ class View return __('Never'); } + /** + * @return string + */ public function getStoreLastLoginDateTimezone() { return $this->_storeConfig->getConfig( @@ -193,16 +221,24 @@ class View ); } + /** + * @return string + */ public function getCurrentStatus() { $log = $this->getCustomerLog(); $interval = $this->_modelVisitor->getOnlineMinutesInterval(); - if ($log->getLogoutAt() || (strtotime(now()) - strtotime($log->getLastVisitAt()) > $interval * 60)) { + if ($log->getLogoutAt() + || (strtotime($this->dateTime->now()) - strtotime($log->getLastVisitAt()) > $interval * 60) + ) { return __('Offline'); } return __('Online'); } + /** + * @return string + */ public function getIsConfirmedStatus() { $this->getCustomer(); @@ -215,11 +251,17 @@ class View return __('Not confirmed, can login'); } + /** + * @return null|string + */ public function getCreatedInStore() { return $this->_storeManager->getStore($this->getCustomer()->getStoreId())->getName(); } + /** + * @return int + */ public function getStoreId() { return $this->getCustomer()->getStoreId(); @@ -227,32 +269,48 @@ class View public function getBillingAddressHtml() { - if ($address = $this->getCustomer()->getPrimaryBillingAddress()) { + $address = $this->getCustomer()->getPrimaryBillingAddress(); + if ($address) { return $address->format('html'); } return __('The customer does not have default billing address.'); } + /** + * @return string + */ public function getAccordionHtml() { return $this->getChildHtml('accordion'); } + /** + * @return string + */ public function getSalesHtml() { return $this->getChildHtml('sales'); } + /** + * @return string + */ public function getTabLabel() { return __('Customer View'); } + /** + * @return string + */ public function getTabTitle() { return __('Customer View'); } + /** + * @return bool + */ public function canShowTab() { if ($this->_coreRegistry->registry('current_customer')->getId()) { @@ -261,6 +319,9 @@ class View return false; } + /** + * @return bool + */ public function isHidden() { if ($this->_coreRegistry->registry('current_customer')->getId()) { @@ -268,4 +329,4 @@ class View } return true; } -} +} \ No newline at end of file diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php similarity index 90% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php index 8017c6dda9878fac1c50cdb3ceec535c6feadbe9..cf6dc2ce0217bc973fe6f69cb32df48f3c11d432 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customer recent orders grid block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\View; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; class Accordion extends \Magento\Adminhtml\Block\Widget\Accordion { @@ -83,7 +83,7 @@ class Accordion extends \Magento\Adminhtml\Block\Widget\Accordion $this->addItem('lastOrders', array( 'title' => __('Recent Orders'), 'ajax' => true, - 'content_url' => $this->getUrl('adminhtml/*/lastOrders', array('_current' => true)), + 'content_url' => $this->getUrl('customer/*/lastOrders', array('_current' => true)), )); // add shopping cart block of each website @@ -106,7 +106,7 @@ class Accordion extends \Magento\Adminhtml\Block\Widget\Accordion $this->addItem('shopingCart' . $websiteId, array( 'title' => $title, 'ajax' => true, - 'content_url' => $this->getUrl('adminhtml/*/viewCart', array('_current' => true, 'website_id' => $websiteId)), + 'content_url' => $this->getUrl('customer/*/viewCart', array('_current' => true, 'website_id' => $websiteId)), )); } @@ -119,7 +119,7 @@ class Accordion extends \Magento\Adminhtml\Block\Widget\Accordion $this->addItem('wishlist', array( 'title' => __('Wishlist - %1 item(s)', $wishlistCount), 'ajax' => true, - 'content_url' => $this->getUrl('adminhtml/*/viewWishlist', array('_current' => true)), + 'content_url' => $this->getUrl('customer/*/viewWishlist', array('_current' => true)), )); } } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php index 1cc671b6a28c43ee684b8d5d98ed403690561779..e785014f58d9cb2c1c8732fc75ce2a974df75f39 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customer cart items grid block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\View; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; /** * @SuppressWarnings(PHPMD.LongVariable) diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Item.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Item.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php index e6534cb099cfbb1256d2d1f9d3123c300df74dab..518579ba1d3a66276665e630269e52e246925fd7 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Item.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Grid/Renderer/Item.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customers wishlist grid item renderer for name/options cell * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\View\Grid\Renderer; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View\Grid\Renderer; class Item extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php index a48e4e0793e6f597be651258893210a870a1e118..316a4266648ee8f6cd02882770dd5ed92ecb0d2a 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Orders.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customer recent orders grid block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\View; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; class Orders extends \Magento\Adminhtml\Block\Widget\Grid { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php index d7910489841056380118977169a33e801a13585e..ede7c61b4cd3afa78d348fa0de4129b27976581e 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customer view wishlist block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\View; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; class Sales extends \Magento\Backend\Block\Template { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php index ab0edd74ef999580fe8df3d0942dc2bda49109be..194d03ab15eb3384754c03d0cdc2c74638e46c87 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Wishlist.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customer view wishlist block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\View; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; class Wishlist extends \Magento\Adminhtml\Block\Widget\Grid { @@ -88,7 +88,7 @@ class Wishlist extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare collection * - * @return \Magento\Adminhtml\Block\Customer\Edit\Tab\View\Wishlist + * @return \Magento\Customer\Block\Adminhtml\Edit\Tab\View\Wishlist */ protected function _prepareCollection() { @@ -106,7 +106,7 @@ class Wishlist extends \Magento\Adminhtml\Block\Widget\Grid /** * Prepare columns * - * @return \Magento\Adminhtml\Block\Customer\Edit\Tab\View\Wishlist + * @return \Magento\Customer\Block\Adminhtml\Edit\Tab\View\Wishlist */ protected function _prepareColumns() { @@ -120,7 +120,7 @@ class Wishlist extends \Magento\Adminhtml\Block\Widget\Grid $this->addColumn('product_name', array( 'header' => __('Product'), 'index' => 'product_name', - 'renderer' => 'Magento\Adminhtml\Block\Customer\Edit\Tab\View\Grid\Renderer\Item' + 'renderer' => 'Magento\Customer\Block\Adminhtml\Edit\Tab\View\Grid\Renderer\Item' )); if (!$this->_storeManager->isSingleStoreMode()) { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php index 559d75ae54276c1bd2045421bc6eb8a73a2f65e4..c80dc646ccd01a7f8faff86ff42308865a0dbf3c 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Wishlist/Grid/Renderer/Description.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customers wishlist grid item renderer for item visibility * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\Wishlist\Grid\Renderer; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Wishlist\Grid\Renderer; class Description extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tabs.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php similarity index 85% rename from app/code/Magento/Adminhtml/Block/Customer/Edit/Tabs.php rename to app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php index bdf731ee3128066a88f25db790f5678248ad7a0a..b59cacd84192af3ab53f4176612c05e306d20d82 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Edit/Tabs.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +27,7 @@ /** * Admin customer left menu */ -namespace Magento\Adminhtml\Block\Customer\Edit; +namespace Magento\Customer\Block\Adminhtml\Edit; class Tabs extends \Magento\Backend\Block\Widget\Tabs { @@ -71,14 +71,14 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs $this->addTab('account', array( 'label' => __('Account Information'), 'content' => $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Customer\Edit\Tab\Account')->initForm()->toHtml(), + ->createBlock('Magento\Customer\Block\Adminhtml\Edit\Tab\Account')->initForm()->toHtml(), 'active' => $this->_coreRegistry->registry('current_customer')->getId() ? false : true )); $this->addTab('addresses', array( 'label' => __('Addresses'), 'content' => $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Customer\Edit\Tab\Addresses')->initForm()->toHtml(), + ->createBlock('Magento\Customer\Block\Adminhtml\Edit\Tab\Addresses')->initForm()->toHtml(), )); @@ -90,27 +90,27 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs $this->addTab('orders', array( 'label' => __('Orders'), 'class' => 'ajax', - 'url' => $this->getUrl('adminhtml/*/orders', array('_current' => true)), + 'url' => $this->getUrl('customer/*/orders', array('_current' => true)), )); } $this->addTab('cart', array( 'label' => __('Shopping Cart'), 'class' => 'ajax', - 'url' => $this->getUrl('adminhtml/*/carts', array('_current' => true)), + 'url' => $this->getUrl('customer/*/carts', array('_current' => true)), )); $this->addTab('wishlist', array( 'label' => __('Wishlist'), 'class' => 'ajax', - 'url' => $this->getUrl('adminhtml/*/wishlist', array('_current' => true)), + 'url' => $this->getUrl('customer/*/wishlist', array('_current' => true)), )); if ($this->_authorization->isAllowed('Magento_Newsletter::subscriber')) { $this->addTab('newsletter', array( 'label' => __('Newsletter'), 'content' => $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Customer\Edit\Tab\Newsletter')->initForm()->toHtml() + ->createBlock('Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter')->initForm()->toHtml() )); } @@ -118,7 +118,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs $this->addTab('reviews', array( 'label' => __('Product Reviews'), 'class' => 'ajax', - 'url' => $this->getUrl('adminhtml/*/productReviews', array('_current' => true)), + 'url' => $this->getUrl('customer/*/productReviews', array('_current' => true)), )); } } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Form/Element/Boolean.php b/app/code/Magento/Customer/Block/Adminhtml/Form/Element/Boolean.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/Customer/Form/Element/Boolean.php rename to app/code/Magento/Customer/Block/Adminhtml/Form/Element/Boolean.php index 65c08f8b683a0e69e9f30f3389646705ed567696..db1ad2106f487380759196358fad442c07b74db4 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Form/Element/Boolean.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Form/Element/Boolean.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Customer Widget Form Boolean Element Block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Form\Element; +namespace Magento\Customer\Block\Adminhtml\Form\Element; class Boolean extends \Magento\Data\Form\Element\Select { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Form/Element/File.php b/app/code/Magento/Customer/Block/Adminhtml/Form/Element/File.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/Customer/Form/Element/File.php rename to app/code/Magento/Customer/Block/Adminhtml/Form/Element/File.php index 375b441e449305ebf4ed81eb7d5dc939df913887..d2fed16e56dda9ac5063e7a3b5fd0bd138d843d2 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Form/Element/File.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Form/Element/File.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Customer Widget Form File Element Block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Form\Element; +namespace Magento\Customer\Block\Adminhtml\Form\Element; class File extends \Magento\Data\Form\Element\AbstractElement { @@ -49,15 +49,15 @@ class File extends \Magento\Data\Form\Element\AbstractElement protected $_adminhtmlData = null; /** + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Helper\Data $adminhtmlData * @param \Magento\Core\Model\View\Url $viewUrl * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Backend\Helper\Data $adminhtmlData, @@ -66,7 +66,7 @@ class File extends \Magento\Data\Form\Element\AbstractElement ) { $this->_adminhtmlData = $adminhtmlData; $this->_viewUrl = $viewUrl; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('file'); } @@ -193,8 +193,8 @@ class File extends \Magento\Data\Form\Element\AbstractElement */ protected function _getPreviewUrl() { - return $this->_adminhtmlData->getUrl('adminhtml/customer/viewfile', array( - 'file' => $this->_coreData->urlEncode($this->getValue()), + return $this->_adminhtmlData->getUrl('customer/index/viewfile', array( + 'file' => $this->_escaper->urlEncode($this->getValue()), )); } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Form/Element/Image.php b/app/code/Magento/Customer/Block/Adminhtml/Form/Element/Image.php similarity index 88% rename from app/code/Magento/Adminhtml/Block/Customer/Form/Element/Image.php rename to app/code/Magento/Customer/Block/Adminhtml/Form/Element/Image.php index a0287245b7b07301be314ab0facc0733b587dfb4..1104a228a65514a04cef946337c2ac1eef4ddf26 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Form/Element/Image.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Form/Element/Image.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,12 +29,12 @@ * Customer Widget Form Image File Element Block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Form\Element; +namespace Magento\Customer\Block\Adminhtml\Form\Element; -class Image extends \Magento\Adminhtml\Block\Customer\Form\Element\File +class Image extends \Magento\Customer\Block\Adminhtml\Form\Element\File { /** * Return Delete CheckBox Label @@ -99,8 +99,8 @@ class Image extends \Magento\Adminhtml\Block\Customer\Form\Element\File if (is_array($this->getValue())) { return false; } - return $this->_adminhtmlData->getUrl('adminhtml/customer/viewfile', array( - 'image' => $this->_coreData->urlEncode($this->getValue()), + return $this->_adminhtmlData->getUrl('customer/index/viewfile', array( + 'image' => $this->_escaper->urlEncode($this->getValue()), )); } } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Grid.php b/app/code/Magento/Customer/Block/Adminhtml/Grid.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Customer/Grid.php rename to app/code/Magento/Customer/Block/Adminhtml/Grid.php index 23ca6f10cfb373ccabc20bb744766f06de4bc037..8a747d6eaf41cbd36c9d43f265ca6f93bacb3cd6 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Grid.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Grid.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customer grid block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer; +namespace Magento\Customer\Block\Adminhtml; class Grid extends \Magento\Adminhtml\Block\Widget\Grid { @@ -217,18 +217,18 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid $this->getMassactionBlock()->addItem('delete', array( 'label' => __('Delete'), - 'url' => $this->getUrl('adminhtml/*/massDelete'), + 'url' => $this->getUrl('customer/*/massDelete'), 'confirm' => __('Are you sure?') )); $this->getMassactionBlock()->addItem('newsletter_subscribe', array( 'label' => __('Subscribe to Newsletter'), - 'url' => $this->getUrl('adminhtml/*/massSubscribe') + 'url' => $this->getUrl('customer/*/massSubscribe') )); $this->getMassactionBlock()->addItem('newsletter_unsubscribe', array( 'label' => __('Unsubscribe from Newsletter'), - 'url' => $this->getUrl('adminhtml/*/massUnsubscribe') + 'url' => $this->getUrl('customer/*/massUnsubscribe') )); $groups = $this->helper('Magento\Customer\Helper\Data')->getGroups()->toOptionArray(); @@ -236,7 +236,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid array_unshift($groups, array('label'=> '', 'value'=> '')); $this->getMassactionBlock()->addItem('assign_group', array( 'label' => __('Assign a Customer Group'), - 'url' => $this->getUrl('adminhtml/*/massAssignGroup'), + 'url' => $this->getUrl('customer/*/massAssignGroup'), 'additional' => array( 'visibility' => array( 'name' => 'group', @@ -253,11 +253,11 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid public function getGridUrl() { - return $this->getUrl('adminhtml/*/grid', array('_current'=> true)); + return $this->getUrl('customer/*/grid', array('_current'=> true)); } public function getRowUrl($row) { - return $this->getUrl('adminhtml/*/edit', array('id'=>$row->getId())); + return $this->getUrl('customer/*/edit', array('id'=>$row->getId())); } } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Grid/Filter/Country.php b/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Customer/Grid/Filter/Country.php rename to app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php index 984cf311800ef0339dde0122cd57e9205a9ad357..a42bd8e7d6206fc1ac33f1191861957984d1a649 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Grid/Filter/Country.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Country customer grid column filter * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Grid\Filter; +namespace Magento\Customer\Block\Adminhtml\Grid\Filter; class Country extends \Magento\Adminhtml\Block\Widget\Grid\Column\Filter\Select diff --git a/app/code/Magento/Adminhtml/Block/Customer/Grid/Renderer/Multiaction.php b/app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/Customer/Grid/Renderer/Multiaction.php rename to app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php index 002fc5b855c94f03fdc5920b2a2198eab94083ae..57c4c46fd909a94e75ed4d911ca688b0d671b41e 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Grid/Renderer/Multiaction.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Grid/Renderer/Multiaction.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customers wishlist grid item action renderer for few action controls in one cell * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Grid\Renderer; +namespace Magento\Customer\Block\Adminhtml\Grid\Renderer; class Multiaction extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Action diff --git a/app/code/Magento/Adminhtml/Block/Customer/Group.php b/app/code/Magento/Customer/Block/Adminhtml/Group.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/Customer/Group.php rename to app/code/Magento/Customer/Block/Adminhtml/Group.php index 0736cc7f87d04be32df175d6667930cdac9f5cbc..a56c5b90b825ac7a883521623dbbf9c271859d2f 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Group.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Group.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customers group page content block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer; +namespace Magento\Customer\Block\Adminhtml; class Group extends \Magento\Adminhtml\Block\Widget\Grid\Container { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Group/Edit.php b/app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/Customer/Group/Edit.php rename to app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php index aa4eaf4a34c5a10218bd4b408f720ad9d5c5825c..563b3f5039492a3ea4b2b33fbc91079083f9345b 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Group/Edit.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Group/Edit.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +27,7 @@ /** * Customer group edit block */ -namespace Magento\Adminhtml\Block\Customer\Group; +namespace Magento\Customer\Block\Adminhtml\Group; class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -59,7 +59,8 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container parent::_construct(); $this->_objectId = 'id'; - $this->_controller = 'customer_group'; + $this->_controller = 'adminhtml_group'; + $this->_blockGroup = 'Magento_Customer'; $this->_updateButton('save', 'label', __('Save Customer Group')); $this->_updateButton('delete', 'label', __('Delete Customer Group')); diff --git a/app/code/Magento/Adminhtml/Block/Customer/Group/Edit/Form.php b/app/code/Magento/Customer/Block/Adminhtml/Group/Edit/Form.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/Customer/Group/Edit/Form.php rename to app/code/Magento/Customer/Block/Adminhtml/Group/Edit/Form.php index fa5d750aca09f7f9011d15fd059c35d2436fdbbb..3d88b7277dee91a78f6667869b619c74207eea28 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Group/Edit/Form.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Group/Edit/Form.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customer groups edit form * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Group\Edit; +namespace Magento\Customer\Block\Adminhtml\Group\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { @@ -49,7 +49,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Tax\Model\TaxClass\Source\Customer $taxCustomer * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -58,7 +58,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Backend\Model\Session $backendSession, \Magento\Tax\Model\TaxClass\Source\Customer $taxCustomer, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -130,7 +130,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $form->setUseContainer(true); $form->setId('edit_form'); - $form->setAction($this->getUrl('adminhtml/*/save')); + $form->setAction($this->getUrl('customer/*/save')); $this->setForm($form); } } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Online.php b/app/code/Magento/Customer/Block/Adminhtml/Online.php similarity index 85% rename from app/code/Magento/Adminhtml/Block/Customer/Online.php rename to app/code/Magento/Customer/Block/Adminhtml/Online.php index d20d96498595bedfebe7679e0ff7ab615f964ccf..14387d81d181a0268941c1deaedab80492aaddef 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Online.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Online.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,15 +28,15 @@ * Adminhtml online customers page content block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer; +namespace Magento\Customer\Block\Adminhtml; class Online extends \Magento\Adminhtml\Block\Template { - protected $_template = 'customer/online.phtml'; + protected $_template = 'online.phtml'; public function _beforeToHtml() { @@ -45,7 +45,7 @@ class Online extends \Magento\Adminhtml\Block\Template protected function _prepareLayout() { - $this->addChild('filterForm', 'Magento\Adminhtml\Block\Customer\Online\Filter'); + $this->addChild('filterForm', 'Magento\Customer\Block\Adminhtml\Online\Filter'); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Adminhtml/Block/Customer/Online/Filter.php b/app/code/Magento/Customer/Block/Adminhtml/Online/Filter.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/Customer/Online/Filter.php rename to app/code/Magento/Customer/Block/Adminhtml/Online/Filter.php index bcbc1df163e1d39e8f53acdc506167127309f189..d140899710b914b32555f77a218b641c272ee7c9 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Online/Filter.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Online/Filter.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Adminhtml customers online filter * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Online; +namespace Magento\Customer\Block\Adminhtml\Online; class Filter extends \Magento\Backend\Block\Widget\Form\Generic { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Ip.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php rename to app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Ip.php index 8d145363add510347c001d34a038b5a15ef28184..f836a2c386116f74e29b5866244428b2f3d4023e 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Ip.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customers online grid block item renderer by ip. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Online\Grid\Renderer; +namespace Magento\Customer\Block\Adminhtml\Online\Grid\Renderer; class Ip extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Type.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php rename to app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Type.php index 0000f469e1db7d97df9bf3b685e73efc1f684979..3c735d693686ab64830f3bbabe769140d5c9945c 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Type.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml customers online grid renderer for customer type. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Online\Grid\Renderer; +namespace Magento\Customer\Block\Adminhtml\Online\Grid\Renderer; class Type extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Url.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php rename to app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Url.php index e9082c4ab6d5792740aa181485bb03fbabe9c201..45616587846feb2a2215ea35807939f231139ca0 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Online/Grid/Renderer/Url.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Adminhtml Online Customer last URL renderer * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Online\Grid\Renderer; +namespace Magento\Customer\Block\Adminhtml\Online\Grid\Renderer; class Url extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\AbstractRenderer { diff --git a/app/code/Magento/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php b/app/code/Magento/Customer/Block/Adminhtml/Sales/Order/Address/Form/Renderer/Vat.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php rename to app/code/Magento/Customer/Block/Adminhtml/Sales/Order/Address/Form/Renderer/Vat.php index 9bea9ff6bca5c09a5981a3890a798bb165ae874d..ebe4612fb863bfe7f39851eff1fecfc4494297fb 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Sales/Order/Address/Form/Renderer/Vat.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * VAT ID element renderer * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\Sales\Order\Address\Form\Renderer; +namespace Magento\Customer\Block\Adminhtml\Sales\Order\Address\Form\Renderer; class Vat extends \Magento\Adminhtml\Block\Widget\Form\Renderer\Fieldset\Element @@ -43,7 +43,7 @@ class Vat */ protected $_validateButton = null; - protected $_template = 'customer/sales/order/create/address/form/renderer/vat.phtml'; + protected $_template = 'sales/order/create/address/form/renderer/vat.phtml'; /** * Retrieve validate button block @@ -59,7 +59,7 @@ class Vat $vatElementId = $this->_element->getHtmlId(); $countryElementId = $form->getElement('country_id')->getHtmlId(); - $validateUrl = $this->_urlBuilder->getUrl('adminhtml/customer_system_config_validatevat/validateAdvanced'); + $validateUrl = $this->_urlBuilder->getUrl('customer/system_config_validatevat/validateAdvanced'); $groupMessage = __('The customer is currently assigned to Customer Group %s.') . ' ' . __('Would you like to change the Customer Group for this order?'); diff --git a/app/code/Magento/Adminhtml/Block/Customer/System/Config/Validatevat.php b/app/code/Magento/Customer/Block/Adminhtml/System/Config/Validatevat.php similarity index 87% rename from app/code/Magento/Adminhtml/Block/Customer/System/Config/Validatevat.php rename to app/code/Magento/Customer/Block/Adminhtml/System/Config/Validatevat.php index e924e1a4ac2a8be65c1bd500005ddf56cd5e2c2e..3b745432970f0c6080c3248175408abc01cd47f7 100644 --- a/app/code/Magento/Adminhtml/Block/Customer/System/Config/Validatevat.php +++ b/app/code/Magento/Customer/Block/Adminhtml/System/Config/Validatevat.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Adminhtml VAT ID validation block * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Customer\System\Config; +namespace Magento\Customer\Block\Adminhtml\System\Config; class Validatevat extends \Magento\Backend\Block\System\Config\Form\Field { @@ -60,7 +60,7 @@ class Validatevat extends \Magento\Backend\Block\System\Config\Form\Field * Set Merchant Country Field Name * * @param string $countryField - * @return \Magento\Adminhtml\Block\Customer\System\Config\Validatevat + * @return \Magento\Customer\Block\Adminhtml\System\Config\Validatevat */ public function setMerchantCountryField($countryField) { @@ -82,7 +82,7 @@ class Validatevat extends \Magento\Backend\Block\System\Config\Form\Field * Set Merchant VAT Number Field * * @param string $vatNumberField - * @return \Magento\Adminhtml\Block\Customer\System\Config\Validatevat + * @return \Magento\Customer\Block\Adminhtml\System\Config\Validatevat */ public function setMerchantVatNumberField($vatNumberField) { @@ -104,7 +104,7 @@ class Validatevat extends \Magento\Backend\Block\System\Config\Form\Field * Set Validate VAT Button Label * * @param string $vatButtonLabel - * @return \Magento\Adminhtml\Block\Customer\System\Config\Validatevat + * @return \Magento\Customer\Block\Adminhtml\System\Config\Validatevat */ public function setVatButtonLabel($vatButtonLabel) { @@ -115,13 +115,13 @@ class Validatevat extends \Magento\Backend\Block\System\Config\Form\Field /** * Set template to itself * - * @return \Magento\Adminhtml\Block\Customer\System\Config\Validatevat + * @return \Magento\Customer\Block\Adminhtml\System\Config\Validatevat */ protected function _prepareLayout() { parent::_prepareLayout(); if (!$this->getTemplate()) { - $this->setTemplate('customer/system/config/validatevat.phtml'); + $this->setTemplate('system/config/validatevat.phtml'); } return $this; } @@ -151,7 +151,7 @@ class Validatevat extends \Magento\Backend\Block\System\Config\Form\Field $this->addData(array( 'button_label' => __($buttonLabel), 'html_id' => $element->getHtmlId(), - 'ajax_url' => $this->_urlBuilder->getUrl('adminhtml/customer_system_config_validatevat/validate') + 'ajax_url' => $this->_urlBuilder->getUrl('customer/system_config_validatevat/validate') )); return $this->_toHtml(); diff --git a/app/code/Magento/Customer/Controller/Account.php b/app/code/Magento/Customer/Controller/Account.php index 703d1481dd3958fcbcd01c8be77a5cac75dd9d53..56ac5c3f4bb382c8c188f32d204d297ae85b03d7 100644 --- a/app/code/Magento/Customer/Controller/Account.php +++ b/app/code/Magento/Customer/Controller/Account.php @@ -24,11 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Customer\Controller; + /** * Customer account controller */ -namespace Magento\Customer\Controller; - class Account extends \Magento\Core\Controller\Front\Action { /** @@ -63,7 +63,7 @@ class Account extends \Magento\Core\Controller\Front\Action * * @var \Magento\Core\Model\Registry */ - protected $_coreRegistry = null; + protected $_coreRegistry; /** * @var \Magento\Customer\Model\Session @@ -95,6 +95,13 @@ class Account extends \Magento\Core\Controller\Front\Action */ protected $_addressFactory; + /** + * Magento string lib + * + * @var \Magento\Stdlib\String + */ + protected $string; + /** * @param \Magento\Core\Controller\Varien\Action\Context $context * @param \Magento\Core\Model\Registry $coreRegistry @@ -104,6 +111,7 @@ class Account extends \Magento\Core\Controller\Front\Action * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Customer\Model\FormFactory $formFactory * @param \Magento\Customer\Model\AddressFactory $addressFactory + * @param \Magento\Stdlib\String $string */ public function __construct( \Magento\Core\Controller\Varien\Action\Context $context, @@ -113,7 +121,8 @@ class Account extends \Magento\Core\Controller\Front\Action \Magento\Core\Model\UrlFactory $urlFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Customer\Model\FormFactory $formFactory, - \Magento\Customer\Model\AddressFactory $addressFactory + \Magento\Customer\Model\AddressFactory $addressFactory, + \Magento\Stdlib\String $string ) { $this->_coreRegistry = $coreRegistry; $this->_customerSession = $customerSession; @@ -122,6 +131,7 @@ class Account extends \Magento\Core\Controller\Front\Action $this->_customerFactory = $customerFactory; $this->_formFactory = $formFactory; $this->_addressFactory = $addressFactory; + $this->string = $string; parent::__construct($context); } @@ -252,7 +262,7 @@ class Account extends \Magento\Core\Controller\Front\Action $session->addError($message); $session->setUsername($login['username']); } catch (\Exception $e) { - // $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); // PA DSS violation: this exception log can disclose customer password + // $this->_objectManager->get('Magento\Logger')->logException($e); // PA DSS violation: this exception log can disclose customer password } } else { $session->addError(__('Login and password are required.')); @@ -695,7 +705,7 @@ class Account extends \Magento\Core\Controller\Front\Action return; } } - $email = $this->_objectManager->get('Magento\Customer\Helper\Data')->escapeHtml($email); + $email = $this->_objectManager->get('Magento\Escaper')->escapeHtml($email); $this->_getSession()->addSuccess( __('If there is an account associated with %1 you will receive an email with a link to reset your password.', $email) ); @@ -902,7 +912,7 @@ class Account extends \Magento\Core\Controller\Front\Action $confPass = $this->getRequest()->getPost('confirmation'); $oldPass = $this->_getSession()->getCustomer()->getPasswordHash(); - if ($this->_objectManager->get('Magento\Core\Helper\String')->strpos($oldPass, ':')) { + if ($this->string->strpos($oldPass, ':')) { list(, $salt) = explode(':', $oldPass); } else { $salt = false; diff --git a/app/code/Magento/Adminhtml/Controller/Customer/Cart/Product/Composite/Cart.php b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php similarity index 92% rename from app/code/Magento/Adminhtml/Controller/Customer/Cart/Product/Composite/Cart.php rename to app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php index 3bae3f19558971c28cf769a382c620891f452239..17b77204ed47e83b55fc0a3fee9ec07ae9ae7839 100644 --- a/app/code/Magento/Adminhtml/Controller/Customer/Cart/Product/Composite/Cart.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Catalog composite product configuration controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Customer\Cart\Product\Composite; +namespace Magento\Customer\Controller\Adminhtml\Cart\Product\Composite; class Cart extends \Magento\Backend\Controller\Adminhtml\Action { @@ -59,7 +59,7 @@ class Cart extends \Magento\Backend\Controller\Adminhtml\Action /** * Loads customer, quote and quote item by request params * - * @return \Magento\Adminhtml\Controller\Customer\Cart\Product\Composite\Cart + * @return \Magento\Customer\Controller\Adminhtml\Cart\Product\Composite\Cart */ protected function _initData() { @@ -89,7 +89,7 @@ class Cart extends \Magento\Backend\Controller\Adminhtml\Action /** * Ajax handler to response configuration fieldset of composite product in customer's cart * - * @return \Magento\Adminhtml\Controller\Customer\Cart\Product\Composite\Cart + * @return \Magento\Customer\Controller\Adminhtml\Cart\Product\Composite\Cart */ public function configureAction() { @@ -123,7 +123,7 @@ class Cart extends \Magento\Backend\Controller\Adminhtml\Action /** * IFrame handler for submitted configuration for quote item * - * @return \Magento\Adminhtml\Controller\Customer\Cart\Product\Composite\Cart + * @return \Magento\Customer\Controller\Adminhtml\Cart\Product\Composite\Cart */ public function updateAction() { @@ -144,7 +144,7 @@ class Cart extends \Magento\Backend\Controller\Adminhtml\Action $updateResult->setJsVarName($this->getRequest()->getParam('as_js_varname')); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setCompositeProductResult($updateResult); - $this->_redirect('adminhtml/product/showUpdateResult'); + $this->_redirect('catalog/product/showUpdateResult'); return $this; } diff --git a/app/code/Magento/Adminhtml/Controller/Customer/Group.php b/app/code/Magento/Customer/Controller/Adminhtml/Group.php similarity index 91% rename from app/code/Magento/Adminhtml/Controller/Customer/Group.php rename to app/code/Magento/Customer/Controller/Adminhtml/Group.php index 0f42f85803d34c2de033b9ba2e304af4c4ade95e..029e27d87ae1dd115537507c5b20b20de3841800 100644 --- a/app/code/Magento/Adminhtml/Controller/Customer/Group.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Group.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Customer groups controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Customer; +namespace Magento\Customer\Controller\Adminhtml; class Group extends \Magento\Backend\Controller\Adminhtml\Action { @@ -89,7 +89,7 @@ class Group extends \Magento\Backend\Controller\Adminhtml\Action $this->loadLayout(); $this->_setActiveMenu('Magento_Customer::customer_group'); $this->_addBreadcrumb(__('Customers'), __('Customers')); - $this->_addBreadcrumb(__('Customer Groups'), __('Customer Groups'), $this->getUrl('adminhtml/customer_group')); + $this->_addBreadcrumb(__('Customer Groups'), __('Customer Groups'), $this->getUrl('customer/group')); $currentGroup = $this->_coreRegistry->registry('current_group'); @@ -101,7 +101,7 @@ class Group extends \Magento\Backend\Controller\Adminhtml\Action $this->_title($currentGroup->getId() ? $currentGroup->getCode() : __('New Customer Group')); - $this->getLayout()->addBlock('Magento\Adminhtml\Block\Customer\Group\Edit', 'group', 'content') + $this->getLayout()->addBlock('Magento\Customer\Block\Adminhtml\Group\Edit', 'group', 'content') ->setEditMode((bool)$this->_coreRegistry->registry('current_group')->getId()); $this->renderLayout(); @@ -138,12 +138,12 @@ class Group extends \Magento\Backend\Controller\Adminhtml\Action $customerGroup->setTaxClassId($taxClass)->save(); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The customer group has been saved.')); - $this->getResponse()->setRedirect($this->getUrl('adminhtml/customer_group')); + $this->getResponse()->setRedirect($this->getUrl('customer/group')); return; } catch (\Exception $e) { $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setCustomerGroupData($customerGroup->getData()); - $this->getResponse()->setRedirect($this->getUrl('adminhtml/customer_group/edit', array('id' => $id))); + $this->getResponse()->setRedirect($this->getUrl('customer/group/edit', array('id' => $id))); return; } } else { @@ -161,22 +161,22 @@ class Group extends \Magento\Backend\Controller\Adminhtml\Action $customerGroup = $this->_objectManager->create('Magento\Customer\Model\Group')->load($id); if (!$customerGroup->getId()) { $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError(__('The customer group no longer exists.')); - $this->_redirect('adminhtml/*/'); + $this->_redirect('customer/*/'); return; } try { $customerGroup->delete(); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess(__('The customer group has been deleted.')); - $this->getResponse()->setRedirect($this->getUrl('adminhtml/customer_group')); + $this->getResponse()->setRedirect($this->getUrl('customer/group')); return; } catch (\Exception $e) { $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($e->getMessage()); - $this->getResponse()->setRedirect($this->getUrl('adminhtml/customer_group/edit', array('id' => $id))); + $this->getResponse()->setRedirect($this->getUrl('customer/group/edit', array('id' => $id))); return; } } - $this->_redirect('adminhtml/customer_group'); + $this->_redirect('customer/group'); } protected function _isAllowed() diff --git a/app/code/Magento/Adminhtml/Controller/Customer.php b/app/code/Magento/Customer/Controller/Adminhtml/Index.php similarity index 96% rename from app/code/Magento/Adminhtml/Controller/Customer.php rename to app/code/Magento/Customer/Controller/Adminhtml/Index.php index e02d5b1dd5a6c58f5aa133b173d4f34fd51a36d5..7b478c7ca27800d407e9bf2abfc8b9121244698b 100644 --- a/app/code/Magento/Adminhtml/Controller/Customer.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index.php @@ -23,9 +23,9 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller; +namespace Magento\Customer\Controller\Adminhtml; -class Customer extends \Magento\Backend\Controller\Adminhtml\Action +class Index extends \Magento\Backend\Controller\Adminhtml\Action { /** * @var \Magento\Validator @@ -55,7 +55,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action * Customer initialization * * @param string $idFieldName - * @return \Magento\Adminhtml\Controller\Customer + * @return \Magento\Customer\Controller\Adminhtml\Index */ protected function _initCustomer($idFieldName = 'id') { @@ -94,7 +94,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action * Append customers block to content */ $this->_addContent( - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Customer', 'customer') + $this->getLayout()->createBlock('Magento\Customer\Block\Adminhtml\Customer', 'customer') ); /** @@ -212,7 +212,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($exception->getMessage()); } } - $this->_redirect('adminhtml/customer'); + $this->_redirect('customer/index'); } /** @@ -285,12 +285,12 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action if ($returnToEdit) { if ($customerId) { - $this->_redirect('adminhtml/*/edit', array('id' => $customerId, '_current' => true)); + $this->_redirect('customer/*/edit', array('id' => $customerId, '_current' => true)); } else { - $this->_redirect('adminhtml/*/new', array('_current' => true)); + $this->_redirect('customer/*/new', array('_current' => true)); } } else { - $this->_redirect('adminhtml/customer'); + $this->_redirect('customer/index'); } } @@ -301,14 +301,14 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action { $customerId = (int)$this->getRequest()->getParam('customer_id', 0); if (!$customerId) { - return $this->_redirect('adminhtml/customer'); + return $this->_redirect('customer/index'); } /** @var \Magento\Customer\Model\Customer $customer */ $customer = $this->_objectManager->create('Magento\Customer\Model\Customer'); $customer->load($customerId); if (!$customer->getId()) { - return $this->_redirect('adminhtml/customer'); + return $this->_redirect('customer/index'); } try { @@ -334,7 +334,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action __('An error occurred while resetting customer password.')); } - $this->_redirect('adminhtml/*/edit', array('id' => $customerId, '_current' => true)); + $this->_redirect('customer/*/edit', array('id' => $customerId, '_current' => true)); } /** @@ -461,7 +461,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action public function exportCsvAction() { $fileName = 'customers.csv'; - $content = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Customer\Grid')->getCsvFile(); + $content = $this->getLayout()->createBlock('Magento\Customer\Block\Adminhtml\Grid')->getCsvFile(); $this->_prepareDownloadResponse($fileName, $content); } @@ -472,7 +472,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action public function exportXmlAction() { $fileName = 'customers.xml'; - $content = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Customer\Grid')->getExcelFile(); + $content = $this->getLayout()->createBlock('Magento\Customer\Block\Adminhtml\Grid')->getExcelFile(); $this->_prepareDownloadResponse($fileName, $content); } @@ -519,7 +519,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action $this->_objectManager->create('Magento\Wishlist\Model\Item')->load($itemId) ->delete(); } catch (\Exception $exception) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($exception); + $this->_objectManager->get('Magento\Logger')->logException($exception); } } @@ -744,7 +744,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError($exception->getMessage()); } } - $this->_redirect('adminhtml/*/index'); + $this->_redirect('customer/*/index'); } /** @@ -770,7 +770,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action } } - $this->_redirect('adminhtml/*/index'); + $this->_redirect('customer/*/index'); } /** @@ -797,7 +797,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action } } - $this->_redirect('adminhtml/*/index'); + $this->_redirect('customer/*/index'); } /** @@ -823,7 +823,7 @@ class Customer extends \Magento\Backend\Controller\Adminhtml\Action } } - $this->_redirect('adminhtml/*/index'); + $this->_redirect('customer/*/index'); } /** diff --git a/app/code/Magento/Adminhtml/Controller/Customer/Online.php b/app/code/Magento/Customer/Controller/Adminhtml/Online.php similarity index 95% rename from app/code/Magento/Adminhtml/Controller/Customer/Online.php rename to app/code/Magento/Customer/Controller/Adminhtml/Online.php index 5d5df1a809209b83abfd71fa12c910850430a394..d280b1a46b327d35a549da819b6ee80ec0fc6b0f 100644 --- a/app/code/Magento/Adminhtml/Controller/Customer/Online.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Online.php @@ -19,11 +19,11 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller\Customer; +namespace Magento\Customer\Controller\Adminhtml; class Online extends \Magento\Backend\Controller\Adminhtml\Action { diff --git a/app/code/Magento/Adminhtml/Controller/Customer/System/Config/Validatevat.php b/app/code/Magento/Customer/Controller/Adminhtml/System/Config/Validatevat.php similarity index 95% rename from app/code/Magento/Adminhtml/Controller/Customer/System/Config/Validatevat.php rename to app/code/Magento/Customer/Controller/Adminhtml/System/Config/Validatevat.php index 155112daa12962882d3722da55dd754b2db9549a..a75b70f5826cee0b4b92eca594a9e8f6eacfe8a0 100644 --- a/app/code/Magento/Adminhtml/Controller/Customer/System/Config/Validatevat.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/System/Config/Validatevat.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * VAT validation controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Customer\System\Config; +namespace Magento\Customer\Controller\Adminhtml\System\Config; class Validatevat extends \Magento\Backend\Controller\Adminhtml\Action { diff --git a/app/code/Magento/Adminhtml/Controller/Customer/Wishlist/Product/Composite/Wishlist.php b/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php similarity index 93% rename from app/code/Magento/Adminhtml/Controller/Customer/Wishlist/Product/Composite/Wishlist.php rename to app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php index 29b77cb3347ea81a1ad686100a42047c14ab4390..594955b9a0583ac24359ee75dc8ed05d2d29613f 100644 --- a/app/code/Magento/Adminhtml/Controller/Customer/Wishlist/Product/Composite/Wishlist.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Catalog composite product configuration controller * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Controller\Customer\Wishlist\Product\Composite; +namespace Magento\Customer\Controller\Adminhtml\Wishlist\Product\Composite; class Wishlist extends \Magento\Backend\Controller\Adminhtml\Action @@ -53,7 +53,7 @@ class Wishlist /** * Loads wishlist and wishlist item * - * @return \Magento\Adminhtml\Controller\Customer\Wishlist\Product\Composite\Wishlist + * @return \Magento\Customer\Controller\Adminhtml\Wishlist\Product\Composite\Wishlist */ protected function _initData() { @@ -81,7 +81,7 @@ class Wishlist /** * Ajax handler to response configuration fieldset of composite product in customer's wishlist * - * @return \Magento\Adminhtml\Controller\Customer\Wishlist\Product\Composite\Wishlist + * @return \Magento\Customer\Controller\Adminhtml\Wishlist\Product\Composite\Wishlist */ public function configureAction() { @@ -131,7 +131,7 @@ class Wishlist } $updateResult->setJsVarName($this->getRequest()->getParam('as_js_varname')); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setCompositeProductResult($updateResult); - $this->_redirect('adminhtml/product/showUpdateResult'); + $this->_redirect('catalog/product/showUpdateResult'); return false; } diff --git a/app/code/Magento/Customer/Helper/Data.php b/app/code/Magento/Customer/Helper/Data.php index 9d2360c4f792b2a7d5a4ef3069277b50a52db7de..d8d8ee9016c75b8bf3d9aa57bc04e404e49ad34f 100644 --- a/app/code/Magento/Customer/Helper/Data.php +++ b/app/code/Magento/Customer/Helper/Data.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Customer\Helper; /** * Customer Data Helper - * - * @category Magento - * @package Magento_Customer - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Customer\Helper; - class Data extends \Magento\Core\Helper\AbstractHelper { /** @@ -80,6 +75,21 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ const XML_PATH_CUSTOMER_RESET_PASSWORD_LINK_EXPIRATION_PERIOD = 'customer/password/reset_link_expiration_period'; + /** + * Configuration path to merchant country id + */ + const XML_PATH_MERCHANT_COUNTRY_CODE = 'general/store_information/country_id'; + + /** + * Config path to merchant VAT number + */ + const XML_PATH_MERCHANT_VAT_NUMBER = 'general/store_information/merchant_vat_number'; + + /** + * Config path to UE country list + */ + const XML_PATH_EU_COUNTRIES_LIST = 'general/country/eu_countries'; + /** * VAT class constants */ @@ -100,7 +110,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper * * @var \Magento\Core\Helper\Data */ - protected $_coreData = null; + protected $_coreData; /** * Customer address @@ -132,7 +142,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper * @var \Magento\Customer\Model\Session */ protected $_customerSession; - + /** * @var \Magento\Customer\Model\GroupFactory */ @@ -143,6 +153,16 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ protected $_formFactory; + /** + * @var \Magento\Escaper + */ + protected $_escaper; + + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Customer\Helper\Address $customerAddress @@ -153,6 +173,8 @@ class Data extends \Magento\Core\Helper\AbstractHelper * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\GroupFactory $groupFactory * @param \Magento\Customer\Model\FormFactory $formFactory + * @param \Magento\Escaper $escaper + * @param \Magento\Math\Random $mathRandom */ public function __construct( \Magento\Event\ManagerInterface $eventManager, @@ -163,7 +185,9 @@ class Data extends \Magento\Core\Helper\AbstractHelper \Magento\Core\Model\Config $coreConfig, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\GroupFactory $groupFactory, - \Magento\Customer\Model\FormFactory $formFactory + \Magento\Customer\Model\FormFactory $formFactory, + \Magento\Escaper $escaper, + \Magento\Math\Random $mathRandom ) { $this->_eventManager = $eventManager; $this->_customerAddress = $customerAddress; @@ -173,9 +197,46 @@ class Data extends \Magento\Core\Helper\AbstractHelper $this->_customerSession = $customerSession; $this->_groupFactory = $groupFactory; $this->_formFactory = $formFactory; + $this->_escaper = $escaper; + $this->mathRandom = $mathRandom; parent::__construct($context); } + /** + * Retrieve merchant country code + * + * @param \Magento\Core\Model\Store|string|int|null $store + * @return string + */ + public function getMerchantCountryCode($store = null) + { + return (string) $this->_coreStoreConfig->getConfig(self::XML_PATH_MERCHANT_COUNTRY_CODE, $store); + } + + /** + * Retrieve merchant VAT number + * + * @param \Magento\Core\Model\Store|string|int|null $store + * @return string + */ + public function getMerchantVatNumber($store = null) + { + return (string) $this->_coreStoreConfig->getConfig(self::XML_PATH_MERCHANT_VAT_NUMBER, $store); + } + + /** + * Check whether specified country is in EU countries list + * + * @param string $countryCode + * @param null|int $storeId + * @return bool + */ + public function isCountryInEU($countryCode, $storeId = null) + { + $euCountries = explode(',', $this->_coreStoreConfig->getConfig(self::XML_PATH_EU_COUNTRIES_LIST, $storeId)); + return in_array($countryCode, $euCountries); + } + /** * Check customer is logged in * @@ -413,6 +474,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper /** * Retrieve name prefix dropdown options * + * @param null $store * @return array|bool */ public function getNamePrefixOptions($store = null) @@ -425,6 +487,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper /** * Retrieve name suffix dropdown options * + * @param null $store * @return array|bool */ public function getNameSuffixOptions($store = null) @@ -449,7 +512,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper $result = array(); $options = explode(';', $options); foreach ($options as $value) { - $value = $this->escapeHtml(trim($value)); + $value = $this->_escaper->escapeHtml(trim($value)); $result[$value] = $value; } return $result; @@ -462,7 +525,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function generateResetPasswordLinkToken() { - return $this->_coreData->uniqHash(); + return $this->mathRandom->getUniqueHash(); } /** @@ -584,19 +647,16 @@ class Data extends \Magento\Core\Helper\AbstractHelper public function canCheckVatNumber($countryCode, $vatNumber, $requesterCountryCode, $requesterVatNumber) { $result = true; - /** @var $coreHelper \Magento\Core\Helper\Data */ - $coreHelper = $this->_coreData; - if (!is_string($countryCode) || !is_string($vatNumber) || !is_string($requesterCountryCode) || !is_string($requesterVatNumber) || empty($countryCode) - || !$coreHelper->isCountryInEU($countryCode) + || !$this->isCountryInEU($countryCode) || empty($vatNumber) || (empty($requesterCountryCode) && !empty($requesterVatNumber)) || (!empty($requesterCountryCode) && empty($requesterVatNumber)) - || (!empty($requesterCountryCode) && !$coreHelper->isCountryInEU($requesterCountryCode)) + || (!empty($requesterCountryCode) && !$this->isCountryInEU($requesterCountryCode)) ) { $result = false; } @@ -620,7 +680,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper if (is_string($customerCountryCode) && !empty($customerCountryCode) - && $customerCountryCode === $this->_coreData->getMerchantCountryCode($store) + && $customerCountryCode === $this->getMerchantCountryCode($store) && $isVatNumberValid ) { $vatClass = self::VAT_CLASS_DOMESTIC; @@ -667,7 +727,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper } else if ($validationResult->getRequestSuccess()) { $message = sprintf( __('The VAT ID entered (%s) is not a valid VAT ID.') . ' ', - $this->escapeHtml($customerAddress->getVatId()) + $this->_escaper->escapeHtml($customerAddress->getVatId()) ); if (!$groupAutoAssignDisabled && !$customerGroupAutoAssignDisabled) { $message .= $willChargeTaxMessage; diff --git a/app/code/Magento/Customer/Model/Address/Config/SchemaLocator.php b/app/code/Magento/Customer/Model/Address/Config/SchemaLocator.php index da4f6b0d443c2efc44d9089403e09864a4cf4223..3eb52014d8275a38e387b30a7145415bbe4408d6 100644 --- a/app/code/Magento/Customer/Model/Address/Config/SchemaLocator.php +++ b/app/code/Magento/Customer/Model/Address/Config/SchemaLocator.php @@ -35,9 +35,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface private $_schema; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Customer') . '/address_formats.xsd'; } diff --git a/app/code/Magento/Customer/Model/Attribute/Data/Postcode.php b/app/code/Magento/Customer/Model/Attribute/Data/Postcode.php index 81b5b955116cae78761bb19c8ee089c4a8b56e88..0fd970c61fdde3f87c2869de454a1e0c778e8340 100644 --- a/app/code/Magento/Customer/Model/Attribute/Data/Postcode.php +++ b/app/code/Magento/Customer/Model/Attribute/Data/Postcode.php @@ -53,14 +53,14 @@ class Postcode extends \Magento\Eav\Model\Attribute\Data\Text /** * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Helper\String $stringHelper + * @param \Magento\Logger $logger + * @param \Magento\Stdlib\String $stringHelper * @param \Magento\Directory\Helper\Data $directoryData */ public function __construct( \Magento\Core\Model\LocaleInterface $locale, - \Magento\Core\Model\Logger $logger, - \Magento\Core\Helper\String $stringHelper, + \Magento\Logger $logger, + \Magento\Stdlib\String $stringHelper, \Magento\Directory\Helper\Data $directoryData ) { $this->_directoryData = $directoryData; diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index 8869c0f916243bf45c9a40cb273ca66c923743a4..903c3de16fcd22c6eb8fd09d5c773de5f15718dd 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -24,20 +24,16 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Customer\Model; + /** * Customer model * - * @category Magento - * @package Magento_Customer - * @author Magento Core Team <core@magentocommerce.com> - * * @method int getWebsiteId() getWebsiteId() * @method int getStoreId() getStoreId() * @method string getEmail() getEmail() * @method \Magento\Customer\Model\Resource\Customer _getResource() */ -namespace Magento\Customer\Model; - class Customer extends \Magento\Core\Model\AbstractModel { /** @@ -133,13 +129,6 @@ class Customer extends \Magento\Core\Model\AbstractModel /** @var \Magento\Eav\Model\Config */ protected $_config; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * Customer data * @@ -155,11 +144,6 @@ class Customer extends \Magento\Core\Model\AbstractModel protected $_eventManager = null; /** - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Customer\Helper\Data $customerData - * @param \Magento\Core\Helper\Data $coreData - * Core store config - * * @var \Magento\Core\Model\Store\Config */ protected $_coreStoreConfig; @@ -199,10 +183,24 @@ class Customer extends \Magento\Core\Model\AbstractModel */ protected $_attributeFactory; + /** + * @var \Magento\Encryption\EncryptorInterface + */ + protected $_encryptor; + + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Customer\Helper\Data $customerData - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\Sender $sender @@ -217,13 +215,15 @@ class Customer extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\Email\InfoFactory $emailInfoFactory * @param \Magento\Customer\Model\GroupFactory $groupFactory * @param \Magento\Customer\Model\AttributeFactory $attributeFactory + * @param \Magento\Encryption\EncryptorInterface $encryptor + * @param \Magento\Math\Random $mathRandom + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Data\Collection\Db|null $resourceCollection * @param array $data */ public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Customer\Helper\Data $customerData, - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\Sender $sender, @@ -238,12 +238,14 @@ class Customer extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Email\InfoFactory $emailInfoFactory, \Magento\Customer\Model\GroupFactory $groupFactory, \Magento\Customer\Model\AttributeFactory $attributeFactory, + \Magento\Encryption\EncryptorInterface $encryptor, + \Magento\Math\Random $mathRandom, + \Magento\Stdlib\DateTime $dateTime, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_eventManager = $eventManager; $this->_customerData = $customerData; - $this->_coreData = $coreData; $this->_coreStoreConfig = $coreStoreConfig; $this->_sender = $sender; $this->_storeManager = $storeManager; @@ -255,6 +257,9 @@ class Customer extends \Magento\Core\Model\AbstractModel $this->_emailInfoFactory = $emailInfoFactory; $this->_groupFactory = $groupFactory; $this->_attributeFactory = $attributeFactory; + $this->_encryptor = $encryptor; + $this->mathRandom = $mathRandom; + $this->dateTime = $dateTime; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -496,7 +501,7 @@ class Customer extends \Magento\Core\Model\AbstractModel */ public function hashPassword($password, $salt = null) { - return $this->_coreData->getHash($password, !is_null($salt) ? $salt : 2); + return $this->_encryptor->getHash($password, !is_null($salt) ? $salt : 2); } /** @@ -507,7 +512,7 @@ class Customer extends \Magento\Core\Model\AbstractModel */ public function generatePassword($length = 6) { - return $this->_coreData->getRandomString($length); + return $this->mathRandom->getRandomString($length); } /** @@ -522,7 +527,7 @@ class Customer extends \Magento\Core\Model\AbstractModel if (!$hash) { return false; } - return $this->_coreData->validateHash($password, $hash); + return $this->_encryptor->validateHash($password, $hash); } @@ -534,7 +539,7 @@ class Customer extends \Magento\Core\Model\AbstractModel */ public function encryptPassword($password) { - return $this->_coreData->encrypt($password); + return $this->_encryptor->encrypt($password); } /** @@ -545,7 +550,7 @@ class Customer extends \Magento\Core\Model\AbstractModel */ public function decryptPassword($password) { - return $this->_coreData->decrypt($password); + return $this->_encryptor->decrypt($password); } /** @@ -1050,7 +1055,7 @@ class Customer extends \Magento\Core\Model\AbstractModel { $date = $this->getCreatedAt(); if ($date) { - return \Magento\Date::toTimestamp($date); + return $this->dateTime->toTimestamp($date); } return null; } @@ -1217,9 +1222,8 @@ class Customer extends \Magento\Core\Model\AbstractModel $expirationPeriod = $this->_customerData->getResetPasswordLinkExpirationPeriod(); - $currentDate = \Magento\Date::now(); - $currentTimestamp = \Magento\Date::toTimestamp($currentDate); - $tokenTimestamp = \Magento\Date::toTimestamp($linkTokenCreatedAt); + $currentTimestamp = $this->dateTime->toTimestamp($this->dateTime->now()); + $tokenTimestamp = $this->dateTime->toTimestamp($linkTokenCreatedAt); if ($tokenTimestamp > $currentTimestamp) { return true; } diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php index 06d8a28614189bc1c497f3f0f30c8eb69143f169..82f56eb7553efae64d33c76805858d55e8dfa85c 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php @@ -24,36 +24,34 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Customer\Model\Customer\Attribute\Backend; + /** * Customer password attribute backend - * - * @category Magento - * @package Magento_Customer - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Customer\Model\Customer\Attribute\Backend; - -class Password - extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend +class Password extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { + /** + * Min password length + */ const MIN_PASSWORD_LENGTH = 6; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * @param \Magento\Core\Helper\String $coreString - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger + * @param \Magento\Stdlib\String $string */ public function __construct( - \Magento\Core\Helper\String $coreString, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger, + \Magento\Stdlib\String $string ) { - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($logger); } @@ -67,10 +65,8 @@ class Password public function beforeSave($object) { $password = $object->getPassword(); - /** @var \Magento\Core\Helper\String $stringHelper */ - $stringHelper = $this->_coreString; - $length = $stringHelper->strlen($password); + $length = $this->string->strlen($password); if ($length > 0) { if ($length < self::MIN_PASSWORD_LENGTH) { throw new \Magento\Core\Exception( @@ -78,8 +74,8 @@ class Password ); } - if ($stringHelper->substr($password, 0, 1) == ' ' || - $stringHelper->substr($password, $length - 1, 1) == ' ') { + if ($this->string->substr($password, 0, 1) == ' ' || + $this->string->substr($password, $length - 1, 1) == ' ') { throw new \Magento\Core\Exception(__('The password can not begin or end with a space.')); } @@ -93,13 +89,11 @@ class Password */ public function validate($object) { - if ($password = $object->getPassword()) { - if ($password == $object->getPasswordConfirm()) { - return true; - } + $password = $object->getPassword(); + if ($password && $password == $object->getPasswordConfirm()) { + return true; } return parent::validate($object); } - } diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php index 58a237c918b0915af7caee211765c3fbfbc22790..fd68950af4c08aa902cca6618d6672a24d6d70f5 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php @@ -42,17 +42,15 @@ class Store protected $_storeManager; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param array $data */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\StoreManagerInterface $storeManager, - array $data = array() + \Magento\Logger $logger, + \Magento\Core\Model\StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager; - parent::__construct($logger, $data); + parent::__construct($logger); } /** diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php index 77e17c3ac6905bdb73cb865ffd9c74594ad7ea63..fc908a0ad1cb0ad3c00a5d4bb90682fb35dad055 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php @@ -42,17 +42,15 @@ class Website protected $_storeManager; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param array $data */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\StoreManagerInterface $storeManager, - array $data = array() + \Magento\Logger $logger, + \Magento\Core\Model\StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager; - parent::__construct($logger, $data); + parent::__construct($logger); } /** diff --git a/app/code/Magento/Customer/Model/Group.php b/app/code/Magento/Customer/Model/Group.php index f38958526f08041abf3c1de5307489e52765a289..af33c22c0bdaebc1a71ca954a935f124f374ff52 100644 --- a/app/code/Magento/Customer/Model/Group.php +++ b/app/code/Magento/Customer/Model/Group.php @@ -72,9 +72,9 @@ class Group extends \Magento\Core\Model\AbstractModel protected static $_taxClassIds = array(); /** - * @var \Magento\Core\Model\Config + * @var \Magento\Core\Model\Store\Config */ - protected $_coreConfig; + protected $_storeConfig; /** * @var \Magento\Index\Model\Indexer @@ -86,7 +86,7 @@ class Group extends \Magento\Core\Model\AbstractModel * * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Core\Model\Config $coreConfig + * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -95,13 +95,13 @@ class Group extends \Magento\Core\Model\AbstractModel public function __construct( \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\Core\Model\Config $coreConfig, + \Magento\Core\Model\Store\Config $storeConfig, \Magento\Index\Model\Indexer $indexer, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreConfig = $coreConfig; + $this->_storeConfig = $storeConfig; $this->_indexer = $indexer; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -146,7 +146,7 @@ class Group extends \Magento\Core\Model\AbstractModel public function usesAsDefault() { - $data = $this->_coreConfig->getStoresConfigByPath(self::XML_PATH_DEFAULT_ID); + $data = $this->_storeConfig->getStoresConfigByPath(self::XML_PATH_DEFAULT_ID); if (in_array($this->getId(), $data)) { return true; } diff --git a/app/code/Magento/Customer/Model/Observer.php b/app/code/Magento/Customer/Model/Observer.php index e02831d4ebe6be584d173e4f1a8f297c8eca5c49..1cef82c3403a2dd0e3e850d8a4c8f6968035f956 100644 --- a/app/code/Magento/Customer/Model/Observer.php +++ b/app/code/Magento/Customer/Model/Observer.php @@ -53,21 +53,14 @@ class Observer * * @var \Magento\Core\Model\Registry */ - protected $_coreRegistry = null; - + protected $_coreRegistry; + /** * Customer data * * @var \Magento\Customer\Helper\Data */ - protected $_customerData = null; - - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; + protected $_customerData; /** * @var \Magento\Core\Model\StoreManager @@ -80,7 +73,6 @@ class Observer protected $_customerSession; /** - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Customer\Helper\Data $customerData * @param \Magento\Customer\Helper\Address $customerAddress * @param \Magento\Core\Model\Registry $coreRegistry @@ -88,14 +80,12 @@ class Observer * @param \Magento\Customer\Model\Session $customerSession */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Customer\Helper\Data $customerData, \Magento\Customer\Helper\Address $customerAddress, \Magento\Core\Model\Registry $coreRegistry, \Magento\Core\Model\StoreManager $storeManager, \Magento\Customer\Model\Session $customerSession ) { - $this->_coreData = $coreData; $this->_customerData = $customerData; $this->_customerAddress = $customerAddress; $this->_coreRegistry = $coreRegistry; @@ -204,7 +194,7 @@ class Observer $customerHelper = $this->_customerData; if ($customerAddress->getVatId() == '' - || !$this->_coreData->isCountryInEU($customerAddress->getCountry())) + || !$this->_customerData->isCountryInEU($customerAddress->getCountry())) { $defaultGroupId = $customerHelper->getDefaultCustomerGroupId($customer->getStore()); diff --git a/app/code/Magento/Adminhtml/Model/Customer/Renderer/Region.php b/app/code/Magento/Customer/Model/Renderer/Region.php similarity index 92% rename from app/code/Magento/Adminhtml/Model/Customer/Renderer/Region.php rename to app/code/Magento/Customer/Model/Renderer/Region.php index 6d945714839d9b36480b9ad775058bc7e43a6621..c3eaf57c2a376bb5a71392e2f067aac627afbc43 100644 --- a/app/code/Magento/Adminhtml/Model/Customer/Renderer/Region.php +++ b/app/code/Magento/Customer/Model/Renderer/Region.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * REgion field renderer * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Model\Customer\Renderer; +namespace Magento\Customer\Model\Renderer; class Region implements \Magento\Data\Form\Element\Renderer\RendererInterface { @@ -49,9 +49,9 @@ class Region implements \Magento\Data\Form\Element\Renderer\RendererInterface /** * Adminhtml data * - * @var \Magento\Adminhtml\Helper\Data + * @var \Magento\Escaper */ - protected $_adminhtmlData = null; + protected $_escaper = null; /** * @var \Magento\Directory\Model\CountryFactory @@ -60,14 +60,14 @@ class Region implements \Magento\Data\Form\Element\Renderer\RendererInterface /** * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param \Magento\Adminhtml\Helper\Data $adminhtmlData + * @param \Magento\Escaper $escaper */ public function __construct( \Magento\Directory\Model\CountryFactory $countryFactory, - \Magento\Adminhtml\Helper\Data $adminhtmlData + \Magento\Escaper $escaper ) { $this->_countryFactory = $countryFactory; - $this->_adminhtmlData = $adminhtmlData; + $this->_escaper = $escaper; } public function render(\Magento\Data\Form\Element\AbstractElement $element) @@ -121,7 +121,7 @@ class Region implements \Magento\Data\Form\Element\Renderer\RendererInterface $selected = ($regionId==$region['value']) ? ' selected="selected"' : ''; $regionVal = (0 == $region['value']) ? '' : (int)$region['value']; $html.= '<option value="' . $regionVal . '"' . $selected . '>' - . $this->_adminhtmlData->escapeHtml(__($region['label'])) + . $this->_escaper->escapeHtml(__($region['label'])) . '</option>'; } $html.= '</select>' . "\n"; diff --git a/app/code/Magento/Customer/Model/Resource/Address.php b/app/code/Magento/Customer/Model/Resource/Address.php index 00b27ba4f2de4081d373b01503040eedb396d410..bd7e14858bcb2d1ec08140a867758e93bb6d7e97 100644 --- a/app/code/Magento/Customer/Model/Resource/Address.php +++ b/app/code/Magento/Customer/Model/Resource/Address.php @@ -38,7 +38,7 @@ class Address extends \Magento\Eav\Model\Entity\AbstractEntity protected $_customerFactory; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity * @param \Magento\Core\Model\LocaleInterface $locale @@ -49,7 +49,7 @@ class Address extends \Magento\Eav\Model\Entity\AbstractEntity * @param array $data */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity, \Magento\Core\Model\LocaleInterface $locale, diff --git a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php index c28cf56fdd18555df6f556d787356bff6b8b60d0..86e3f11fc50cdf0ab2c1faa1555dec590785da64 100644 --- a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php +++ b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php @@ -43,17 +43,15 @@ class Region protected $_regionFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Directory\Model\RegionFactory $regionFactory - * @param array $data */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Directory\Model\RegionFactory $regionFactory, - array $data = array() + \Magento\Logger $logger, + \Magento\Directory\Model\RegionFactory $regionFactory ) { $this->_regionFactory = $regionFactory; - parent::__construct($logger, $data); + parent::__construct($logger); } /** diff --git a/app/code/Magento/Customer/Model/Resource/Customer.php b/app/code/Magento/Customer/Model/Resource/Customer.php index 69a6d9614873c9447779ffd0299357f3b6eac3a2..7d1c1e59d7f14b3bcbcf5e986bee5f31536336fc 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer.php +++ b/app/code/Magento/Customer/Model/Resource/Customer.php @@ -1,7 +1,5 @@ <?php /** - * Customer entity resource model - * * Magento * * NOTICE OF LICENSE @@ -23,8 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Customer\Model\Resource; +/** + * Customer entity resource model + */ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity { /** @@ -40,7 +42,12 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity protected $_coreStoreConfig; /** - * @param \Magento\Core\Model\Resource $resource + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity * @param \Magento\Core\Model\LocaleInterface $locale @@ -48,10 +55,11 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Validator\Factory $validatorFactory + * @param \Magento\Stdlib\DateTime $dateTime * @param array $data */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity, \Magento\Core\Model\LocaleInterface $locale, @@ -59,6 +67,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Validator\Factory $validatorFactory, + \Magento\Stdlib\DateTime $dateTime, $data = array() ) { parent::__construct( @@ -72,6 +81,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity ); $this->_coreStoreConfig = $coreStoreConfig; $this->_validatorFactory = $validatorFactory; + $this->dateTime = $dateTime; $this->setType('customer'); $this->setConnection('customer_read', 'customer_write'); } @@ -381,8 +391,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity { if (is_string($passwordLinkToken) && !empty($passwordLinkToken)) { $customer->setRpToken($passwordLinkToken); - $currentDate = \Magento\Date::now(); - $customer->setRpTokenCreatedAt($currentDate); + $customer->setRpTokenCreatedAt($this->dateTime->now()); $this->saveAttribute($customer, 'rp_token'); $this->saveAttribute($customer, 'rp_token_created_at'); } diff --git a/app/code/Magento/Customer/Model/Resource/Customer/Collection.php b/app/code/Magento/Customer/Model/Resource/Customer/Collection.php index 7a3c6a46f84c144a670be70f5b2d9432effb1a95..3e6573f1a878a84fd1ce498a5b8ead5b0beab5c8 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer/Collection.php +++ b/app/code/Magento/Customer/Model/Resource/Customer/Collection.php @@ -43,11 +43,11 @@ class Collection extends \Magento\Eav\Model\Entity\Collection\AbstractCollection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory @@ -55,11 +55,11 @@ class Collection extends \Magento\Eav\Model\Entity\Collection\AbstractCollection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, diff --git a/app/code/Magento/Customer/Model/Resource/Group.php b/app/code/Magento/Customer/Model/Resource/Group.php index 52e44f8dba54ff77887febc0eab6c6ec6fd01d73..046003dc517c6a2b755b770085b8e3028ae04213 100644 --- a/app/code/Magento/Customer/Model/Resource/Group.php +++ b/app/code/Magento/Customer/Model/Resource/Group.php @@ -52,12 +52,12 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb * Class constructor * * @param \Magento\Customer\Helper\Data $customerData - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Customer\Model\Resource\Customer\CollectionFactory $customersFactory */ public function __construct( \Magento\Customer\Helper\Data $customerData, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Customer\Model\Resource\Customer\CollectionFactory $customersFactory ) { $this->_customerData = $customerData; diff --git a/app/code/Magento/Customer/Model/Resource/Setup.php b/app/code/Magento/Customer/Model/Resource/Setup.php index 2b954e1e5b7cb810df1a3a1c15ba49d16c35da09..b8025a63bc8a855350a4f976aaa233f8baf76c76 100644 --- a/app/code/Magento/Customer/Model/Resource/Setup.php +++ b/app/code/Magento/Customer/Model/Resource/Setup.php @@ -43,16 +43,16 @@ class Setup extends \Magento\Eav\Model\Entity\Setup /** * @param \Magento\Core\Model\Resource\Setup\Context $context - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\CacheInterface $resourceName + * @param \Magento\App\CacheInterface $resourceName * @param string $moduleName * @param string $connectionName */ public function __construct( \Magento\Core\Model\Resource\Setup\Context $context, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, \Magento\Eav\Model\Config $eavConfig, $resourceName, diff --git a/app/code/Magento/Customer/etc/adminhtml/menu.xml b/app/code/Magento/Customer/etc/adminhtml/menu.xml index bdf0d7480feadb385c02d9008e8f8351e8c6ca94..dcdecec3c075de3f706d6e8ff098a2dd1fe3bcd9 100644 --- a/app/code/Magento/Customer/etc/adminhtml/menu.xml +++ b/app/code/Magento/Customer/etc/adminhtml/menu.xml @@ -28,8 +28,8 @@ <config> <menu> <add id="Magento_Customer::customer" title="Customers" module="Magento_Customer" sortOrder="30" resource="Magento_Customer::customer"/> - <add id="Magento_Customer::customer_manage" title="All Customers" module="Magento_Customer" sortOrder="10" parent="Magento_Customer::customer" action="adminhtml/customer/" resource="Magento_Customer::manage"/> - <add id="Magento_Customer::customer_group" title="Customer Groups" module="Magento_Customer" sortOrder="10" parent="Magento_Adminhtml::other_settings" action="adminhtml/customer_group/" resource="Magento_Customer::group"/> - <add id="Magento_Customer::customer_online" title="Now Online" module="Magento_Customer" sortOrder="30" parent="Magento_Customer::customer" action="adminhtml/customer_online/" resource="Magento_Customer::online"/> + <add id="Magento_Customer::customer_manage" title="All Customers" module="Magento_Customer" sortOrder="10" parent="Magento_Customer::customer" action="customer/index/" resource="Magento_Customer::manage"/> + <add id="Magento_Customer::customer_group" title="Customer Groups" module="Magento_Customer" sortOrder="10" parent="Magento_Adminhtml::other_settings" action="customer/group" resource="Magento_Customer::group"/> + <add id="Magento_Customer::customer_online" title="Now Online" module="Magento_Customer" sortOrder="30" parent="Magento_Customer::customer" action="customer/online" resource="Magento_Customer::online"/> </menu> </config> diff --git a/app/code/Magento/Customer/etc/adminhtml/routes.xml b/app/code/Magento/Customer/etc/adminhtml/routes.xml new file mode 100644 index 0000000000000000000000000000000000000000..fa9f180f4064bf67aa7bf7f8afcfd2e4c2a0068b --- /dev/null +++ b/app/code/Magento/Customer/etc/adminhtml/routes.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <router id="admin"> + <route id="customer" frontName="customer"> + <module name="Magento_Customer" /> + </route> + </router> +</config> \ No newline at end of file diff --git a/app/code/Magento/Customer/etc/adminhtml/system.xml b/app/code/Magento/Customer/etc/adminhtml/system.xml index 599d70daadc49b21b1cd87387e5bfb7b2cbed8a1..4b9e8874a4c522770aa7ed84488d387b56357407 100644 --- a/app/code/Magento/Customer/etc/adminhtml/system.xml +++ b/app/code/Magento/Customer/etc/adminhtml/system.xml @@ -247,7 +247,7 @@ <group id="store_information"> <field id="validate_vat_number" translate="button_label" sortOrder="62" showInDefault="1" showInWebsite="1" showInStore="0"> <button_label>Validate VAT Number</button_label> - <frontend_model>Magento\Adminhtml\Block\Customer\System\Config\Validatevat</frontend_model> + <frontend_model>Magento\Customer\Block\Adminhtml\System\Config\Validatevat</frontend_model> </field> </group> </section> diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 4932fb7b9ccd7db79752b87d3b9755ac61788100..5a3fef8c872c29421bf746d7c2e1c5190b32ce89 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -35,7 +35,7 @@ <instance type="Magento\Customer\Model\Resource\Customer\Proxy" /> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <customer_setup>Magento\Customer\Model\Resource\Setup</customer_setup> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/edit/js.phtml b/app/code/Magento/Customer/view/adminhtml/edit/js.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/edit/js.phtml rename to app/code/Magento/Customer/view/adminhtml/edit/js.phtml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/edit/tab/account/form/renderer/group.phtml b/app/code/Magento/Customer/view/adminhtml/edit/tab/account/form/renderer/group.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/edit/tab/account/form/renderer/group.phtml rename to app/code/Magento/Customer/view/adminhtml/edit/tab/account/form/renderer/group.phtml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/edit/tab/js/addresses.js b/app/code/Magento/Customer/view/adminhtml/edit/tab/js/addresses.js similarity index 96% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/edit/tab/js/addresses.js rename to app/code/Magento/Customer/view/adminhtml/edit/tab/js/addresses.js index 03ee76bd5fdabcd987d11f95f7dcdffde8ec1bbb..275106cc1d3dd90007e158a2ef99d45723208e0c 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/customer/edit/tab/js/addresses.js +++ b/app/code/Magento/Customer/view/adminhtml/edit/tab/js/addresses.js @@ -18,7 +18,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Magento_Adminhtml + * @package Magento_Customer * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ @@ -39,13 +39,13 @@ tabAddressTemplateSelector: '[data-template="tab-address-content"]', formsSelector: '[data-container="address-forms"]', addAddressSelector: '[data-container="add-address"]', - formFirstNameSelector: ':input[data-ui-id="customer-edit-tab-addresses-fieldset-element-text-address-template-firstname"]', - accountFirstNameSelector: ':input[data-ui-id="customer-edit-tab-account-fieldset-element-text-account-firstname"]', - formLastNameSelector: ':input[data-ui-id="customer-edit-tab-addresses-fieldset-element-text-address-template-lastname"]', - accountLastNameSelector: ':input[data-ui-id="customer-edit-tab-account-fieldset-element-text-account-lastname"]', + formFirstNameSelector: ':input[data-ui-id="adminhtml-edit-tab-addresses-fieldset-element-text-address-template-firstname"]', + accountFirstNameSelector: ':input[data-ui-id="adminhtml-edit-tab-account-fieldset-element-text-account-firstname"]', + formLastNameSelector: ':input[data-ui-id="adminhtml-edit-tab-addresses-fieldset-element-text-address-template-lastname"]', + accountLastNameSelector: ':input[data-ui-id="adminhtml-edit-tab-account-fieldset-element-text-account-lastname"]', accountWebsiteIdSelector: ':input[data-ui-id="store-switcher-form-renderer-fieldset-element-select-account-website-id"]', formCountrySelector: 'customer-edit-tab-addresses-fieldset-element-form-field-country-id', - addAddressButtonSelector: ':button[data-ui-id="customer-edit-tab-addresses-add-address-button"]' + addAddressButtonSelector: ':button[data-ui-id="adminhtml-edit-tab-addresses-add-address-button"]' }, /** diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_group_index.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_group_index.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml index 8fd72e0ec4e04748fa3b85800311423523e586f5..c92420419047fa141c5baad2197c11a65459e5ae 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_group_index.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Customer\Group" name="adminhtml.block.customer.group.grid.container"> + <block class="Magento\Customer\Block\Adminhtml\Group" name="adminhtml.block.customer.group.grid.container"> <block class="Magento\Backend\Block\Widget\Grid" name="adminhtml.block.customer.group.grid" as="grid"> <arguments> <argument name="id" xsi:type="string">customerGroupGrid</argument> @@ -37,7 +37,7 @@ <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="adminhtml.customer.group.grid.columnSet"> <arguments> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">adminhtml/*/edit</item> + <item name="path" xsi:type="string">customer/*/edit</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="id" xsi:type="string">getId</item> </item> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_cart.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_cart.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_cart.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_index_cart.xml index 5fd068b88fe2f5e91f16406979ca2fd4a1144efc..6dd7a49dfa12174cc3788406b09a572223ac7858 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_cart.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_cart.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\Cart" name="admin.customer.view.edit.cart"/> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\Cart" name="admin.customer.view.edit.cart"/> </container> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_carts.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_carts.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_carts.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_index_carts.xml index 4cc0596c43a198ba4837f915f3f58f71b59ec294..13f49ed5b24e8f4b9b253dec0eb5b70a2f3b471a 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_carts.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_carts.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\Carts" name="admin.customer.carts"/> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\Carts" name="admin.customer.carts"/> </container> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_edit.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml similarity index 84% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_edit.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml index c28a3b842c7eea6203d9e26daf7c9f50d334859b..befdce1ccfd4f928bad355e9f4d8ef1bc1d1253f 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_edit.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Customer\Edit" name="customer_edit"/> + <block class="Magento\Customer\Block\Adminhtml\Edit" name="customer_edit"/> </referenceContainer> <referenceBlock name="head"> <block class="Magento\Adminhtml\Block\Template" name="optional_zip_countries" as="optional_zip_countries" template="Magento_Directory::js/optional_zip_countries.phtml"/> @@ -41,15 +41,15 @@ </block> <block class="Magento\Page\Block\Html\Head\Script" name="magento-adminhtml-customer-edit-tab-js-addresses.js"> <arguments> - <argument name="file" xsi:type="string">Magento_Adminhtml::customer/edit/tab/js/addresses.js</argument> + <argument name="file" xsi:type="string">Magento_Customer::edit/tab/js/addresses.js</argument> </arguments> </block> </referenceBlock> <referenceContainer name="left"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tabs" name="customer_edit_tabs"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\View" name="customer_edit_tab_view" template="customer/tab/view.phtml"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\View\Sales" name="sales" template="customer/tab/view/sales.phtml" before="-"/> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\View\Accordion" name="accordion"/> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tabs" name="customer_edit_tabs"> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\View" name="customer_edit_tab_view" template="tab/view.phtml"> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\View\Sales" name="sales" template="tab/view/sales.phtml" before="-"/> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\View\Accordion" name="accordion"/> </block> <action method="addTab"> <argument name="name" xsi:type="string">customer_edit_tab_view</argument> @@ -58,7 +58,7 @@ </block> </referenceContainer> <referenceContainer name="js"> - <block class="Magento\Adminhtml\Block\Template" template="customer/edit/js.phtml" name="customer.edit.js" as="customer_edit_js"/> + <block class="Magento\Adminhtml\Block\Template" template="Magento_Customer::edit/js.phtml" name="customer.edit.js" as="customer_edit_js"/> </referenceContainer> <referenceBlock name="customer_edit_tabs"> <action method="addTab"> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_grid.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_grid.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_grid.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_index_grid.xml index 2db519626c3fe48da3e4827c7d29bd8abc0c6288..8b1e74cf1763590c0d57d13626809637440cd6a7 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_grid.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_grid.xml @@ -26,6 +26,6 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="formkey"/> <container name="root" label="Root" output="1"> - <block class="Magento\Adminhtml\Block\Customer\Grid" name="admin.customer.grid"/> + <block class="Magento\Customer\Block\Adminhtml\Grid" name="admin.customer.grid"/> </container> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_lastorders.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_lastorders.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_lastorders.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_index_lastorders.xml index 2ad856b4fe4e9a4b23844f65e5c39791ccab90a3..2a2a1eea1780b9f7cd58c7e3fb322d5aac5da529 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_lastorders.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_lastorders.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\View\Orders" name="admin.customer.lastorders"/> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\View\Orders" name="admin.customer.lastorders"/> </container> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_newsletter.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_newsletter.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_newsletter.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_index_newsletter.xml index 264212eefc5713cacb2d4bb4cd8ffdb8215124ec..34948361db1214100e36f2d40b1cc67bc34d3626 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_newsletter.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_newsletter.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\Newsletter\Grid" name="admin.customer.newsletter.grid"/> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\Newsletter\Grid" name="admin.customer.newsletter.grid"/> </container> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_orders.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_orders.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_orders.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_index_orders.xml index 37aa99de7f86df169fd97d2c1c6c506ecedbecf3..64e7b61acf13bd149dbb329fa77c16ee64c1b7fc 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_orders.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_orders.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\Orders" name="adminhtml.customer.edit.tab.orders"/> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\Orders" name="adminhtml.customer.edit.tab.orders"/> </container> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_productreviews.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_productreviews.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml index d94d986c549eccddaa394a5d43d9c2f0b6cd94b2..eb136ef14974b0cde1488e4a58da49c15cf44aa3 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_productreviews.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\Reviews" name="admin.customer.reviews"/> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\Reviews" name="admin.customer.reviews"/> </container> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_viewcart.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewcart.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_viewcart.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewcart.xml index 52126364a8f29c9cb400e88820e0e63a1cb6556f..76ef15681eb848254616a6115baa8b54c7c80393 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_viewcart.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewcart.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\View\Cart" name="admin.customer.view.cart"/> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\View\Cart" name="admin.customer.view.cart"/> </container> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_viewwishlist.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewwishlist.xml similarity index 94% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_viewwishlist.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewwishlist.xml index d9c54cf3dc5f96660a3dd2d9bd4dd336a1ae8598..423477efb1dbccc08d38cb8792bc06791994781b 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_viewwishlist.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewwishlist.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <container name="root" label="Root" output="1"> - <block class="Magento\Adminhtml\Block\Customer\Edit\Tab\View\Wishlist" name="admin.customer.view.wishlist"/> + <block class="Magento\Customer\Block\Adminhtml\Edit\Tab\View\Wishlist" name="admin.customer.view.wishlist"/> </container> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_online_index.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_online_index.xml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_online_index.xml rename to app/code/Magento/Customer/view/adminhtml/layout/customer_online_index.xml index 6b172871def2b40e1f28ffb5e69d8e0911f5d668..a2e19321076d6a6aaaad4c5931bcd881bae51917 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_customer_online_index.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_online_index.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Customer\Online" name="adminhtml.block.customer.online.grid.container"> + <block class="Magento\Customer\Block\Adminhtml\Online" name="adminhtml.block.customer.online.grid.container"> <block class="Magento\Backend\Block\Widget\Grid" name="adminhtml.block.customer.online.grid" as="grid"> <arguments> <argument name="id" xsi:type="string">onlineGrid</argument> @@ -38,7 +38,7 @@ <arguments> <argument name="rowUrl" xsi:type="array"> <item name="generatorClass" xsi:type="string">Magento\Log\Model\Resource\Visitor\Online\Grid\Row\UrlGenerator</item> - <item name="path" xsi:type="string">adminhtml/customer/edit</item> + <item name="path" xsi:type="string">customer/index/edit</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="id" xsi:type="string">getCustomerId</item> </item> @@ -80,7 +80,7 @@ <argument name="header" xsi:type="string" translate="true">IP Address</argument> <argument name="default" xsi:type="string">n/a</argument> <argument name="filter" xsi:type="string">0</argument> - <argument name="renderer" xsi:type="string">Magento\Adminhtml\Block\Customer\Online\Grid\Renderer\Ip</argument> + <argument name="renderer" xsi:type="string">Magento\Customer\Block\Adminhtml\Online\Grid\Renderer\Ip</argument> <argument name="index" xsi:type="string">remote_addr</argument> </arguments> </block> @@ -119,7 +119,7 @@ <argument name="linelength" xsi:type="string">60</argument> <argument name="type" xsi:type="string">wrapline</argument> <argument name="index" xsi:type="string">last_url</argument> - <argument name="renderer" xsi:type="string">Magento\Adminhtml\Block\Customer\Online\Grid\Renderer\Url</argument> + <argument name="renderer" xsi:type="string">Magento\Customer\Block\Adminhtml\Online\Grid\Renderer\Url</argument> </arguments> </block> </block> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/online.phtml b/app/code/Magento/Customer/view/adminhtml/online.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/online.phtml rename to app/code/Magento/Customer/view/adminhtml/online.phtml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/sales/order/create/address/form/renderer/vat.phtml b/app/code/Magento/Customer/view/adminhtml/sales/order/create/address/form/renderer/vat.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/sales/order/create/address/form/renderer/vat.phtml rename to app/code/Magento/Customer/view/adminhtml/sales/order/create/address/form/renderer/vat.phtml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/system/config/validatevat.phtml b/app/code/Magento/Customer/view/adminhtml/system/config/validatevat.phtml similarity index 97% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/system/config/validatevat.phtml rename to app/code/Magento/Customer/view/adminhtml/system/config/validatevat.phtml index c6461d763c63266bdce4bb12c088453c23405ecd..804072cfa8f2c4d799c5fb48fefb7e29b8a4677f 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/customer/system/config/validatevat.phtml +++ b/app/code/Magento/Customer/view/adminhtml/system/config/validatevat.phtml @@ -26,7 +26,7 @@ ?> <?php /** - * @see \Magento\Adminhtml\Block\Customer\System\Config\Validatevat + * @see \Magento\Customer\Block\Adminhtml\System\Config\Validatevat */ ?> <script type="text/javascript"> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/tab/addresses.phtml b/app/code/Magento/Customer/view/adminhtml/tab/addresses.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/tab/addresses.phtml rename to app/code/Magento/Customer/view/adminhtml/tab/addresses.phtml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/tab/cart.phtml b/app/code/Magento/Customer/view/adminhtml/tab/cart.phtml similarity index 81% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/tab/cart.phtml rename to app/code/Magento/Customer/view/adminhtml/tab/cart.phtml index 75f1efbed0e3fccdc999401fdc562e833d01853d..f78315ff712bff12a7f663eb881d6b04d706c1ff 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/customer/tab/cart.phtml +++ b/app/code/Magento/Customer/view/adminhtml/tab/cart.phtml @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<?php /* @var $this \Magento\Adminhtml\Block\Customer\Edit\Tab\Cart */ ?> +<?php /* @var $this \Magento\Customer\Block\Adminhtml\Edit\Tab\Cart */ ?> <?php if($this->getCartHeader()): ?> <div class="content-header skip-header"> <table cellspacing="0"> @@ -65,10 +65,10 @@ removeItem: function (itemId) { if (!itemId) { - alert('<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('No item specified.')) ?>'); + alert('<?php echo $this->escapeJsQuote(__('No item specified.')) ?>'); return false; } - if(!confirm('<?php echo $this->helper('Magento\Customer\Helper\Data')->jsQuoteEscape(__('Are you sure that you want to remove this item?')) ?>')) { + if(!confirm('<?php echo $this->escapeJsQuote(__('Are you sure that you want to remove this item?')) ?>')) { return false; } @@ -87,8 +87,8 @@ $params = array( productConfigure.addListType( '<?php echo $listType ?>', { - urlFetch: '<?php echo $this->getUrl('adminhtml/customer_cart_product_composite_cart/configure', $params) ?>', - urlConfirm: '<?php echo $this->getUrl('adminhtml/customer_cart_product_composite_cart/update', $params) ?>' + urlFetch: '<?php echo $this->getUrl('customer/cart_product_composite_cart/configure', $params) ?>', + urlConfirm: '<?php echo $this->getUrl('customer/cart_product_composite_cart/update', $params) ?>' } ); </script> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/tab/newsletter.phtml b/app/code/Magento/Customer/view/adminhtml/tab/newsletter.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/tab/newsletter.phtml rename to app/code/Magento/Customer/view/adminhtml/tab/newsletter.phtml diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/tab/view.phtml b/app/code/Magento/Customer/view/adminhtml/tab/view.phtml similarity index 98% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/tab/view.phtml rename to app/code/Magento/Customer/view/adminhtml/tab/view.phtml index 3ab8de29c2d968de7d02ae3e06f2ea70fdec2640..e2d82d4fa4374eb71b7e2c701d507a2dbeccf874 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/customer/tab/view.phtml +++ b/app/code/Magento/Customer/view/adminhtml/tab/view.phtml @@ -26,7 +26,7 @@ ?> <?php /** - * Template for block \Magento\Adminhtml\Block\Customer\Edit\Tab\View + * Template for block \Magento\Customer\Block\Adminhtml\Edit\Tab\View */ ?> <?php diff --git a/app/code/Magento/Adminhtml/view/adminhtml/customer/tab/view/sales.phtml b/app/code/Magento/Customer/view/adminhtml/tab/view/sales.phtml similarity index 98% rename from app/code/Magento/Adminhtml/view/adminhtml/customer/tab/view/sales.phtml rename to app/code/Magento/Customer/view/adminhtml/tab/view/sales.phtml index 518107b0314bc90af1545f7ba38b430cbf66b13e..8f3148a0cc84678785ad65ce341d60317795f87d 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/customer/tab/view/sales.phtml +++ b/app/code/Magento/Customer/view/adminhtml/tab/view/sales.phtml @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<?php /** @var $this \Magento\Adminhtml\Block\Customer\Edit\Tab\View\Sales */ ?> +<?php /** @var $this \Magento\Customer\Block\Adminhtml\Edit\Tab\View\Sales */ ?> <?php $singleStoreMode = $this->isSingleStoreMode(); ?> <div class="entry-edit fieldset-wrapper"> diff --git a/app/code/Magento/Customer/view/frontend/address/edit.phtml b/app/code/Magento/Customer/view/frontend/address/edit.phtml index 7b91429fad5a7146466e6fe0c554a3cb93e4308f..e726d3a6e2a349afce484757e32ea2254bc37bf3 100644 --- a/app/code/Magento/Customer/view/frontend/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/address/edit.phtml @@ -105,10 +105,10 @@ <div class="field"> <label for="region_id" class="required"><em>*</em><?php echo __('State/Province') ?></label> <div class="input-box"> - <select id="region_id" name="region_id" title="<?php echo __('State/Province') ?>" class="validate-select" style="display:none;" <?php if ($this->getConfigNode('general/region/display_all') === 0) { ?>disabled="disabled"<?php } ?>> + <select id="region_id" name="region_id" title="<?php echo __('State/Province') ?>" class="validate-select" style="display:none;" <?php if (!$this->getConfig('general/region/display_all')) { ?>disabled="disabled"<?php } ?>> <option value=""><?php echo __('Please select region, state or province') ?></option> </select> - <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo __('State/Province') ?>" class="input-text <?php echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('region') ?>" <?php if ($this->getConfigNode('general/region/display_all') === 0) { ?>disabled="disabled"<?php } ?>/> + <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo __('State/Province') ?>" class="input-text <?php echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('region') ?>" <?php if (!$this->getConfig('general/region/display_all')) { ?>disabled="disabled"<?php } ?>/> </div> </div> </li> diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php index b5ef0df1d2f03fea9265f013aa419f7c73383e94..69e5010302bc2a25d2187a98eed03bb0524e68ed 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php @@ -70,7 +70,7 @@ abstract class AbstractComposite protected $_elementsFactory; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Element\Factory $elementsFactory @@ -78,7 +78,7 @@ abstract class AbstractComposite * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Element\Factory $elementsFactory, @@ -88,7 +88,7 @@ abstract class AbstractComposite $this->_elementsFactory = $elementsFactory; $this->_rendererFactory = $rendererFactory; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); } /** diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/Edit.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/Edit.php index 7b459b7adcc34448f5958a56b4f2a534039f54e5..2b02e142b4e7ee6fad6d77309dc38357c92560d8 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/Edit.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/Edit.php @@ -181,7 +181,7 @@ class Edit $sourceChange = $this->_changeFactory->create(); $sourceChange->loadByThemeId($this->_themeContext->getEditableTheme()->getId()); $dateMessage = $this->_localeModel - ->date($sourceChange->getChangeTime(), \Magento\Date::DATETIME_INTERNAL_FORMAT)->toString(); + ->date($sourceChange->getChangeTime(), \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)->toString(); $message = __('Do you want to restore the version saved at %1?', $dateMessage); $data = array( @@ -194,7 +194,7 @@ class Edit ) ) ); - return $this->helper('Magento\Backend\Helper\Data')->escapeHtml(json_encode($data)); + return $this->escapeHtml(json_encode($data)); } /** @@ -215,7 +215,7 @@ class Edit ) ) ); - return $this->helper('Magento\Backend\Helper\Data')->escapeHtml(json_encode($data)); + return $this->escapeHtml(json_encode($data)); } /** diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/Save.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/Save.php index 651b99b56f07f492a2120c3617a008d5ccaa76de..f721b50884983de4dc827a77fc58836f6aedd131 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/Save.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/Save.php @@ -33,8 +33,7 @@ */ namespace Magento\DesignEditor\Block\Adminhtml\Editor\Toolbar\Buttons; -class Save - extends \Magento\Backend\Block\Widget\Button\SplitButton +class Save extends \Magento\Backend\Block\Widget\Button\SplitButton { /** * Current theme used for preview @@ -301,6 +300,6 @@ class Save */ protected function _encode($data) { - return $this->helper('Magento\Backend\Helper\Data')->escapeHtml(json_encode($data)); + return $this->escapeHtml(json_encode($data)); } } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php index 8f87707be62f8165317829cebc385b1c0abc55ff..4e0c8fe98236bf4ada0a9336500e6eb2fbd37fe7 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php @@ -45,7 +45,7 @@ class Custom extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\DesignEditor\Model\Theme\Context $themeContext @@ -53,7 +53,7 @@ class Custom extends \Magento\Backend\Block\Widget\Form\Generic */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\DesignEditor\Model\Theme\Context $themeContext, diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php index ffcabe79c5d4d84dc2d6c5bdca2c631074489d09..a1553ee7043c5b6d679a1d823ff8249b4d77fe7b 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php @@ -50,7 +50,7 @@ class ImageSizing extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Eav\Model\Config $eavConfig @@ -60,7 +60,7 @@ class ImageSizing extends \Magento\Backend\Block\Widget\Form\Generic */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Eav\Model\Config $eavConfig, @@ -170,7 +170,7 @@ class ImageSizing extends \Magento\Backend\Block\Widget\Form\Generic 'name' => 'save_image_sizing', 'title' => __('Update'), 'value' => __('Update'), - 'data-mage-init' => $this->helper('Magento\Backend\Helper\Data')->escapeHtml(json_encode(array( + 'data-mage-init' => $this->escapeHtml(json_encode(array( 'button' => array( 'event' => 'saveForm', 'target' => 'body' @@ -364,7 +364,7 @@ class ImageSizing extends \Magento\Backend\Block\Widget\Form\Generic 'title' => __('Reset to Original'), 'value' => __('Reset to Original'), 'class' => 'action-reset', - 'data-mage-init' => $this->helper('Magento\Backend\Helper\Data')->escapeHtml(json_encode(array( + 'data-mage-init' => $this->escapeHtml(json_encode(array( 'button' => array( 'event' => 'restoreDefaultData', 'target' => 'body', diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php index 64d7886d5aa1a04c4e5ef93b243ac3cf681962e7..df05cf2a656bf8aa8ae7bb5607ad34e9fa90b548 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php @@ -45,7 +45,7 @@ class Js extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Theme\Model\Config\Customization $customizationConfig @@ -54,7 +54,7 @@ class Js extends \Magento\Backend\Block\Widget\Form\Generic */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Theme\Model\Config\Customization $customizationConfig, diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Button.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Button.php index cc2e4bec63da0a33878cb7daeb37d3f2fe7f4b56..162196bd6aee3c3116781e739f253d96158bf0ea 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Button.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Button.php @@ -91,11 +91,10 @@ class Button extends \Magento\Core\Block\Template */ protected function _attributesToHtml($attributes) { - $helper = $this->helper('Magento\Backend\Helper\Data'); $html = ''; foreach ($attributes as $attributeKey => $attributeValue) { if ($attributeValue !== null && $attributeValue !== '') { - $html .= $attributeKey . '="' . $helper->escapeHtml($attributeValue) . '" '; + $html .= $attributeKey . '="' . $this->escapeHtml($attributeValue) . '" '; } } return $html; diff --git a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php index 2000b054019d332bdece9b81ea9868391a4f1e13..f4de40686263103fb13aff5bdfdaeb6681706d84 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php @@ -95,7 +95,7 @@ class Editor extends \Magento\Backend\Controller\Adminhtml\Action $response = array('content' => $this->getLayout()->getOutput()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $response = array('error' => __('Sorry, but we can\'t load the theme list.')); } $this->getResponse()->setBody($coreHelper->jsonEncode($response)); @@ -140,12 +140,12 @@ class Editor extends \Magento\Backend\Controller\Adminhtml\Action $this->renderLayout(); } catch (\Magento\Core\Exception $e) { $this->_getSession()->addException($e, $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_redirect('adminhtml/*/'); return; } catch (\Exception $e) { $this->_getSession()->addException($e, __('Sorry, there was an unknown error.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_redirect('adminhtml/*/'); return; } @@ -185,7 +185,7 @@ class Editor extends \Magento\Backend\Controller\Adminhtml\Action 'themeId' => $themeCustomization->getId() ); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->getResponse()->setBody($coreHelper->jsonEncode( array('error' => __('This theme is not assigned.')) )); @@ -218,9 +218,9 @@ class Editor extends \Magento\Backend\Controller\Adminhtml\Action $response = array('success' => true); } catch (\Magento\Core\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $response = array('error' => true, 'message' => __('This theme is not saved.')); } $this->getResponse()->setBody($coreHelper->jsonEncode($response)); @@ -255,7 +255,7 @@ class Editor extends \Magento\Backend\Controller\Adminhtml\Action } $response = array('message' => $message); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $response = array('error' => true, 'message' => __('Sorry, there was an unknown error.')); } @@ -290,9 +290,9 @@ class Editor extends \Magento\Backend\Controller\Adminhtml\Action ); } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__('You cannot duplicate this theme.')); } $this->_redirectUrl($this->_getRefererUrl()); @@ -339,7 +339,7 @@ class Editor extends \Magento\Backend\Controller\Adminhtml\Action } $response = array('message' => $message); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $response = array('error' => true, 'message' => __('Unknown error')); } /** @var $coreHelper \Magento\Core\Helper\Data */ @@ -501,7 +501,7 @@ class Editor extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Exception $e) { $this->_getSession()->addError(__('We can\'t load the list of themes.')); $this->_redirectUrl($this->_getRefererUrl()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } diff --git a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Files.php b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Files.php index a444d787175dd0e2e9bf501662bd178a44012f65..e343e66fc6384c7629ce2b35ab790a168db65f67 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Files.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Files.php @@ -44,7 +44,7 @@ class Files ->getTreeJson($this->_getStorage()->getTreeArray()) ); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode(array())); } } diff --git a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php index fa3939438d0e7d676a6e55247a1082c33461a83c..19fdb2007d32fdf6b14d06b6dd589ae7d3517d88 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php @@ -72,10 +72,10 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action ); } catch (\Magento\Core\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $response = array('error' => true, 'message' => __('We cannot upload the CSS file.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response)); } @@ -102,10 +102,10 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action ); } catch (\Magento\Core\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $response = array('error' => true, 'message' => __('We can\'t save the custom css file.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response)); } @@ -123,7 +123,7 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action $result = array('error' => false, 'files' => $customization->generateFileInfo($customJsFiles)); $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } @@ -149,10 +149,10 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action return; } catch (\Magento\Core\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $response = array('error' => true, 'message' => __('We cannot upload the JS file.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response)); } @@ -170,7 +170,7 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action $this->_forward('jsList'); } catch (\Exception $e) { $this->_redirectUrl($this->_getRefererUrl()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } @@ -189,10 +189,10 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action $result = array('success' => true); } catch (\Magento\Core\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('We cannot upload the CSS file.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); } @@ -221,10 +221,10 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action $result = array('success' => true, 'message' => __('We saved the image sizes.')); } catch (\Magento\Core\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('We can\'t save image sizes.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); @@ -257,12 +257,12 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Magento\Core\Exception $e) { $this->_session->addError($e->getMessage()); $response = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $errorMessage = __('Something went wrong uploading the image.' . ' Please check the file format and try again (JPEG, GIF, or PNG).'); $response = array('error' => true, 'message' => $errorMessage); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response)); } @@ -296,12 +296,12 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action $response = array('error' => false, 'content' => $result); } catch (\Magento\Core\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $errorMessage = __('Something went wrong uploading the image.' . ' Please check the file format and try again (JPEG, GIF, or PNG).'); $response = array('error' => true, 'message' => $errorMessage); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response)); } @@ -341,12 +341,12 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action $response = array('error' => false, 'content' => array('name' => basename($storeLogo->getValue()))); } catch (\Magento\Core\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $errorMessage = __('Something went wrong uploading the image.' . ' Please check the file format and try again (JPEG, GIF, or PNG).'); $response = array('error' => true, 'message' => $errorMessage); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response)); } @@ -386,12 +386,12 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action $response = array('error' => false, 'content' => array()); } catch (\Magento\Core\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $errorMessage = __('Something went wrong uploading the image.' . ' Please check the file format and try again (JPEG, GIF, or PNG).'); $response = array('error' => true, 'message' => $errorMessage); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response)); } @@ -416,12 +416,12 @@ class Tools extends \Magento\Backend\Controller\Adminhtml\Action $response = array('success' => true); } catch (\Magento\Core\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } catch (\Exception $e) { $errorMessage = __('Something went wrong uploading the image.' . ' Please check the file format and try again (JPEG, GIF, or PNG).'); $response = array('error' => true, 'message' => $errorMessage); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response)); } diff --git a/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php b/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php index db0afa6961d52b2e68bf8c16d9bee87e5c523cfc..e944632dbb6f99e8f4ef272891babdbbcecd76a4 100644 --- a/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php +++ b/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php @@ -27,7 +27,7 @@ namespace Magento\DesignEditor\Controller\Varien\Router; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Standard extends \Magento\Core\Controller\Varien\Router\Base +class Standard extends \Magento\Core\App\Router\Base { /** * @var \Magento\ObjectManager @@ -54,55 +54,38 @@ class Standard extends \Magento\Core\Controller\Varien\Router\Base protected $_urlRewriteService; /** + * @param \Magento\App\ActionFactory $actionFactory + * @param \Magento\App\DefaultPathInterface $defaultPath + * @param \Magento\App\ResponseFactory $responseFactory + * @param \Magento\App\Route\Config $routeConfig + * @param \Magento\App\State $appState + * @param \Magento\UrlInterface $url + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo * @param \Magento\App\RouterListInterface $routerList - * @param \Magento\App\ActionFactory $controllerFactory * @param \Magento\ObjectManager $objectManager - * @param \Magento\Filesystem $filesystem - * @param \Magento\Core\Model\App $app - * @param \Magento\Core\Model\Route\Config $routeConfig - * @param \Magento\Core\Model\Url\SecurityInfoInterface $securityInfo - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Config $config - * @param \Magento\Core\Model\Url $url - * @param \Magento\Core\Model\StoreManager $storeManager - * @param \Magento\App\State $appState * @param \Magento\Core\App\Request\RewriteService $urlRewriteService - * @param string $areaCode - * @param string $baseController - * @param string $routerId + * @param $routerId */ public function __construct( + \Magento\App\ActionFactory $actionFactory, + \Magento\App\DefaultPathInterface $defaultPath, + \Magento\App\ResponseFactory $responseFactory, + \Magento\App\Route\Config $routeConfig, + \Magento\App\State $appState, + \Magento\UrlInterface $url, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo, \Magento\App\RouterListInterface $routerList, - \Magento\App\ActionFactory $controllerFactory, \Magento\ObjectManager $objectManager, - \Magento\Filesystem $filesystem, - \Magento\Core\Model\App $app, - \Magento\Core\Model\Route\Config $routeConfig, - \Magento\Core\Model\Url\SecurityInfoInterface $securityInfo, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Config $config, - \Magento\Core\Model\Url $url, - \Magento\Core\Model\StoreManager $storeManager, - \Magento\App\State $appState, \Magento\Core\App\Request\RewriteService $urlRewriteService, - $areaCode, - $baseController, $routerId ) { parent::__construct( - $controllerFactory, - $filesystem, - $app, - $coreStoreConfig, - $routeConfig, - $securityInfo, - $config, - $url, - $storeManager, - $appState, - $areaCode, - $baseController, - $routerId + $actionFactory, $defaultPath, $responseFactory, $routeConfig, $appState, $url, $storeManager, $storeConfig, + $urlSecurityInfo, $routerId ); $this->_urlRewriteService = $urlRewriteService; $this->_objectManager = $objectManager; @@ -127,9 +110,6 @@ class Standard extends \Magento\Core\Controller\Varien\Router\Base return null; } - // override VDE configuration - $this->_overrideConfiguration(); - // prepare request to imitate $this->_prepareVdeRequest($request); @@ -145,7 +125,7 @@ class Standard extends \Magento\Core\Controller\Varien\Router\Base $controller = $router->match($request); if ($controller) { $this->_objectManager->get('Magento\DesignEditor\Model\State') - ->update($this->_areaCode, $request, $controller); + ->update(\Magento\Core\Model\App\Area::AREA_FRONTEND, $request); break; } } @@ -188,17 +168,4 @@ class Standard extends \Magento\Core\Controller\Varien\Router\Base } return $routers; } - - /** - * Override frontend configuration with VDE area data - */ - protected function _overrideConfiguration() - { - $vdeNode = $this->_objectManager->get('Magento\Core\Model\Config') - ->getNode(\Magento\DesignEditor\Model\Area::AREA_VDE); - if ($vdeNode) { - $this->_objectManager->get('Magento\Core\Model\Config')->getNode(\Magento\Core\Model\App\Area::AREA_FRONTEND) - ->extend($vdeNode, true); - } - } } diff --git a/app/code/Magento/DesignEditor/Model/Config/Control/ImageSizing.php b/app/code/Magento/DesignEditor/Model/Config/Control/ImageSizing.php index e36864889c0cbe266e7f9afe3cd07175adb1c6d1..af23b4e7d12670fd300bbc879b473bf48308854e 100644 --- a/app/code/Magento/DesignEditor/Model/Config/Control/ImageSizing.php +++ b/app/code/Magento/DesignEditor/Model/Config/Control/ImageSizing.php @@ -39,15 +39,15 @@ class ImageSizing extends \Magento\DesignEditor\Model\Config\Control\AbstractCon protected $_controlAttributes = array('title'); /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_moduleReader; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader * @param array $configFiles */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader, array $configFiles) + public function __construct(\Magento\Module\Dir\Reader $moduleReader, array $configFiles) { $this->_moduleReader = $moduleReader; parent::__construct($configFiles); diff --git a/app/code/Magento/DesignEditor/Model/Config/Control/QuickStyles.php b/app/code/Magento/DesignEditor/Model/Config/Control/QuickStyles.php index 8dce76049df543aae984b2df0c4cea4e3a5e703d..d7a4c9d8e76eb5dfa99aac9b76f0deefe8979e0a 100644 --- a/app/code/Magento/DesignEditor/Model/Config/Control/QuickStyles.php +++ b/app/code/Magento/DesignEditor/Model/Config/Control/QuickStyles.php @@ -39,15 +39,15 @@ class QuickStyles extends \Magento\DesignEditor\Model\Config\Control\AbstractCon protected $_controlAttributes = array('title', 'tab', 'column'); /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_moduleReader; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader * @param array $configFiles */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader, array $configFiles) + public function __construct(\Magento\Module\Dir\Reader $moduleReader, array $configFiles) { $this->_moduleReader = $moduleReader; parent::__construct($configFiles); diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Builder.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Builder.php index 77e8ce7b7e356f3fbef1aa0e61ba68a468067fea..d622780ec6c7f436f549c6fd291cacade1e846e2 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Builder.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Builder.php @@ -32,7 +32,7 @@ namespace Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form; class Builder { /** - * @var \Magento\Data\Form\Factory + * @var \Magento\Data\FormFactory */ protected $_formFactory; @@ -59,13 +59,13 @@ class Builder /** * Constructor * - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\DesignEditor\Model\Editor\Tools\Controls\Factory $configFactory * @param \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Renderer\Factory $rendererFactory * @param \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Element\Factory $elementsFactory */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\DesignEditor\Model\Editor\Tools\Controls\Factory $configFactory, \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Renderer\Factory $rendererFactory, \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Element\Factory $elementsFactory diff --git a/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php b/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php index 3b31bcc0464e659d31302e7d6885c55d00d6e7ea..184d8c7dc275e7df8d9d68bd0e26978302ad3038 100644 --- a/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php +++ b/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php @@ -31,6 +31,21 @@ namespace Magento\DesignEditor\Model\Theme\Resource; class Change extends \Magento\Core\Model\Resource\Db\AbstractDb { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\App\Resource $resource + */ + public function __construct(\Magento\Stdlib\DateTime $dateTime, \Magento\App\Resource $resource) + { + $this->dateTime = $dateTime; + parent::__construct($resource); + } + /** * Resource initialization */ @@ -48,7 +63,7 @@ class Change extends \Magento\Core\Model\Resource\Db\AbstractDb protected function _beforeSave(\Magento\Core\Model\AbstractModel $change) { if (!$change->getChangeTime()) { - $change->setChangeTime($this->formatDate(true)); + $change->setChangeTime($this->dateTime->formatDate(true)); } return $this; } diff --git a/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php b/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php index a318c32563bc30e654865c7d41acbd9af85f140e..dd79bfd35af46b9a6ba6309c7e7f348d37f042b8 100644 --- a/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php +++ b/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php @@ -53,27 +53,27 @@ class NavigationMode extends \Magento\Core\Model\Url protected $_themeId; /** - * @param \Magento\App\RouterListInterface $routerList + * @param \Magento\App\Route\ConfigInterface $routeConfig * @param \Magento\App\RequestInterface $request * @param \Magento\Core\Model\Url\SecurityInfoInterface $securityInfo * @param \Magento\DesignEditor\Helper\Data $helper * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\App $app * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Session $session + * @param string $areaCode * @param array $data */ public function __construct( - \Magento\App\RouterListInterface $routerList, + \Magento\App\Route\ConfigInterface $routeConfig, \Magento\App\RequestInterface $request, \Magento\Core\Model\Url\SecurityInfoInterface $securityInfo, \Magento\DesignEditor\Helper\Data $helper, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\App $app, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Session $session, + $areaCode, array $data = array() ) { $this->_helper = $helper; @@ -85,7 +85,7 @@ class NavigationMode extends \Magento\Core\Model\Url $this->_themeId = $data['themeId']; } parent::__construct( - $routerList, $request, $securityInfo, $coreStoreConfig, $coreData, $app, $storeManager, $session, $data + $routeConfig, $request, $securityInfo, $coreStoreConfig, $app, $storeManager, $session, $areaCode, $data ); } diff --git a/app/code/Magento/DesignEditor/etc/di.xml b/app/code/Magento/DesignEditor/etc/di.xml index 6ee998169cc194b22b641a3e1a8539af33f7c654..a9748f13bb728f163571a3167c7f85264ca1849d 100644 --- a/app/code/Magento/DesignEditor/etc/di.xml +++ b/app/code/Magento/DesignEditor/etc/di.xml @@ -24,24 +24,7 @@ */ --> <config> - <type name="Magento\App\RouterList"> - <param name="routerList"> - <value> - <vde> - <instance>Magento\DesignEditor\Controller\Varien\Router\Standard</instance> - <disable type="bool">false</disable> - <sortOrder>40</sortOrder> - </vde> - </value> - </param> - </type> <type name="Magento\DesignEditor\Controller\Varien\Router\Standard"> - <param name="areaCode"> - <value>frontend</value> - </param> - <param name="baseController"> - <value>Magento\Core\Controller\Varien\Action</value> - </param> <param name="routerId"> <value>vde</value> </param> diff --git a/app/code/Magento/Rss/etc/frontend/di.xml b/app/code/Magento/DesignEditor/etc/frontend/di.xml similarity index 76% rename from app/code/Magento/Rss/etc/frontend/di.xml rename to app/code/Magento/DesignEditor/etc/frontend/di.xml index e9c6712ed23dc5dd135766c9b0709dcbfd8d06da..c2ccf31fbaf2640514368500d5c7f5e8c9d8ac3a 100644 --- a/app/code/Magento/Rss/etc/frontend/di.xml +++ b/app/code/Magento/DesignEditor/etc/frontend/di.xml @@ -24,12 +24,14 @@ */ --> <config> - <type name="Magento\Core\Model\Url\SecurityInfo"> - <param name="secureUrlList"> + <type name="Magento\App\RouterList"> + <param name="routerList"> <value> - <rss_catalog_review>/rss/catalog/review</rss_catalog_review> - <rss_order_new>/rss/order/new</rss_order_new> - <rss_catalog_notifystock>/rss/catalog/notifystock</rss_catalog_notifystock> + <vde> + <instance>Magento\DesignEditor\Controller\Varien\Router\Standard</instance> + <disable type="bool">false</disable> + <sortOrder>40</sortOrder> + </vde> </value> </param> </type> diff --git a/app/code/Magento/DesignEditor/view/adminhtml/editor/tools/code/custom.phtml b/app/code/Magento/DesignEditor/view/adminhtml/editor/tools/code/custom.phtml index 3aa0bfeb60000e000dcd7402de280688baa4a511..a860dd95df13e6802ce9f5f8c87331c0515c6988 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/editor/tools/code/custom.phtml +++ b/app/code/Magento/DesignEditor/view/adminhtml/editor/tools/code/custom.phtml @@ -75,7 +75,7 @@ '<?php echo $this->getMediaBrowserUrl('custom_code', \Magento\Theme\Model\Wysiwyg\Storage::TYPE_FONT) ?>', null, null, - '<?php echo $this->quoteEscape(__('Font Assets'), true); ?>' + '<?php echo $this->escapeQuote(__('Font Assets'), true); ?>' ); }); $('[data-manage="images"]').on('click', function() { @@ -83,7 +83,7 @@ '<?php echo $this->getMediaBrowserUrl('custom_code', \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE) ?>', null, null, - '<?php echo $this->quoteEscape(__('Image Assets'), true); ?>' + '<?php echo $this->escapeQuote(__('Image Assets'), true); ?>' ); }); $('#vde-tab-custom').customCssPanel({ diff --git a/app/code/Magento/DesignEditor/view/adminhtml/editor/tools/files/tree.phtml b/app/code/Magento/DesignEditor/view/adminhtml/editor/tools/files/tree.phtml index d087de6d5ac91aad5cedfbbae258b9022b1f2389..165737bf2c51f2098b5fa020526529d7c3a018f4 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/editor/tools/files/tree.phtml +++ b/app/code/Magento/DesignEditor/view/adminhtml/editor/tools/files/tree.phtml @@ -28,7 +28,7 @@ /** * Directories tree template * - * @see \Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Tree + * @see \Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Tree */ ?> diff --git a/app/code/Magento/DesignEditor/view/adminhtml/theme/customized.phtml b/app/code/Magento/DesignEditor/view/adminhtml/theme/customized.phtml index 88f384deff3c58d6406166178384b03e4369311e..68b47ce8753b052432feb4ce6e4c9054ef445298 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/theme/customized.phtml +++ b/app/code/Magento/DesignEditor/view/adminhtml/theme/customized.phtml @@ -27,7 +27,7 @@ <?php /** @var $this \Magento\DesignEditor\Block\Adminhtml\Theme */?> <?php - $themeTitle = $this->quoteEscape($this->getTheme()->getThemeTitle()); + $themeTitle = $this->escapeQuote($this->getTheme()->getThemeTitle()); ?> <li class="theme" id="theme-id-<?php echo $this->getTheme()->getId() ?>" data-widget-options="<?php echo $this->escapeHtml($this->getOptionsJson()); ?>"> diff --git a/app/code/Magento/DesignEditor/view/frontend/translate_inline.phtml b/app/code/Magento/DesignEditor/view/frontend/translate_inline.phtml index 93e3afb6b598a1b6acbd1b197f99beb425c4d962..badd77b3fc0c3bbefe337e24463dd70bb68f9323 100644 --- a/app/code/Magento/DesignEditor/view/frontend/translate_inline.phtml +++ b/app/code/Magento/DesignEditor/view/frontend/translate_inline.phtml @@ -49,7 +49,7 @@ </script> <div id="translate-dialog" data-role="translate-dialog" - data-mage-init="{loader: {icon: '<?php echo $this->getViewFileUrl('images/ajax-loader-tr.gif', array('area' => 'adminhtml')) ?>'}}"> + data-mage-init="{loader: {icon: '<?php echo $this->getViewFileUrl('images/ajax-loader-tr.gif', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE)) ?>'}}"> </div> <script type="text/javascript"> diff --git a/app/code/Magento/Directory/Model/Resource/Country/Collection.php b/app/code/Magento/Directory/Model/Resource/Country/Collection.php index ccb1254e92135eafd2f1bfa25161f779e7d1eafa..39ee33d70890d642738448015dcdd4c08687e24c 100644 --- a/app/code/Magento/Directory/Model/Resource/Country/Collection.php +++ b/app/code/Magento/Directory/Model/Resource/Country/Collection.php @@ -31,13 +31,6 @@ namespace Magento\Directory\Model\Resource\Country; class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection { - /** - * String helper - * - * @var \Magento\Core\Helper\String - */ - protected $_stringHelper; - /** * Locale model * @@ -58,32 +51,39 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl protected $_countryFactory; /** - * @param \Magento\Core\Model\Logger $logger + * Array utils object + * + * @var \Magento\Stdlib\ArrayUtils + */ + protected $_arrayUtils; + + /** + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\String $stringHelper * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Directory\Model\Resource\CountryFactory $countryFactory + * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\String $stringHelper, \Magento\Core\Model\LocaleInterface $locale, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Directory\Model\Resource\CountryFactory $countryFactory, + \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $resource); $this->_coreStoreConfig = $coreStoreConfig; - $this->_stringHelper = $stringHelper; $this->_locale = $locale; $this->_countryFactory = $countryFactory; + $this->_arrayUtils = $arrayUtils; } /** * Foreground countries @@ -205,7 +205,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl $sort[$name] = $data['value']; } } - $this->_stringHelper->ksortMultibyte($sort); + $this->_arrayUtils->ksortMultibyte($sort, $this->_locale->getLocaleCode()); foreach (array_reverse($this->_foregroundCountries) as $foregroundCountry) { $name = array_search($foregroundCountry, $sort); unset($sort[$name]); diff --git a/app/code/Magento/Directory/Model/Resource/Region.php b/app/code/Magento/Directory/Model/Resource/Region.php index f59603b2f59153f68b04c20075bc0aa542c1c907..1fe108acd66d0a4f9f160517666ec55b47e82995 100644 --- a/app/code/Magento/Directory/Model/Resource/Region.php +++ b/app/code/Magento/Directory/Model/Resource/Region.php @@ -44,11 +44,11 @@ class Region extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_locale; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\LocaleInterface $locale */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\LocaleInterface $locale ) { parent::__construct($resource); diff --git a/app/code/Magento/Directory/Model/Resource/Region/Collection.php b/app/code/Magento/Directory/Model/Resource/Region/Collection.php index a5551a69e8b66e4187ddf381e2361c5f7167fc31..ce4b6dd1736e309ffe11786bdfb991bf31375972 100644 --- a/app/code/Magento/Directory/Model/Resource/Region/Collection.php +++ b/app/code/Magento/Directory/Model/Resource/Region/Collection.php @@ -52,7 +52,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\LocaleInterface $locale @@ -60,7 +60,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\LocaleInterface $locale, diff --git a/app/code/Magento/Directory/etc/di.xml b/app/code/Magento/Directory/etc/di.xml index c22053d60be6c7159a60ae2d296cf33f298dae89..a0adf00d5f4039f63a857480103ccca07fbad15a 100644 --- a/app/code/Magento/Directory/etc/di.xml +++ b/app/code/Magento/Directory/etc/di.xml @@ -35,7 +35,7 @@ </value> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <directory_setup>Magento\Directory\Model\Resource\Setup</directory_setup> diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php b/app/code/Magento/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php index fad3f209c3ce7f6c1de12928e2ba52c7fc4d86bc..89d68ca440aac9e0c38df72c8ce25fd470e35644 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Downloadable\Block\Adminhtml\Sales\Items\Column\Downloadable; /** * Sales Order downloadable items name column renderer - * - * @category Magento - * @package Magento_Downloadable - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Downloadable\Block\Adminhtml\Sales\Items\Column\Downloadable; - class Name extends \Magento\Sales\Block\Adminhtml\Items\Column\Name { protected $_purchased = null; @@ -49,26 +44,27 @@ class Name extends \Magento\Sales\Block\Adminhtml\Items\Column\Name protected $_itemsFactory; /** - * @param \Magento\Core\Helper\String $coreString * @param \Magento\Catalog\Model\Product\OptionFactory $optionFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Filter\FilterManager $filter * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory * @param array $data + * @internal param \Magento\Core\Helper\String $coreString */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Catalog\Model\Product\OptionFactory $optionFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, + \Magento\Filter\FilterManager $filter, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, array $data = array() ) { $this->_purchasedFactory = $purchasedFactory; $this->_itemsFactory = $itemsFactory; - parent::__construct($coreString, $optionFactory, $coreData, $context, $data); + parent::__construct($optionFactory, $coreData, $context, $filter, $data); } public function getLinks() diff --git a/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php b/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php index 1485d19301910b350575d74028177ffdb7256071..4042c7e90cde7024a170f419f4c717cce244398d 100644 --- a/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php +++ b/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Downloadable\Block\Sales\Order\Item\Renderer; + /** * Downloadable order item render block - * - * @category Magento - * @package Magento_Downloadable - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Downloadable\Block\Sales\Order\Item\Renderer; - class Downloadable extends \Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer { /** @@ -51,33 +47,30 @@ class Downloadable extends \Magento\Sales\Block\Order\Item\Renderer\DefaultRende protected $_itemsFactory; /** - * @param \Magento\Core\Helper\String $coreString * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Block\Template\Context $context + * @param \Magento\Stdlib\String $string * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory + * @param \Magento\Filter\FilterManager $filter * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Core\Helper\Data $coreData, \Magento\Core\Block\Template\Context $context, + \Magento\Stdlib\String $string, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, + \Magento\Filter\FilterManager $filter, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, array $data = array() ) { $this->_purchasedFactory = $purchasedFactory; $this->_itemsFactory = $itemsFactory; - parent::__construct($coreString, $coreData, $context, $productOptionFactory, $data); + parent::__construct($coreData, $context, $string, $productOptionFactory, $filter, $data); } - /** - * Enter description here... - * - * @return unknown - */ public function getLinks() { $this->_purchasedLinks = $this->_purchasedFactory->create() @@ -89,6 +82,9 @@ class Downloadable extends \Magento\Sales\Block\Order\Item\Renderer\DefaultRende return $this->_purchasedLinks; } + /** + * @return string + */ public function getLinksTitle() { if ($this->_purchasedLinks->getLinkSectionTitle()) { @@ -96,5 +92,4 @@ class Downloadable extends \Magento\Sales\Block\Order\Item\Renderer\DefaultRende } return $this->_storeConfig->getConfig(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE); } - } diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index a8ab22f10a9dbea8355f7dc9d89f04efc7378f35..2262d1e2aea6b2cc2852f41dea01840cfa947a4b 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -24,20 +24,26 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Downloadable\Helper; + /** * Downloadable Products Download Helper - * - * @category Magento - * @package Magento_Downloadable - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Downloadable\Helper; - class Download extends \Magento\Core\Helper\AbstractHelper { + /** + * Link type url + */ const LINK_TYPE_URL = 'url'; + + /** + * Link type file + */ const LINK_TYPE_FILE = 'file'; + /** + * Config path to content disposition + */ const XML_PATH_CONTENT_DISPOSITION = 'catalog/downloadable/content_disposition'; /** @@ -87,21 +93,21 @@ class Download extends \Magento\Core\Helper\AbstractHelper * * @var \Magento\Core\Helper\File\Storage\Database */ - protected $_coreFileStorageDb = null; + protected $_coreFileStorageDb; /** * Downloadable file * * @var \Magento\Downloadable\Helper\File */ - protected $_downloadableFile = null; + protected $_downloadableFile; /** * Core data * * @var \Magento\Core\Helper\Data */ - protected $_coreData = null; + protected $_coreData; /** * Core store config @@ -120,6 +126,11 @@ class Download extends \Magento\Core\Helper\AbstractHelper */ protected $_dirModel; + /** + * @var \Magento\Filesystem + */ + protected $_filesystem; + /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Downloadable\Helper\File $downloadableFile @@ -128,6 +139,7 @@ class Download extends \Magento\Core\Helper\AbstractHelper * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\App $app * @param \Magento\App\Dir $dirModel + * @param \Magento\Filesystem $filesystem */ public function __construct( \Magento\Core\Helper\Data $coreData, @@ -136,7 +148,8 @@ class Download extends \Magento\Core\Helper\AbstractHelper \Magento\Core\Helper\Context $context, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\App $app, - \Magento\App\Dir $dirModel + \Magento\App\Dir $dirModel, + \Magento\Filesystem $filesystem ) { $this->_coreData = $coreData; $this->_downloadableFile = $downloadableFile; @@ -144,6 +157,7 @@ class Download extends \Magento\Core\Helper\AbstractHelper $this->_coreStoreConfig = $coreStoreConfig; $this->_app = $app; $this->_dirModel = $dirModel; + $this->_filesystem = $filesystem; parent::__construct($context); } @@ -151,6 +165,7 @@ class Download extends \Magento\Core\Helper\AbstractHelper * Retrieve Resource file handle (socket, file pointer etc) * * @return resource + * @throws \Magento\Core\Exception|\Exception */ protected function _getHandle() { @@ -189,16 +204,14 @@ class Download extends \Magento\Core\Helper\AbstractHelper try { $this->_handle = fsockopen($hostname, $port, $errno, $errstr); - } - catch (\Exception $e) { + } catch (\Exception $e) { throw $e; } if ($this->_handle === false) { throw new \Magento\Core\Exception( - __('Something went wrong connecting to the host. Error: %1.', $errstr) + __('Something went wrong connecting to the host. Error#%1 - %2.', $errno, $errstr) ); - } $headers = 'GET ' . $path . $query . ' HTTP/1.0' . "\r\n" @@ -218,12 +231,10 @@ class Download extends \Magento\Core\Helper\AbstractHelper $k = strtolower($match[1]); if ($k == 'set-cookie') { continue; - } - else { + } else { $this->_urlHeaders[$k] = trim($match[2]); } - } - elseif (preg_match('#^HTTP/[0-9\.]+ (\d+) (.*)\s$#', $str, $match)) { + } elseif (preg_match('#^HTTP/[0-9\.]+ (\d+) (.*)\s$#', $str, $match)) { $this->_urlHeaders['code'] = $match[1]; $this->_urlHeaders['code-string'] = trim($match[2]); } @@ -231,10 +242,8 @@ class Download extends \Magento\Core\Helper\AbstractHelper if (!isset($this->_urlHeaders['code']) || $this->_urlHeaders['code'] != 200) { throw new \Magento\Core\Exception(__('Something went wrong while getting the requested content.')); - } - } - elseif ($this->_linkType == self::LINK_TYPE_FILE) { + } elseif ($this->_linkType == self::LINK_TYPE_FILE) { $this->_handle = new \Magento\Io\File(); if (!is_file($this->_resourceFile)) { $this->_coreFileStorageDb->saveFileToFilesystem($this->_resourceFile); @@ -244,8 +253,7 @@ class Download extends \Magento\Core\Helper\AbstractHelper throw new \Magento\Core\Exception(__("We can't find this file.")); } $this->_handle->streamOpen($this->_resourceFile, 'r'); - } - else { + } else { throw new \Magento\Core\Exception(__('Invalid download link type.')); } } @@ -260,8 +268,7 @@ class Download extends \Magento\Core\Helper\AbstractHelper $handle = $this->_getHandle(); if ($this->_linkType == self::LINK_TYPE_FILE) { return $handle->streamStat('size'); - } - elseif ($this->_linkType == self::LINK_TYPE_URL) { + } elseif ($this->_linkType == self::LINK_TYPE_URL) { if (isset($this->_urlHeaders['content-length'])) { return $this->_urlHeaders['content-length']; } @@ -269,17 +276,19 @@ class Download extends \Magento\Core\Helper\AbstractHelper return null; } + /** + * @return string + */ public function getContentType() { - $handle = $this->_getHandle(); + $this->_getHandle(); if ($this->_linkType == self::LINK_TYPE_FILE) { if (function_exists('mime_content_type') && ($contentType = mime_content_type($this->_resourceFile))) { return $contentType; } else { return $this->_downloadableFile->getFileType($this->_resourceFile); } - } - elseif ($this->_linkType == self::LINK_TYPE_URL) { + } elseif ($this->_linkType == self::LINK_TYPE_URL) { if (isset($this->_urlHeaders['content-type'])) { $contentType = explode('; ', $this->_urlHeaders['content-type']); return $contentType[0]; @@ -288,20 +297,23 @@ class Download extends \Magento\Core\Helper\AbstractHelper return $this->_contentType; } + /** + * @return string + */ public function getFilename() { - $handle = $this->_getHandle(); + $this->_getHandle(); if ($this->_linkType == self::LINK_TYPE_FILE) { return pathinfo($this->_resourceFile, PATHINFO_BASENAME); - } - elseif ($this->_linkType == self::LINK_TYPE_URL) { + } elseif ($this->_linkType == self::LINK_TYPE_URL) { if (isset($this->_urlHeaders['content-disposition'])) { $contentDisposition = explode('; ', $this->_urlHeaders['content-disposition']); if (!empty($contentDisposition[1]) && strpos($contentDisposition[1], 'filename=') !== false) { return substr($contentDisposition[1], 9); } } - if ($fileName = @pathinfo($this->_resourceFile, PATHINFO_BASENAME)) { + $fileName = @pathinfo($this->_resourceFile, PATHINFO_BASENAME); + if ($fileName) { return $fileName; } } @@ -319,9 +331,7 @@ class Download extends \Magento\Core\Helper\AbstractHelper { if (self::LINK_TYPE_FILE == $linkType) { //check LFI protection - /** @var $helper \Magento\Core\Helper\Data */ - $helper = $this->_coreData; - $helper->checkLfiProtection($resourceFile); + $this->_filesystem->checkLfiProtection($resourceFile); } $this->_resourceFile = $resourceFile; @@ -354,11 +364,10 @@ class Download extends \Magento\Core\Helper\AbstractHelper { $handle = $this->_getHandle(); if ($this->_linkType == self::LINK_TYPE_FILE) { - while ($buffer = $handle->streamRead()) { + while (true == ($buffer = $handle->streamRead())) { print $buffer; } - } - elseif ($this->_linkType == self::LINK_TYPE_URL) { + } elseif ($this->_linkType == self::LINK_TYPE_URL) { while (!feof($handle)) { print fgets($handle, 1024); } diff --git a/app/code/Magento/Downloadable/Helper/File.php b/app/code/Magento/Downloadable/Helper/File.php index c2391d12c502afcd52e5bcefbd2d3c4bcaee0980..6fb282a610d8380f1f7f79d4f07b2a6c7c589b82 100644 --- a/app/code/Magento/Downloadable/Helper/File.php +++ b/app/code/Magento/Downloadable/Helper/File.php @@ -45,19 +45,17 @@ class File extends \Magento\Core\Helper\AbstractHelper /** * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase * @param \Magento\Core\Helper\Context $context - * @param \Magento\Core\Model\Config $config + * @param array $mimeTypes */ public function __construct( \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, \Magento\Core\Helper\Context $context, - \Magento\Core\Model\Config $config + array $mimeTypes = array() ) { $this->_coreFileStorageDatabase = $coreFileStorageDatabase; parent::__construct($context); - $nodes = $config->getNode('global/mime/types'); - if ($nodes) { - $nodes = (array)$nodes; - foreach ($nodes as $key => $value) { + if (!empty($mimeTypes)) { + foreach ($mimeTypes as $key => $value) { self::$_mimeTypes[$key] = $value; } } @@ -65,11 +63,11 @@ class File extends \Magento\Core\Helper\AbstractHelper /** * Checking file for moving and move it - * - * @param string $baseTmpPath + * @param string $baseTmpPath * @param string $basePath - * @param array $file + * @param string $file * @return string + * @throws \Magento\Core\Exception */ public function moveFileFromTmp($baseTmpPath, $basePath, $file) { diff --git a/app/code/Magento/Downloadable/Model/Product/Type.php b/app/code/Magento/Downloadable/Model/Product/Type.php index b2c8757af3a936e559f8301aeab9536d8a34c47e..149fa860773e24b607a7d220de86c9550bbe3225 100644 --- a/app/code/Magento/Downloadable/Model/Product/Type.php +++ b/app/code/Magento/Downloadable/Model/Product/Type.php @@ -55,7 +55,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual protected $_linkResource; /** - * @var \Magento\Downloadable\Model\Resource\Link\Collection\Factory + * @var \Magento\Downloadable\Model\Resource\Link\CollectionFactory */ protected $_linksFactory; @@ -87,10 +87,10 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Downloadable\Model\Resource\SampleFactory $sampleResFactory * @param \Magento\Downloadable\Model\Resource\Link $linkResource - * @param \Magento\Downloadable\Model\Resource\Link\Collection\Factory $linksFactory + * @param \Magento\Downloadable\Model\Resource\Link\CollectionFactory $linksFactory * @param \Magento\Downloadable\Model\Resource\Sample\CollectionFactory $samplesFactory * @param \Magento\Downloadable\Model\SampleFactory $sampleFactory * @param \Magento\Downloadable\Model\LinkFactory $linkFactory @@ -107,10 +107,10 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual \Magento\Core\Helper\File\Storage\Database $fileStorageDb, \Magento\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Downloadable\Model\Resource\SampleFactory $sampleResFactory, \Magento\Downloadable\Model\Resource\Link $linkResource, - \Magento\Downloadable\Model\Resource\Link\Collection\Factory $linksFactory, + \Magento\Downloadable\Model\Resource\Link\CollectionFactory $linksFactory, \Magento\Downloadable\Model\Resource\Sample\CollectionFactory $samplesFactory, \Magento\Downloadable\Model\SampleFactory $sampleFactory, \Magento\Downloadable\Model\LinkFactory $linkFactory, diff --git a/app/code/Magento/Downloadable/Model/Resource/Link.php b/app/code/Magento/Downloadable/Model/Resource/Link.php index 897ab0deca4b2a9fb646a6ab4e9a5cf97df98d5b..2f57c1213e9e64a3f71f590060e4cfe4fdd5d5c6 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link.php @@ -60,14 +60,14 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb /** * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\App $app * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\App $app, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Core\Model\StoreManagerInterface $storeManager diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php index a1e3651a4761134071fe6a524a34d20681e020e8..7bb18f64e44196f4f2c11449edbf65ce3eead14c 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -33,12 +33,12 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\AbstractItems { /** - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_stringHelper; + protected $string; /** - * @param \Magento\Core\Helper\String $helper + * @param \Magento\Stdlib\String $string * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -51,7 +51,7 @@ class Creditmemo * @param array $data */ public function __construct( - \Magento\Core\Helper\String $helper, + \Magento\Stdlib\String $string, \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, @@ -63,7 +63,7 @@ class Creditmemo \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_stringHelper = $helper; + $this->string = $string; parent::__construct( $taxData, $context, @@ -92,13 +92,13 @@ class Creditmemo // draw Product name $lines[0] = array(array( - 'text' => $this->_stringHelper->strSplit($item->getName(), 35, true, true), + 'text' => $this->string->split($item->getName(), 35, true, true), 'feed' => 35, )); // draw SKU $lines[0][] = array( - 'text' => $this->_stringHelper->strSplit($this->getSku($item), 17), + 'text' => $this->string->split($this->getSku($item), 17), 'feed' => 255, 'align' => 'right' ); @@ -151,7 +151,7 @@ class Creditmemo foreach ($options as $option) { // draw options label $lines[][] = array( - 'text' => $this->_stringHelper->strSplit(strip_tags($option['label']), 40, true, true), + 'text' => $this->string->split(strip_tags($option['label']), 40, true, true), 'font' => 'italic', 'feed' => 35 ); @@ -159,7 +159,7 @@ class Creditmemo // draw options value $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']); $lines[][] = array( - 'text' => $this->_stringHelper->strSplit($_printValue, 30, true, true), + 'text' => $this->string->split($_printValue, 30, true, true), 'feed' => 40 ); } @@ -170,7 +170,7 @@ class Creditmemo // draw Links title $lines[][] = array( - 'text' => $this->_stringHelper->strSplit($this->getLinksTitle(), 70, true, true), + 'text' => $this->string->split($this->getLinksTitle(), 70, true, true), 'font' => 'italic', 'feed' => 35 ); @@ -178,7 +178,7 @@ class Creditmemo // draw Links foreach ($_purchasedItems as $_link) { $lines[][] = array( - 'text' => $this->_stringHelper->strSplit($_link->getLinkTitle(), 50, true, true), + 'text' => $this->string->split($_link->getLinkTitle(), 50, true, true), 'feed' => 40 ); } diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php index 16c5f1f2f9747722b9dcf10bc01d5d8958d611e9..7263a9511a695cc17445f50d43a36fd4518979a3 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php @@ -38,14 +38,12 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\AbstractItems { /** - * Core string - * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -58,7 +56,7 @@ class Invoice * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, @@ -70,7 +68,7 @@ class Invoice \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreString = $coreString; + $this->string = $string; parent::__construct( $taxData, $context, @@ -98,15 +96,14 @@ class Invoice $lines = array(); // draw Product name - $stringHelper = $this->_coreString; $lines[0] = array(array( - 'text' => $stringHelper->strSplit($item->getName(), 35, true, true), + 'text' => $this->string->split($item->getName(), 35, true, true), 'feed' => 35, )); // draw SKU $lines[0][] = array( - 'text' => $stringHelper->strSplit($this->getSku($item), 17), + 'text' => $this->string->split($this->getSku($item), 17), 'feed' => 290, 'align' => 'right' ); @@ -170,7 +167,7 @@ class Invoice foreach ($options as $option) { // draw options label $lines[][] = array( - 'text' => $stringHelper->strSplit(strip_tags($option['label']), 40, true, true), + 'text' => $this->string->split(strip_tags($option['label']), 40, true, true), 'font' => 'italic', 'feed' => 35 ); @@ -184,7 +181,7 @@ class Invoice $values = explode(', ', $_printValue); foreach ($values as $value) { $lines[][] = array( - 'text' => $stringHelper->strSplit($value, 30, true, true), + 'text' => $this->string->split($value, 30, true, true), 'feed' => 40 ); } @@ -197,7 +194,7 @@ class Invoice // draw Links title $lines[][] = array( - 'text' => $stringHelper->strSplit($this->getLinksTitle(), 70, true, true), + 'text' => $this->string->split($this->getLinksTitle(), 70, true, true), 'font' => 'italic', 'feed' => 35 ); @@ -205,7 +202,7 @@ class Invoice // draw Links foreach ($_purchasedItems as $_link) { $lines[][] = array( - 'text' => $stringHelper->strSplit($_link->getLinkTitle(), 50, true, true), + 'text' => $this->string->split($_link->getLinkTitle(), 50, true, true), 'feed' => 40 ); } diff --git a/app/code/Magento/Downloadable/etc/di.xml b/app/code/Magento/Downloadable/etc/di.xml index 57276d1bee8d0c0289a4b0eb38865fc84b9ad017..b441b22d71d66dce64a17067792de02098aaa51c 100644 --- a/app/code/Magento/Downloadable/etc/di.xml +++ b/app/code/Magento/Downloadable/etc/di.xml @@ -26,12 +26,7 @@ <config> <type name="Magento\Downloadable\Helper\Download"> <param name="coreFileStorageDb"> - <instance type="Magento\Core\Helper\File\Storage\DatabaseProxy" /> - </param> - </type> - <type name="Magento\Downloadable\Model\Sales\Order\Pdf\Items\Creditmemo"> - <param name="helper"> - <instance type="Magento\Core\Helper\StringProxy" /> + <instance type="Magento\Core\Helper\File\Storage\Database\Proxy" /> </param> </type> <type name="Magento\Catalog\Helper\Product"> @@ -39,7 +34,7 @@ <value>Virtual / Downloadable</value> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <downloadable_setup>Magento\Catalog\Model\Resource\Setup</downloadable_setup> diff --git a/app/code/Magento/Downloadable/etc/product_types.xml b/app/code/Magento/Downloadable/etc/product_types.xml index f79fa967b7218b306d986fce1966142f28d68d9a..cafbb6d8a6b2ee3b71fce540d94dd99523133a49 100644 --- a/app/code/Magento/Downloadable/etc/product_types.xml +++ b/app/code/Magento/Downloadable/etc/product_types.xml @@ -24,7 +24,7 @@ */ --> <config> - <type name="downloadable" label="Downloadable Product" modelInstance="Magento\Downloadable\Model\Product\Type" composite='false' isQty="true" canUseQtyDecimals="true"> + <type name="downloadable" label="Downloadable Product" modelInstance="Magento\Downloadable\Model\Product\Type" composite="false" isQty="true" canUseQtyDecimals="false"> <priceModel instance="Magento\Downloadable\Model\Product\Price" /> <indexerModel instance="Magento\Downloadable\Model\Resource\Indexer\Price" /> </type> diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/adminhtml_customer_wishlist.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/customer_index_wishlist.xml similarity index 100% rename from app/code/Magento/Downloadable/view/adminhtml/layout/adminhtml_customer_wishlist.xml rename to app/code/Magento/Downloadable/view/adminhtml/layout/customer_index_wishlist.xml diff --git a/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/creditmemo/name.phtml b/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/creditmemo/name.phtml index 272cb41478db7e3aeaeb4260c93056d266b06580..066a6c7e3b94f950f7cddd4df93983d9dd364a1a 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/creditmemo/name.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/creditmemo/name.phtml @@ -36,7 +36,7 @@ <?php if (isset($_option['custom_view']) && $_option['custom_view']): ?> <?php echo $_option['value'];?> <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\String')->truncate($_option['value'], 55, '', $_remainder);?> + <?php echo $this->truncateString($_option['value'], 55, '', $_remainder);?> <?php if ($_remainder):?> ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span> <script type="text/javascript"> diff --git a/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/invoice/name.phtml b/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/invoice/name.phtml index 889e369fa2c5e13fce43ac43b05770ecb703a5e7..54b43bd0bafc942439dce961f28821b650b31b3d 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/invoice/name.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/invoice/name.phtml @@ -36,7 +36,7 @@ <?php if (isset($_option['custom_view']) && $_option['custom_view']): ?> <?php echo $_option['value'];?> <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\String')->truncate($_option['value'], 55, '', $_remainder);?> + <?php echo $this->truncateString($_option['value'], 55, '', $_remainder);?> <?php if ($_remainder):?> ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span> <script type="text/javascript"> diff --git a/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/name.phtml b/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/name.phtml index 2026f6f719eadb36a3698828b5de8c2099f9d2d2..b8a5fa9adee7f80c423160f8cdb463a529afaf3c 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/name.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/sales/items/column/downloadable/name.phtml @@ -36,7 +36,7 @@ <?php if (isset($_option['custom_view']) && $_option['custom_view']): ?> <?php echo $_option['value'];?> <?php else: ?> - <?php echo $this->helper('Magento\Core\Helper\String')->truncate($_option['value'], 55, '', $_remainder);?> + <?php echo $this->truncateString($_option['value'], 55, '', $_remainder);?> <?php if ($_remainder):?> ... <span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_remainder ?></span> <script type="text/javascript"> diff --git a/app/code/Magento/Downloadable/view/frontend/sales/order/creditmemo/items/renderer/downloadable.phtml b/app/code/Magento/Downloadable/view/frontend/sales/order/creditmemo/items/renderer/downloadable.phtml index 42161ff429438b17326bb559ca3ed174124c31eb..738e4d15f4981a32e9b4945905078c081ecff8af 100644 --- a/app/code/Magento/Downloadable/view/frontend/sales/order/creditmemo/items/renderer/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/frontend/sales/order/creditmemo/items/renderer/downloadable.phtml @@ -23,6 +23,8 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\Downloadable\Block\Sales\Order\Item\Renderer\Downloadable */ ?> <?php $_item = $this->getItem() ?> <?php $_order = $this->getItem()->getOrderItem()->getOrder() ?> @@ -67,7 +69,7 @@ <br/><a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" aria-controls="order-item-gift-message-<?php echo $_item->getId()?>" data-item-id="<?php echo $_item->getId() ?>"><?php echo __('Gift Message') ?></a> <?php endif; ?> </td> - <td><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="a-right nowrap"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/code/Magento/Downloadable/view/frontend/sales/order/invoice/items/renderer/downloadable.phtml b/app/code/Magento/Downloadable/view/frontend/sales/order/invoice/items/renderer/downloadable.phtml index 020bb838350695cca58ae9c4915a9353e5670a41..9da5814e059c1c87e305240d9abd9a7c58c21157 100644 --- a/app/code/Magento/Downloadable/view/frontend/sales/order/invoice/items/renderer/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/frontend/sales/order/invoice/items/renderer/downloadable.phtml @@ -23,6 +23,8 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\Downloadable\Block\Sales\Order\Item\Renderer\Downloadable */ ?> <?php $_item = $this->getItem() ?> <?php $_order = $this->getItem()->getOrderItem()->getOrder() ?> @@ -68,7 +70,7 @@ <br/><a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" aria-controls="order-item-gift-message-<?php echo $_item->getId()?>" data-item-id="<?php echo $_item->getId() ?>"><?php echo __('Gift Message') ?></a> <?php endif; ?> </td> - <td><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="a-right nowrap"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/code/Magento/Downloadable/view/frontend/sales/order/items/renderer/downloadable.phtml b/app/code/Magento/Downloadable/view/frontend/sales/order/items/renderer/downloadable.phtml index ce466a53d523d2d55ccf8c118661fc1b88fb3134..81aa14f43a9a2b32858aac9a6732d99384e56274 100644 --- a/app/code/Magento/Downloadable/view/frontend/sales/order/items/renderer/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/frontend/sales/order/items/renderer/downloadable.phtml @@ -23,6 +23,8 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\Downloadable\Block\Sales\Order\Item\Renderer\Downloadable */ ?> <?php $_item = $this->getItem() ?> <tr class="border" id="order-item-row-<?php echo $_item->getId() ?>"> @@ -67,7 +69,7 @@ <br/><a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" aria-controls="order-item-gift-message-<?php echo $_item->getId()?>" data-item-id="<?php echo $_item->getId() ?>"><?php echo __('Gift Message') ?></a> <?php endif; ?> </td> - <td><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="a-right nowrap"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displayCartPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php index 290f285e0d57f8b9a46d86cfeb7f747d789a169b..28404ad8839af5d1428d0f4aeafc89736fadd493 100644 --- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php +++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php @@ -68,7 +68,7 @@ abstract class AbstractMain /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Eav\Helper\Data $eavData @@ -80,7 +80,7 @@ abstract class AbstractMain */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Eav\Helper\Data $eavData, diff --git a/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php b/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php index 2fbd942534b0825cc19b44ab0eb1153189b6e969..1b2b23263d9d4e2cea0ac0663d9c82f01eb22c77 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php @@ -92,7 +92,7 @@ abstract class AbstractData protected $_locale; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -100,11 +100,11 @@ abstract class AbstractData * Constructor * * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function __construct( \Magento\Core\Model\LocaleInterface $locale, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { $this->_locale = $locale; $this->_logger = $logger; @@ -465,7 +465,7 @@ abstract class AbstractData } break; case 'date': - $validator = new \Zend_Validate_Date(\Magento\Date::DATE_INTERNAL_FORMAT); + $validator = new \Zend_Validate_Date(\Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT); $validator->setMessage( __('"%1" invalid type entered.', $label), \Zend_Validate_Date::INVALID diff --git a/app/code/Magento/Eav/Model/Attribute/Data/File.php b/app/code/Magento/Eav/Model/Attribute/Data/File.php index c82f612429041248d994222b42600baff72c2cc4..297c13b2692f53270da31a848582cd6f17ed632f 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/File.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/File.php @@ -61,14 +61,14 @@ class File extends \Magento\Eav\Model\Attribute\Data\AbstractData /** * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\File\Validator\NotProtectedExtension $fileValidator * @param \Magento\App\Dir $coreDir */ public function __construct( \Magento\Core\Model\LocaleInterface $locale, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\File\Validator\NotProtectedExtension $fileValidator, \Magento\App\Dir $coreDir diff --git a/app/code/Magento/Eav/Model/Attribute/Data/Text.php b/app/code/Magento/Eav/Model/Attribute/Data/Text.php index 7fa5fce942c8ea5a61e8767e9c2ab47ccb16b2ef..313b1d54a16d47a7f64584fd840c42824095d7f4 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/Text.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/Text.php @@ -39,20 +39,20 @@ class Text extends \Magento\Eav\Model\Attribute\Data\AbstractData /** * @var \Magento\Core\Helper\String */ - protected $_stringHelper; + protected $_string; /** * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Helper\String $stringHelper + * @param \Magento\Logger $logger + * @param \Magento\Stdlib\String $stringHelper */ public function __construct( \Magento\Core\Model\LocaleInterface $locale, - \Magento\Core\Model\Logger $logger, - \Magento\Core\Helper\String $stringHelper + \Magento\Logger $logger, + \Magento\Stdlib\String $stringHelper ) { parent::__construct($locale, $logger); - $this->_stringHelper = $stringHelper; + $this->_string = $stringHelper; } /** @@ -94,7 +94,7 @@ class Text extends \Magento\Eav\Model\Attribute\Data\AbstractData } // validate length - $length = $this->_stringHelper->strlen(trim($value)); + $length = $this->_string->strlen(trim($value)); $validateRules = $attribute->getValidateRules(); if (!empty($validateRules['min_text_length']) && $length < $validateRules['min_text_length']) { diff --git a/app/code/Magento/Eav/Model/AttributeDataFactory.php b/app/code/Magento/Eav/Model/AttributeDataFactory.php index e72be9cfbeafdfec801637feaa6214fc60e47884..04e7572e7f893b967214a0d2b0ee71620aba4650 100644 --- a/app/code/Magento/Eav/Model/AttributeDataFactory.php +++ b/app/code/Magento/Eav/Model/AttributeDataFactory.php @@ -55,12 +55,19 @@ class AttributeDataFactory */ protected $_objectManager; + /** + * @var \Magento\Stdlib\String + */ + protected $string; + /** * @param \Magento\ObjectManager $objectManager + * @param \Magento\Stdlib\String $string */ - public function __construct(\Magento\ObjectManager $objectManager) + public function __construct(\Magento\ObjectManager $objectManager, \Magento\Stdlib\String $string) { $this->_objectManager = $objectManager; + $this->string = $string; } /** @@ -86,7 +93,7 @@ class AttributeDataFactory if (empty($this->_dataModels[$attribute->getFrontendInput()])) { $dataModelClass = sprintf( 'Magento\Eav\Model\Attribute\Data\%s', - uc_words($attribute->getFrontendInput()) + $this->string->upperCaseWords($attribute->getFrontendInput()) ); $dataModel = $this->_objectManager->create($dataModelClass); $this->_dataModels[$attribute->getFrontendInput()] = $dataModel; diff --git a/app/code/Magento/Eav/Model/Entity.php b/app/code/Magento/Eav/Model/Entity.php index 4cf3184d5d2f1946cb525c8175654159f3e15878..49aae351f09adaf512b636497073da8de371ffe6 100644 --- a/app/code/Magento/Eav/Model/Entity.php +++ b/app/code/Magento/Eav/Model/Entity.php @@ -45,23 +45,23 @@ class Entity extends \Magento\Eav\Model\Entity\AbstractEntity const DEFAULT_ENTITY_ID_FIELD = 'entity_id'; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param array $data */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity, \Magento\Core\Model\LocaleInterface $locale, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, $data = array() ) { parent::__construct( diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index ca5f59910977aeecd736dc0fcd0d31b9c44c621e..4602cbe313a7dcde67cb0d3f680d00dafd8d24d6 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -179,7 +179,7 @@ abstract class AbstractEntity extends \Magento\Core\Model\Resource\AbstractResou protected static $_attributeBackendTables = array(); /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; @@ -209,7 +209,7 @@ abstract class AbstractEntity extends \Magento\Core\Model\Resource\AbstractResou protected $_universalFactory; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity * @param \Magento\Core\Model\LocaleInterface $locale @@ -218,7 +218,7 @@ abstract class AbstractEntity extends \Magento\Core\Model\Resource\AbstractResou * @param array $data */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity, \Magento\Core\Model\LocaleInterface $locale, @@ -973,8 +973,8 @@ abstract class AbstractEntity extends \Magento\Core\Model\Resource\AbstractResou } else { $value = $object->getData($attribute->getAttributeCode()); if ($attribute->getBackend()->getType() == 'datetime') { - $date = new \Zend_Date($value, \Magento\Date::DATE_INTERNAL_FORMAT); - $value = $date->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + $date = new \Zend_Date($value, \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT); + $value = $date->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); } $bind = array( 'entity_type_id' => $this->getTypeId(), diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php index 40fe66b5056a2a01e98417a5b323f600db16587b..bae1ed1d6d0f5c12857edb3d8eee810d6f34b75d 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php @@ -80,16 +80,15 @@ abstract class AbstractBackend protected $_defaultValue = null; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ - public function __construct( - \Magento\Core\Model\Logger $logger - ) { + public function __construct(\Magento\Logger $logger) + { $this->_logger = $logger; } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php index 1254de181d98ca590a0f072d0c963fb4095bbda4..306af90b60a5eddfd632d4c06faf5fa2088df7f3 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php @@ -34,11 +34,11 @@ class Datetime extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke protected $_locale; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\LocaleInterface $locale */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\LocaleInterface $locale ) { $this->_locale = $locale; @@ -109,6 +109,6 @@ class Datetime extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke false ); } - return $date->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + return $date->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); } } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php index eb873293fbc3b97897a7fa6b07a031fa3e7bcc0d..8d23498430bdd73729cb4505a5bec30ff319653e 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php @@ -33,11 +33,11 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend protected $_storeManager; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\StoreManager $storeManager */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\StoreManager $storeManager ) { $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php index 463fb061b8b279f6dfb93eef777b1ccf41313c9b..7c9021273daa270c5c583620d893493450459cc1 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php @@ -24,17 +24,30 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Eav\Model\Entity\Attribute\Backend\Time; + /** * Entity/Attribute/Model - attribute backend default - * - * @category Magento - * @package Magento_Eav - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Eav\Model\Entity\Attribute\Backend\Time; - class Created extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Logger $logger + * @param \Magento\Stdlib\DateTime $dateTime + */ + public function __construct( + \Magento\Logger $logger, + \Magento\Stdlib\DateTime $dateTime + ) { + $this->dateTime = $dateTime; + parent::__construct($logger); + } + /** * Set created date * @@ -45,7 +58,7 @@ class Created extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken { $attributeCode = $this->getAttribute()->getAttributeCode(); if ($object->isObjectNew() && is_null($object->getData($attributeCode))) { - $object->setData($attributeCode, \Magento\Date::now()); + $object->setData($attributeCode, $this->dateTime->now()); } return $this; diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php index c508d5ec0247d7655d6798e2ef8426fa298d222f..bd97e596c4531ca875b94fea8038f1895fb1c8bd 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php @@ -24,17 +24,31 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Eav\Model\Entity\Attribute\Backend\Time; + /** * Entity/Attribute/Model - attribute backend default - * - * @category Magento - * @package Magento_Eav - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Eav\Model\Entity\Attribute\Backend\Time; - class Updated extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Logger $logger + * @param \Magento\Stdlib\DateTime $dateTime + */ + public function __construct( + \Magento\Logger $logger, + \Magento\Stdlib\DateTime $dateTime + ) { + $this->dateTime = $dateTime; + parent::__construct($logger); + } + + /** * Set modified date * @@ -43,7 +57,7 @@ class Updated extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken */ public function beforeSave($object) { - $object->setData($this->getAttribute()->getAttributeCode(), \Magento\Date::now()); + $object->setData($this->getAttribute()->getAttributeCode(), $this->dateTime->now()); return $this; } } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Config/SchemaLocator.php b/app/code/Magento/Eav/Model/Entity/Attribute/Config/SchemaLocator.php index 06136cc0d464584841c4dcf69a484eff640c2ef4..c5d9d94caa15a51450a6a90e00f57150fa27861b 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Config/SchemaLocator.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Config/SchemaLocator.php @@ -35,9 +35,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_schema; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Eav') . DIRECTORY_SEPARATOR . 'eav_attributes.xsd'; } diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index dcf4bb40492d176535d387e8a1241de9a5b36017..2c8aef9576e843f2024d7acb5b2c2a19dac9cb06 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -116,7 +116,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db protected $_eavConfig; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; @@ -137,22 +137,22 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory diff --git a/app/code/Magento/Eav/Model/Entity/Setup.php b/app/code/Magento/Eav/Model/Entity/Setup.php index f8ae12566ff5352a0ae653430fdb9d74ea1ee9b6..a9a5b613483b84d6d5257e23282d60ce4d797d7e 100644 --- a/app/code/Magento/Eav/Model/Entity/Setup.php +++ b/app/code/Magento/Eav/Model/Entity/Setup.php @@ -37,7 +37,7 @@ namespace Magento\Eav\Model\Entity; class Setup extends \Magento\Core\Model\Resource\Setup { /** - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; @@ -48,7 +48,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup /** * @param \Magento\Core\Model\Resource\Setup\Context $context - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory * @param string $resourceName * @param string $moduleName @@ -56,7 +56,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup */ public function __construct( \Magento\Core\Model\Resource\Setup\Context $context, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, $resourceName, $moduleName = 'Magento_Eav', diff --git a/app/code/Magento/Eav/Model/Form.php b/app/code/Magento/Eav/Model/Form.php index 2a956d65520ad1658e781f63fd3a1f6a3d32a7ff..5758d078baa35ab08cb493b32b476d30669c2315 100644 --- a/app/code/Magento/Eav/Model/Form.php +++ b/app/code/Magento/Eav/Model/Form.php @@ -135,7 +135,7 @@ abstract class Form protected $_eavConfig; /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_modulesReader; @@ -162,7 +162,7 @@ abstract class Form /** * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Config\Modules\Reader $modulesReader + * @param \Magento\Module\Dir\Reader $modulesReader * @param \Magento\Eav\Model\AttributeDataFactory $attrDataFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\App\RequestInterface $httpRequest @@ -173,7 +173,7 @@ abstract class Form public function __construct( \Magento\Core\Model\StoreManager $storeManager, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Config\Modules\Reader $modulesReader, + \Magento\Module\Dir\Reader $modulesReader, \Magento\Eav\Model\AttributeDataFactory $attrDataFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\App\RequestInterface $httpRequest, diff --git a/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php b/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php index cd9824f73c1ab147106c11e5bc29763e50780646..5cb5da43e9df9b51bf5b191c47ed280498ef528b 100644 --- a/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php @@ -68,7 +68,7 @@ abstract class Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig @@ -77,7 +77,7 @@ abstract class Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php index ff6e8527c6500a7f5fa686a5a4d078d048636b81..4271128a2476dcce32b26299494479d9be1ee2fd 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php @@ -63,13 +63,13 @@ class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\App $app * @param \Magento\Eav\Model\Resource\Entity\Type $eavEntityType * @param array $arguments */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\App $app, \Magento\Eav\Model\Resource\Entity\Type $eavEntityType, array $arguments = array() diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php index 82f846a28e02566165ca7902424f9ae13a37be58..5015f1291c6ff76c9060cca6f488b05b2694049e 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php @@ -43,7 +43,7 @@ class Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Registry $registryManager @@ -51,7 +51,7 @@ class Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Registry $registryManager, diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php index d75e0043fd3dcd5019456fd3a654b635b0417578..452f1fdada3bc785e2838eaff3017eb435ea083e 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php @@ -44,7 +44,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl protected $_optionValueTable; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_coreResource; @@ -55,19 +55,19 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php index e4a5bfac8291959b67619b49dc284e16cc1902d5..5a123d40142a288d588c7539ae9d6907e5dcd6e6 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php @@ -42,11 +42,11 @@ class Set extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_attrGroupFactory; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Resource\Entity\Attribute\GroupFactory $attrGroupFactory */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\Resource\Entity\Attribute\GroupFactory $attrGroupFactory ) { parent::__construct($resource); diff --git a/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php index 60d32a352a52fcfa3d46e1f11609964520ae2732..3f7f54a7ada43d3a8a22513cbb01c7815169f537 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php @@ -76,7 +76,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig @@ -85,7 +85,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, diff --git a/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php index f3ccdab233a7b8089e26d4fff6210690037b36c0..2d9ae3a424be5827143b6991a3090a5b26389791 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php @@ -50,7 +50,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\StoreManager $storeManager @@ -58,7 +58,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManager $storeManager, diff --git a/app/code/Magento/Eav/Model/Resource/Helper.php b/app/code/Magento/Eav/Model/Resource/Helper.php index 43e4db227ed7a25f7c2afea090ea5b389289306d..6269822a324eef9b858c9fe079a92e6df59677be 100644 --- a/app/code/Magento/Eav/Model/Resource/Helper.php +++ b/app/code/Magento/Eav/Model/Resource/Helper.php @@ -39,10 +39,10 @@ class Helper extends \Magento\Core\Model\Resource\Helper /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param string $modulePrefix */ - public function __construct(\Magento\Core\Model\Resource $resource, $modulePrefix = 'Magento_Eav') + public function __construct(\Magento\App\Resource $resource, $modulePrefix = 'Magento_Eav') { parent::__construct($resource, $modulePrefix); } diff --git a/app/code/Magento/Eav/etc/di.xml b/app/code/Magento/Eav/etc/di.xml index 230dd2cffd69bf8fa0c3d072790f74250f523fa7..0697c19e53570effdcd0739f88c467999723499e 100644 --- a/app/code/Magento/Eav/etc/di.xml +++ b/app/code/Magento/Eav/etc/di.xml @@ -29,7 +29,7 @@ <value>eav</value> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <eav_setup>Magento\Eav\Model\Entity\Setup</eav_setup> diff --git a/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php b/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php index bd589ddfec46acd0e9e6dfcadfd6ce3f4c8316fc..a66753612c8da4f27b315b35b070b9db32c2bbfb 100644 --- a/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php +++ b/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php @@ -44,21 +44,21 @@ class Config protected $_coreStoreConfig; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Core\Model\Store\Config $coreStoreConfig, $attributes = array() ) { $this->_coreStoreConfig = $coreStoreConfig; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); } /** diff --git a/app/code/Magento/GiftMessage/Helper/Message.php b/app/code/Magento/GiftMessage/Helper/Message.php index cf2cf73ac3c215e1c3e70111cee16a71980d2621..665038955ccd0f4abab86d66eee6a24f1a7b2273 100644 --- a/app/code/Magento/GiftMessage/Helper/Message.php +++ b/app/code/Magento/GiftMessage/Helper/Message.php @@ -23,24 +23,19 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +namespace Magento\GiftMessage\Helper; /** * Gift Message helper - * - * @category Magento - * @package Magento_GiftMessage - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\GiftMessage\Helper; - class Message extends \Magento\Core\Helper\Data { /** - * Giftmessages allow section in configuration + * Gift messages allow section in configuration * */ const XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS = 'sales/gift_options/allow_items'; + const XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER = 'sales/gift_options/allow_order'; /** @@ -72,43 +67,52 @@ class Message extends \Magento\Core\Helper\Data */ protected $_giftMessageFactory; + /** + * @var \Magento\Escaper + */ + protected $_escaper; + /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\View\LayoutFactory $layoutFactory * @param \Magento\GiftMessage\Model\MessageFactory $giftMessageFactory + * @param \Magento\Escaper $escaper * @param bool $dbCompatibleMode */ public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\View\LayoutFactory $layoutFactory, \Magento\GiftMessage\Model\MessageFactory $giftMessageFactory, + \Magento\Escaper $escaper, $dbCompatibleMode = true ) { + $this->_escaper = $escaper; $this->_productFactory = $productFactory; $this->_layoutFactory = $layoutFactory; $this->_giftMessageFactory = $giftMessageFactory; - parent::__construct($context, $eventManager, $coreHttp, $config, $coreStoreConfig, $storeManager, - $locale, $dateModel, $appState, $encryptor, $dbCompatibleMode + parent::__construct( + $context, + $eventManager, + $coreStoreConfig, + $storeManager, + $locale, + $dateModel, + $appState, + $dbCompatibleMode ); } @@ -120,14 +124,13 @@ class Message extends \Magento\Core\Helper\Data * @param boolean $dontDisplayContainer * @return string */ - public function getInline($type, \Magento\Object $entity, $dontDisplayContainer=false) + public function getInline($type, \Magento\Object $entity, $dontDisplayContainer = false) { - if (!in_array($type, array('onepage_checkout','multishipping_address')) + if (!in_array($type, array('onepage_checkout', 'multishipping_address')) && !$this->isMessagesAvailable($type, $entity) ) { return ''; } - return $this->_layoutFactory->create()->createBlock('Magento\GiftMessage\Block\Message\Inline') ->setId('giftmessage_form_' . $this->_nextId++) ->setDontDisplayContainer($dontDisplayContainer) @@ -147,16 +150,14 @@ class Message extends \Magento\Core\Helper\Data { if ($type == 'items') { $items = $entity->getAllItems(); - if(!is_array($items) || empty($items)) { + if (!is_array($items) || empty($items)) { return $this->_coreStoreConfig->getConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, $store); } - if($entity instanceof \Magento\Sales\Model\Quote) { + if ($entity instanceof \Magento\Sales\Model\Quote) { $_type = $entity->getIsMultiShipping() ? 'address_item' : 'item'; - } - else { + } else { $_type = 'order_item'; } - foreach ($items as $item) { if ($item->getParentItem()) { continue; @@ -177,7 +178,6 @@ class Message extends \Magento\Core\Helper\Data ); } elseif ($type == 'address_item') { $storeId = is_numeric($store) ? $store : $this->_storeManager->getStore($store)->getId(); - if (!$this->isCached('address_item_' . $entity->getProductId())) { $this->setCached( 'address_item_' . $entity->getProductId(), @@ -194,7 +194,6 @@ class Message extends \Magento\Core\Helper\Data } else { return $this->_coreStoreConfig->getConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, $store); } - return false; } @@ -205,7 +204,7 @@ class Message extends \Magento\Core\Helper\Data * @param \Magento\Core\Model\Store|integer $store * @return boolean */ - protected function _getDependenceFromStoreConfig($productGiftMessageAllow, $store=null) + protected function _getDependenceFromStoreConfig($productGiftMessageAllow, $store = null) { $result = $this->_coreStoreConfig->getConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, $store); if ($productGiftMessageAllow === '' || is_null($productGiftMessageAllow)) { @@ -223,7 +222,7 @@ class Message extends \Magento\Core\Helper\Data * @param \Magento\Core\Model\Store|integer $store * @return boolen */ - public function getIsMessagesAvailable($type, \Magento\Object $entity, $store=null) + public function getIsMessagesAvailable($type, \Magento\Object $entity, $store = null) { return $this->isMessagesAvailable($type, $entity, $store); } @@ -238,7 +237,7 @@ class Message extends \Magento\Core\Helper\Data { $message = $this->getGiftMessageForEntity($entity); if ($message) { - return nl2br($this->escapeHtml($message->getMessage())); + return nl2br($this->_escaper->escapeHtml($message->getMessage())); } return null; } @@ -251,7 +250,7 @@ class Message extends \Magento\Core\Helper\Data */ public function getGiftMessageForEntity(\Magento\Object $entity) { - if($entity->getGiftMessageId() && !$entity->getGiftMessage()) { + if ($entity->getGiftMessageId() && !$entity->getGiftMessage()) { $message = $this->getGiftMessage($entity->getGiftMessageId()); $entity->setGiftMessage($message); } @@ -268,10 +267,9 @@ class Message extends \Magento\Core\Helper\Data */ public function getCached($key) { - if($this->isCached($key)) { + if ($this->isCached($key)) { return $this->_innerCache[$key]; } - return null; } @@ -306,14 +304,13 @@ class Message extends \Magento\Core\Helper\Data * @param \Magento\Core\Model\Store|integer $store * @return boolen */ - public function getAvailableForQuoteItems($quote, $store=null) + public function getAvailableForQuoteItems($quote, $store = null) { - foreach($quote->getAllItems() as $item) { - if($this->isMessagesAvailable('item', $item, $store)) { + foreach ($quote->getAllItems() as $item) { + if ($this->isMessagesAvailable('item', $item, $store)) { return true; } } - return false; } @@ -324,10 +321,10 @@ class Message extends \Magento\Core\Helper\Data * @param \Magento\Core\Model\Store|integer $store * @return boolen */ - public function getAvailableForAddressItems($items, $store=null) + public function getAvailableForAddressItems($items, $store = null) { - foreach($items as $item) { - if($this->isMessagesAvailable('address_item', $item, $store)) { + foreach ($items as $item) { + if ($this->isMessagesAvailable('address_item', $item, $store)) { return true; } } @@ -340,14 +337,12 @@ class Message extends \Magento\Core\Helper\Data * @param integer $messageId * @return \Magento\GiftMessage\Model\Message */ - public function getGiftMessage($messageId=null) + public function getGiftMessage($messageId = null) { $message = $this->_giftMessageFactory->create(); - if(!is_null($messageId)) { + if (!is_null($messageId)) { $message->load($messageId); } - return $message; } - } diff --git a/app/code/Magento/GiftMessage/Model/Resource/Setup.php b/app/code/Magento/GiftMessage/Model/Resource/Setup.php index 2d8fec034504e4cce99861f4533483768b1d3159..65b8e12b32537f53e2ad6e51753c450bb0c7e89a 100644 --- a/app/code/Magento/GiftMessage/Model/Resource/Setup.php +++ b/app/code/Magento/GiftMessage/Model/Resource/Setup.php @@ -41,17 +41,15 @@ class Setup extends \Magento\Sales\Model\Resource\Setup * @param $resourceName * @param string $moduleName * @param string $connectionName - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory - * @param \Magento\Core\Helper\Data $coreHelper * @param \Magento\Core\Model\Config $config * @param \Magento\Catalog\Model\Resource\SetupFactory $catalogSetupFactory */ public function __construct( \Magento\Core\Model\Resource\Setup\Context $context, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, - \Magento\Core\Helper\Data $coreHelper, \Magento\Core\Model\Config $config, \Magento\Catalog\Model\Resource\SetupFactory $catalogSetupFactory, $resourceName, @@ -60,7 +58,7 @@ class Setup extends \Magento\Sales\Model\Resource\Setup ) { $this->_catalogSetupFactory = $catalogSetupFactory; parent::__construct( - $context, $cache, $attrGrCollFactory, $coreHelper, $config, $resourceName, $moduleName, $connectionName + $context, $cache, $attrGrCollFactory, $config, $resourceName, $moduleName, $connectionName ); } diff --git a/app/code/Magento/GiftMessage/etc/di.xml b/app/code/Magento/GiftMessage/etc/di.xml index 5849ad45bb02f8fe9478cc1974873adee3ee174e..582791427094e7abb32eda4a7da6c76b88ea7a9c 100644 --- a/app/code/Magento/GiftMessage/etc/di.xml +++ b/app/code/Magento/GiftMessage/etc/di.xml @@ -24,7 +24,7 @@ */ --> <config> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <giftmessage_setup>Magento\GiftMessage\Model\Resource\Setup</giftmessage_setup> diff --git a/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php b/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php index 1ee03f40803cfafeb0dbb8dda6321de2a83ea3a7..adb74703e14424d0c333b881a196c4c9ee829c41 100644 --- a/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php +++ b/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php @@ -1,7 +1,4 @@ <?php - -namespace Magento\GoogleAdwords\Model\Validator; - /** * Google AdWords Validator Factory * @@ -27,17 +24,23 @@ namespace Magento\GoogleAdwords\Model\Validator; * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @SuppressWarnings(PHPMD.LongVariable) */ +namespace Magento\GoogleAdwords\Model\Validator; + +use Magento\Validator\Int; +use Magento\Validator\Regex; +use Magento\Validator\UniversalFactory; + class Factory { /** - * @var \Magento\Validator\UniversalFactory + * @var UniversalFactory */ protected $_validatorBuilderFactory; /** - * @param \Magento\Validator\UniversalFactory $validatorBuilderFactory + * @param UniversalFactory $validatorBuilderFactory */ - public function __construct(\Magento\Validator\UniversalFactory $validatorBuilderFactory) + public function __construct(UniversalFactory $validatorBuilderFactory) { $this->_validatorBuilderFactory = $validatorBuilderFactory; } @@ -53,21 +56,23 @@ class Factory $message = __('Conversion Color value is not valid "%1". Please set hexadecimal 6-digit value.', $currentColor); /** @var \Magento\Validator\Builder $builder */ - $builder = $this->_validatorBuilderFactory->create(array( + $builder = $this->_validatorBuilderFactory->create('Magento\Validator\Builder', array( 'constraints' => array( array( 'alias' => 'Regex', 'type' => '', 'class' => 'Magento\Validator\Regex', 'options' => array( - 'arguments' => array('/^[0-9a-f]{6}$/i'), + 'arguments' => array( + 'pattern' => ('/^[0-9a-f]{6}$/i') + ), 'methods' => array( array( 'method' => 'setMessages', 'arguments' => array( array( - \Magento\Validator\Regex::NOT_MATCH => $message, - \Magento\Validator\Regex::INVALID => $message, + Regex::NOT_MATCH => $message, + Regex::INVALID => $message, ), ), ), @@ -90,7 +95,7 @@ class Factory $message = __('Conversion Id value is not valid "%1". Conversion Id should be an integer.', $currentId); /** @var \Magento\Validator\Builder $builder */ - $builder = $this->_validatorBuilderFactory->create(array( + $builder = $this->_validatorBuilderFactory->create('Magento\Validator\Builder', array( 'constraints' => array( array( 'alias' => 'Int', @@ -102,8 +107,8 @@ class Factory 'method' => 'setMessages', 'arguments' => array( array( - \Magento\Validator\Int::NOT_INT => $message, - \Magento\Validator\Int::INVALID => $message, + Int::NOT_INT => $message, + Int::INVALID => $message, ), ), ), diff --git a/app/code/Magento/GoogleAnalytics/Block/Ga.php b/app/code/Magento/GoogleAnalytics/Block/Ga.php index 6a61ed666577350938358db7af61c730fc208ee8..49ac1a50985086148cd0b6265f1e7881b97ba856 100644 --- a/app/code/Magento/GoogleAnalytics/Block/Ga.php +++ b/app/code/Magento/GoogleAnalytics/Block/Ga.php @@ -110,10 +110,10 @@ class Ga extends \Magento\Core\Block\Template $pageName = trim($this->getPageName()); $optPageURL = ''; if ($pageName && preg_match('/^\/.*/i', $pageName)) { - $optPageURL = ", '{$this->jsQuoteEscape($pageName)}'"; + $optPageURL = ", '{$this->escapeJsQuote($pageName)}'"; } return " -_gaq.push(['_setAccount', '{$this->jsQuoteEscape($accountId)}']); +_gaq.push(['_setAccount', '{$this->escapeJsQuote($accountId)}']); _gaq.push(['_trackPageview'{$optPageURL}]); "; } @@ -142,18 +142,18 @@ _gaq.push(['_trackPageview'{$optPageURL}]); } $result[] = sprintf("_gaq.push(['_addTrans', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s']);", $order->getIncrementId(), - $this->jsQuoteEscape($this->_storeManager->getStore()->getFrontendName()), + $this->escapeJsQuote($this->_storeManager->getStore()->getFrontendName()), $order->getBaseGrandTotal(), $order->getBaseTaxAmount(), $order->getBaseShippingAmount(), - $this->jsQuoteEscape($this->_coreData->escapeHtml($address->getCity())), - $this->jsQuoteEscape($this->_coreData->escapeHtml($address->getRegion())), - $this->jsQuoteEscape($this->_coreData->escapeHtml($address->getCountry())) + $this->escapeJsQuote($this->escapeHtml($address->getCity())), + $this->escapeJsQuote($this->escapeHtml($address->getRegion())), + $this->escapeJsQuote($this->escapeHtml($address->getCountry())) ); foreach ($order->getAllVisibleItems() as $item) { $result[] = sprintf("_gaq.push(['_addItem', '%s', '%s', '%s', '%s', '%s', '%s']);", $order->getIncrementId(), - $this->jsQuoteEscape($item->getSku()), $this->jsQuoteEscape($item->getName()), + $this->escapeJsQuote($item->getSku()), $this->escapeJsQuote($item->getName()), null, // there is no "category" defined for the order item $item->getBasePrice(), $item->getQtyOrdered() ); diff --git a/app/code/Magento/GoogleCheckout/Model/Api.php b/app/code/Magento/GoogleCheckout/Model/Api.php index d9a42fa732ae54fc7eabfa73f689d1ae78adc1f9..ad60c073d08911e6af94be45d0903ce124de03b0 100644 --- a/app/code/Magento/GoogleCheckout/Model/Api.php +++ b/app/code/Magento/GoogleCheckout/Model/Api.php @@ -54,28 +54,37 @@ class Api extends \Magento\Object */ protected $objectManager; + /** + * @var \Magento\Stdlib\String + */ + protected $string; + /** * @param \Magento\ObjectManager $objectManager * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Stdlib\String $string * @param array $data */ public function __construct( \Magento\ObjectManager $objectManager, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Stdlib\String $string, array $data = array() ) { $this->objectManager = $objectManager; $this->_eventManager = $eventManager; $this->_coreStoreConfig = $coreStoreConfig; + $this->string = $string; parent::__construct($data); } protected function _getApi($area) { - $api = $this->objectManager->create('Magento\GoogleCheckout\Model\Api\Xml\\' . uc_words($area)) - ->setStoreId($this->getStoreId()); + $api = $this->objectManager->create( + 'Magento\GoogleCheckout\Model\Api\Xml\\' . $this->string->upperCaseWords($area) + )->setStoreId($this->getStoreId()); $api->setApi($this); return $api; } diff --git a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php index db7d6de4e2076f0c885397c0c85c848098cfe2ab..2c3a829d33f0cb423e2a06b33b232ea5023ba4cc 100644 --- a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php +++ b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php @@ -58,6 +58,11 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml */ protected $_eventManager = null; + /** + * @var \Magento\Stdlib\String + */ + protected $string; + /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\Data $coreData @@ -66,6 +71,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml * @param \Magento\ObjectManager $objectManager * @param \Magento\Core\Model\Translate $translator * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Stdlib\String $string * @param array $data */ public function __construct( @@ -76,12 +82,14 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml \Magento\ObjectManager $objectManager, \Magento\Core\Model\Translate $translator, \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Stdlib\String $string, array $data = array() ) { $this->_eventManager = $eventManager; $this->_coreData = $coreData; $this->_googleCheckoutData = $googleCheckoutData; $this->_taxData = $taxData; + $this->string = $string; parent::__construct($objectManager, $translator, $coreStoreConfig, $data); } @@ -137,7 +145,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml $notification->startProcess(); } - $method = '_response' . uc_words($root, '', '-'); + $method = '_response' . $this->string->upperCaseWords($root, '-', ''); if (method_exists($this, $method)) { ob_start(); @@ -1046,12 +1054,14 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml ->addStatusToHistory($this->getOrder()->getStatus(), $msg) ->save(); - $method = '_orderStateChangeFinancial' . uc_words(strtolower($newFinancial), '', '_'); + $method = '_orderStateChangeFinancial' + . $this->string->upperCaseWords(strtolower($newFinancial), '_', ''); if (method_exists($this, $method)) { $this->$method(); } - $method = '_orderStateChangeFulfillment' . uc_words(strtolower($newFulfillment), '', '_'); + $method = '_orderStateChangeFulfillment' + . $this->string->upperCaseWords(strtolower($newFulfillment), '_', ''); if (method_exists($this, $method)) { $this->$method(); } diff --git a/app/code/Magento/GoogleCheckout/Model/Resource/Notification.php b/app/code/Magento/GoogleCheckout/Model/Resource/Notification.php index f7540cf76a552767cd8e5b075373fb49ec964d55..80bf3fad1cff95e7a85b35abed271961c561f417 100644 --- a/app/code/Magento/GoogleCheckout/Model/Resource/Notification.php +++ b/app/code/Magento/GoogleCheckout/Model/Resource/Notification.php @@ -24,22 +24,33 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\GoogleCheckout\Model\Resource; /** * Google Checkout resource notification model - * - * @category Magento - * @package Magento_GoogleCheckout - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\GoogleCheckout\Model\Resource; - class Notification extends \Magento\Core\Model\Resource\Db\AbstractDb { /** - * Intialize resource model. + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\App\Resource $resource + * @param \Magento\Stdlib\DateTime $dateTime + */ + public function __construct( + \Magento\App\Resource $resource, + \Magento\Stdlib\DateTime $dateTime + ) { + $this->dateTime = $dateTime; + parent::__construct($resource); + } + + /** + * Initialize resource model. * Set main entity table name and primary key field name. - * */ protected function _construct() { @@ -71,7 +82,7 @@ class Notification extends \Magento\Core\Model\Resource\Db\AbstractDb { $data = array( 'serial_number' => $serialNumber, - 'started_at' => \Magento\Date::now(), + 'started_at' => $this->dateTime->now(), 'status' => \Magento\GoogleCheckout\Model\Notification::STATUS_INPROCESS ); $this->_getWriteAdapter()->insert($this->getMainTable(), $data); @@ -102,7 +113,7 @@ class Notification extends \Magento\Core\Model\Resource\Db\AbstractDb public function updateProcess($serialNumber) { $this->_getWriteAdapter()->update($this->getMainTable(), - array('started_at' => \Magento\Date::now()), + array('started_at' => $this->dateTime->now()), array('serial_number = ?' => $serialNumber) ); diff --git a/app/code/Magento/GoogleCheckout/etc/di.xml b/app/code/Magento/GoogleCheckout/etc/di.xml index 9a41af1b6f0bb908934e5f73b4105005e6e015f4..62bf17da63e89800d116c8ba5d9c885288cc686d 100644 --- a/app/code/Magento/GoogleCheckout/etc/di.xml +++ b/app/code/Magento/GoogleCheckout/etc/di.xml @@ -24,7 +24,7 @@ */ --> <config> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <googlecheckout_setup>Magento\Catalog\Model\Resource\Setup</googlecheckout_setup> diff --git a/app/code/Magento/GoogleOptimizer/Block/Adminhtml/AbstractTab.php b/app/code/Magento/GoogleOptimizer/Block/Adminhtml/AbstractTab.php index 1d6bf9fc70346a453d26e73aa53912b3c2dbacdc..e231365284dc71996cc3ea1c35536b32f5f2d303 100644 --- a/app/code/Magento/GoogleOptimizer/Block/Adminhtml/AbstractTab.php +++ b/app/code/Magento/GoogleOptimizer/Block/Adminhtml/AbstractTab.php @@ -55,7 +55,7 @@ abstract class AbstractTab * @param \Magento\Core\Model\Registry $registry * @param \Magento\GoogleOptimizer\Helper\Code $codeHelper * @param \Magento\GoogleOptimizer\Helper\Form $formHelper - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param array $data */ public function __construct( @@ -65,7 +65,7 @@ abstract class AbstractTab \Magento\Core\Model\Registry $registry, \Magento\GoogleOptimizer\Helper\Code $codeHelper, \Magento\GoogleOptimizer\Helper\Form $formHelper, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, array $data = array() ) { parent::__construct($coreData, $context, $data); diff --git a/app/code/Magento/GoogleOptimizer/Block/Adminhtml/Catalog/Category/Edit/Tab/Googleoptimizer.php b/app/code/Magento/GoogleOptimizer/Block/Adminhtml/Catalog/Category/Edit/Tab/Googleoptimizer.php index 58e78b918e483f8e636feab424974d8560383daa..95ff1139a026e0c290c8a14a39cf75124d248a91 100644 --- a/app/code/Magento/GoogleOptimizer/Block/Adminhtml/Catalog/Category/Edit/Tab/Googleoptimizer.php +++ b/app/code/Magento/GoogleOptimizer/Block/Adminhtml/Catalog/Category/Edit/Tab/Googleoptimizer.php @@ -45,7 +45,7 @@ class Googleoptimizer /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\GoogleOptimizer\Helper\Code $codeHelper @@ -54,7 +54,7 @@ class Googleoptimizer */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\GoogleOptimizer\Helper\Code $codeHelper, diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php index 947ebb6c9b7b525f9e9a0fd32c225d80362c8a79..663b9036c912fb07c5d4332ca69cc499f57bfbfc 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php @@ -202,7 +202,7 @@ class Attributes foreach ($attributes as $attribute) { /* @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */ $result[$attribute->getAttributeId()] = $escapeJsQuotes - ? $this->jsQuoteEscape($attribute->getFrontendLabel()) + ? $this->escapeJsQuote($attribute->getFrontendLabel()) : $attribute->getFrontendLabel(); } return $result; diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Form.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Form.php index 98f84db3b083729b60faaaf0dc041f3ff212a505..dd2fa9a326ad5ba858e288503298a0f1bf456972 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Form.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Form.php @@ -43,7 +43,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic protected $_elementFactory; /** - * @var \Magento\Data\Form\Factory + * @var \Magento\Data\FormFactory */ protected $_formFactory; @@ -87,7 +87,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $eavCollectionFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\GoogleShopping\Model\Config $config - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Data\Form\Element\Factory $elementFactory * @param \Magento\GoogleShopping\Helper\Category $googleShoppingCategory * @param \Magento\Core\Helper\Data $coreData @@ -100,7 +100,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $eavCollectionFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\GoogleShopping\Model\Config $config, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Data\Form\Element\Factory $elementFactory, \Magento\GoogleShopping\Helper\Category $googleShoppingCategory, \Magento\Core\Helper\Data $coreData, diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php index cac7b2f22e40a6af0ae3a4283e5ed8c17061d7c6..2506da12f33b7b7db31d87a261ec3546f4dd530a 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php @@ -156,7 +156,7 @@ class Items extends \Magento\Backend\Controller\Adminhtml\Action __('An error has occurred while adding products to google shopping account.'), $e->getMessage() ); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); return; } @@ -196,7 +196,7 @@ class Items extends \Magento\Backend\Controller\Adminhtml\Action __('An error has occurred while deleting products from google shopping account.'), __('One or more products were not deleted from google shopping account. Refer to the log file for details.') ); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); return; } @@ -236,7 +236,7 @@ class Items extends \Magento\Backend\Controller\Adminhtml\Action __('An error has occurred while deleting products from google shopping account.'), __('One or more products were not deleted from google shopping account. Refer to the log file for details.') ); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); return; } @@ -269,7 +269,7 @@ class Items extends \Magento\Backend\Controller\Adminhtml\Action ->parseGdataExceptionMessage($e->getMessage()) ); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__('Something went wrong during Captcha confirmation.')); } diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php index 15b5a068b383e645088c138ff085602a8c6797ab..17a9648d2f61f422bda771bf06518fa80cae495d 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php @@ -130,7 +130,7 @@ class Types extends \Magento\Backend\Controller\Adminhtml\Action ->_addContent($this->getLayout()->createBlock('Magento\GoogleShopping\Block\Adminhtml\Types\Edit')) ->renderLayout(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__("We can't create Attribute Set Mapping.")); $this->_redirect('adminhtml/*/index', array('store' => $this->_getStore()->getId())); } @@ -165,7 +165,7 @@ class Types extends \Magento\Backend\Controller\Adminhtml\Action ->_addContent($this->getLayout()->createBlock('Magento\GoogleShopping\Block\Adminhtml\Types\Edit')) ->renderLayout(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__("We can't edit Attribute Set Mapping.")); $this->_redirect('adminhtml/*/index'); } @@ -224,7 +224,7 @@ class Types extends \Magento\Backend\Controller\Adminhtml\Action ->addSuccess($this->_objectManager->get('Magento\GoogleShopping\Helper\Category')->getMessage()); } } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_objectManager->get('Magento\Adminhtml\Model\Session') ->addError(__("We can't save Attribute Set Mapping.")); } @@ -245,7 +245,7 @@ class Types extends \Magento\Backend\Controller\Adminhtml\Action } $this->_getSession()->addSuccess(__('Attribute set mapping was deleted')); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__("We can't delete Attribute Set Mapping.")); } $this->_redirect('adminhtml/*/index', array('store' => $this->_getStore()->getId())); @@ -265,7 +265,7 @@ class Types extends \Magento\Backend\Controller\Adminhtml\Action ->toHtml() ); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); // just need to output text with error $this->_getSession()->addError(__("We can't load attributes.")); } @@ -283,7 +283,7 @@ class Types extends \Magento\Backend\Controller\Adminhtml\Action ->toHtml() ); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); // just need to output text with error $this->_getSession()->addError(__("We can't load attribute sets.")); } diff --git a/app/code/Magento/GoogleShopping/Helper/Data.php b/app/code/Magento/GoogleShopping/Helper/Data.php index 5980e592fb2007faca50c932a15353a12eb653b7..f4f195fc36cc747defe8d249fbd141f46ab4455e 100644 --- a/app/code/Magento/GoogleShopping/Helper/Data.php +++ b/app/code/Magento/GoogleShopping/Helper/Data.php @@ -36,9 +36,11 @@ namespace Magento\GoogleShopping\Helper; class Data extends \Magento\Core\Helper\AbstractHelper { /** - * @var \Magento\Core\Helper\String|null + * Magento string lib + * + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * Store manager @@ -48,16 +50,16 @@ class Data extends \Magento\Core\Helper\AbstractHelper protected $_storeManager; /** - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Helper\Context $context */ public function __construct( - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Helper\Context $context ) { - $this->_coreString = $coreString; + $this->string = $string; $this->_storeManager = $storeManager; parent::__construct($context); } @@ -85,8 +87,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function cleanAtomAttribute($string) { - return $this->_coreString - ->substr(preg_replace('/[\pC¢€•—™°½]|shipping/ui', '', $string), 0, 3500); + return $this->string->substr(preg_replace('/[\pC¢€•—™°½]|shipping/ui', '', $string), 0, 3500); } /** diff --git a/app/code/Magento/GoogleShopping/Model/AttributeFactory.php b/app/code/Magento/GoogleShopping/Model/AttributeFactory.php index f47296a4d501ea16d2a01b686e1d49e7fccb53c9..c0bc1b9e4c7abd9cf18ba4d21e39ab888caff716 100644 --- a/app/code/Magento/GoogleShopping/Model/AttributeFactory.php +++ b/app/code/Magento/GoogleShopping/Model/AttributeFactory.php @@ -49,14 +49,24 @@ class AttributeFactory */ protected $_gsData; + /** + * @var \Magento\Stdlib\String + */ + protected $_string; + /** * @param \Magento\ObjectManager $objectManager * @param \Magento\GoogleShopping\Helper\Data $gsData + * @param \Magento\Stdlib\String $string */ - public function __construct(\Magento\ObjectManager $objectManager, \Magento\GoogleShopping\Helper\Data $gsData) - { + public function __construct( + \Magento\ObjectManager $objectManager, + \Magento\GoogleShopping\Helper\Data $gsData, + \Magento\Stdlib\String $string + ) { $this->_objectManager = $objectManager; $this->_gsData = $gsData; + $this->_string = $string; } /** @@ -67,7 +77,8 @@ class AttributeFactory */ public function createAttribute($name) { - $modelName = 'Magento\GoogleShopping\Model\Attribute\\' . uc_words($this->_gsData->normalizeName($name)); + $modelName = 'Magento\GoogleShopping\Model\Attribute\\' + . $this->_string->upperCaseWords($this->_gsData->normalizeName($name)); try { /** @var \Magento\GoogleShopping\Model\Attribute\DefaultAttribute $attributeModel */ $attributeModel = $this->_objectManager->create($modelName); diff --git a/app/code/Magento/GoogleShopping/Model/Config.php b/app/code/Magento/GoogleShopping/Model/Config.php index ef2af955e1e8197b7ea2d60e2ea98d82076867e7..373568ce32bcc721816f487369b5459d7de43560 100644 --- a/app/code/Magento/GoogleShopping/Model/Config.php +++ b/app/code/Magento/GoogleShopping/Model/Config.php @@ -42,11 +42,6 @@ class Config extends \Magento\Object */ protected $_config = array(); - /** - * @var \Magento\Core\Helper\Data|null - */ - protected $_coreData = null; - /** * Core store config * @@ -62,21 +57,25 @@ class Config extends \Magento\Object protected $_storeManager; /** - * @param \Magento\Core\Helper\Data $coreData - * + * @var \Magento\Encryption\EncryptorInterface + */ + protected $_encryptor; + + /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Encryption\EncryptorInterface $encryptor * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Encryption\EncryptorInterface $encryptor, array $data = array() ) { $this->_coreStoreConfig = $coreStoreConfig; - $this->_coreData = $coreData; $this->_storeManager = $storeManager; + $this->_encryptor = $encryptor; parent::__construct($data); } @@ -126,7 +125,7 @@ class Config extends \Magento\Object */ public function getAccountPassword($storeId = null) { - return $this->_coreData->decrypt($this->getConfigData('password', $storeId)); + return $this->_encryptor->decrypt($this->getConfigData('password', $storeId)); } /** diff --git a/app/code/Magento/GoogleShopping/Model/MassOperations.php b/app/code/Magento/GoogleShopping/Model/MassOperations.php index 1ed6d0c469a1eef0042dcfadc21bc90ec26cfec7..ed55eedab92d04d6e961dc4eae6de8808245b267 100644 --- a/app/code/Magento/GoogleShopping/Model/MassOperations.php +++ b/app/code/Magento/GoogleShopping/Model/MassOperations.php @@ -86,7 +86,7 @@ class MassOperations * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\GoogleShopping\Helper\Data $gleShoppingData * @param \Magento\GoogleShopping\Helper\Category $gleShoppingCategory * @param array $data @@ -97,7 +97,7 @@ class MassOperations \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\GoogleShopping\Helper\Data $gleShoppingData, \Magento\GoogleShopping\Helper\Category $gleShoppingCategory, array $data = array() @@ -134,7 +134,7 @@ class MassOperations protected $_flag; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php b/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php index 3691bb7700b609c192d3421be01e079e70ba904d..f098c361504c1e0ba55b9bdebdd513cb0d64d252 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php @@ -53,7 +53,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Core\Model\Resource\Helper $resourceHelper * @param \Magento\Eav\Model\Config $config * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource @@ -62,7 +62,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Core\Model\Resource\Helper $resourceHelper, \Magento\Eav\Model\Config $config, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/GoogleShopping/etc/di.xml b/app/code/Magento/GoogleShopping/etc/di.xml index f456df2403cd2a3fb97311624c977a7c5281fe3f..04b68a3edb3d75b78fd26f0cc60545b4a88f6b03 100644 --- a/app/code/Magento/GoogleShopping/etc/di.xml +++ b/app/code/Magento/GoogleShopping/etc/di.xml @@ -34,7 +34,7 @@ <instance type="Magento\GoogleShopping\Model\Resource\Helper" /> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <googleshopping_setup>Magento\GoogleShopping\Model\Resource\Setup</googleshopping_setup> diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php index bf142951f0520f6888aebd1f94f76f3a6e542060..f587142e923995ae06e47b011a678c5d2f344e7c 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php @@ -47,7 +47,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\ImportExport\Model\Source\Export\EntityFactory $entityFactory @@ -56,7 +56,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\ImportExport\Model\Source\Export\EntityFactory $entityFactory, diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php index 992fb0d3e38f499366e230789e22d7819691d5df..a9b4ef4c74cc9f416dafe744db6ffc4f22a8de5b 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php @@ -118,8 +118,8 @@ class Filter extends \Magento\Adminhtml\Block\Widget\Grid $fromValue = null; $toValue = null; if (is_array($value) && count($value) == 2) { - $fromValue = $this->_helper->escapeHtml(reset($value)); - $toValue = $this->_helper->escapeHtml(next($value)); + $fromValue = $this->escapeHtml(reset($value)); + $toValue = $this->escapeHtml(next($value)); } return '<strong>' . __('From') . ':</strong> ' @@ -140,7 +140,7 @@ class Filter extends \Magento\Adminhtml\Block\Widget\Grid $html = '<input type="text" name="' . $this->getFilterElementName($attribute->getAttributeCode()) . '" class="input-text input-text-export-filter"'; if ($value) { - $html .= ' value="' . $this->_helper->escapeHtml($value) . '"'; + $html .= ' value="' . $this->escapeHtml($value) . '"'; } return $html . ' />'; } @@ -198,8 +198,8 @@ class Filter extends \Magento\Adminhtml\Block\Widget\Grid $toValue = null; $name = $this->getFilterElementName($attribute->getAttributeCode()); if (is_array($value) && count($value) == 2) { - $fromValue = $this->_helper->escapeHtml(reset($value)); - $toValue = $this->_helper->escapeHtml(next($value)); + $fromValue = $this->escapeHtml(reset($value)); + $toValue = $this->escapeHtml(next($value)); } return '<strong>' . __('From') . ':</strong> ' diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php index 0f8cacae83a6f472c339fcc248a83144ccad763d..d0defb28848073578669948c4178412195833ce4 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php @@ -54,7 +54,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\ImportExport\Model\Import $importModel @@ -64,7 +64,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\ImportExport\Model\Import $importModel, diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php index 85b12aa26a7f2b60bd60bfb1e6e7acff085bc9d3..bd10028a2cf996f9e550fa90f54cb66934a6b6b0 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php @@ -80,7 +80,7 @@ class Export extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__('Please correct the data sent.')); } } else { diff --git a/app/code/Magento/ImportExport/Helper/Data.php b/app/code/Magento/ImportExport/Helper/Data.php index c28dc46c6093bc464ea3bf8c62baea80bb93d14f..1edcb6dc8abb75d1eb27651c904b8cf7e7e28e94 100644 --- a/app/code/Magento/ImportExport/Helper/Data.php +++ b/app/code/Magento/ImportExport/Helper/Data.php @@ -50,35 +50,35 @@ class Data extends \Magento\Core\Helper\Data /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor * @param \Magento\File\Size $fileSize * @param bool $dbCompatibleMode */ public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, \Magento\File\Size $fileSize, $dbCompatibleMode = true - ) - { + ) { $this->_fileSize = $fileSize; - parent::__construct($context, $eventManager, $coreHttp, $config, $coreStoreConfig, $storeManager, - $locale, $dateModel, $appState, $encryptor, $dbCompatibleMode + parent::__construct( + $context, + $eventManager, + $coreStoreConfig, + $storeManager, + $locale, + $dateModel, + $appState, + $dbCompatibleMode ); } diff --git a/app/code/Magento/ImportExport/Model/AbstractModel.php b/app/code/Magento/ImportExport/Model/AbstractModel.php index a749ad4b64fba3d88e685e742c2a616d6abeb186..babc37bf7813a6ee81590c8216a72a8803045df7 100644 --- a/app/code/Magento/ImportExport/Model/AbstractModel.php +++ b/app/code/Magento/ImportExport/Model/AbstractModel.php @@ -63,7 +63,7 @@ abstract class AbstractModel extends \Magento\Object protected $_logTrace = array(); /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -78,13 +78,13 @@ abstract class AbstractModel extends \Magento\Object protected $_adapterFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\App\Dir $dir * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory * @param array $data */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\App\Dir $dir, \Magento\Core\Model\Log\AdapterFactory $adapterFactory, array $data = array() diff --git a/app/code/Magento/ImportExport/Model/Export.php b/app/code/Magento/ImportExport/Model/Export.php index 0bbe6ba51d869d4116758530ffb0338ebd994971..b73c96a8bf9f02f88e5140c270b037df56230abf 100644 --- a/app/code/Magento/ImportExport/Model/Export.php +++ b/app/code/Magento/ImportExport/Model/Export.php @@ -76,7 +76,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel protected $_exportAdapterFac; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\App\Dir $dir * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory * @param \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig @@ -85,7 +85,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * @param array $data */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\App\Dir $dir, \Magento\Core\Model\Log\AdapterFactory $adapterFactory, \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig, diff --git a/app/code/Magento/ImportExport/Model/Export/Config/SchemaLocator.php b/app/code/Magento/ImportExport/Model/Export/Config/SchemaLocator.php index b44d9b18ddee87723c185afbc31735c9e573f7ee..de38998f8b923b2edbc48bd5072300fa3deba471 100644 --- a/app/code/Magento/ImportExport/Model/Export/Config/SchemaLocator.php +++ b/app/code/Magento/ImportExport/Model/Export/Config/SchemaLocator.php @@ -40,9 +40,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $etcDir = $moduleReader->getModuleDir('etc', 'Magento_ImportExport'); $this->_schema = $etcDir . DIRECTORY_SEPARATOR . 'export_merged.xsd'; diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php index 53cfae5ec4f5a1bea14e43beff526bdf2cf5dc29..cf8db424bd630fbaa1fbca74e375a9439ea1996c 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php @@ -168,13 +168,13 @@ abstract class AbstractEntity /** * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Eav\Model\Config $config - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Core\Model\LocaleInterface $locale, \Magento\Eav\Model\Config $config, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\StoreManagerInterface $storeManager ) { $this->_locale = $locale; diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php index 71caae6fd3aa5ba1bb0604b7d7b6ce9e4bf3437b..1be584e755ca477abccb63369c66403a6bb746a6 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php @@ -155,7 +155,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity protected $_exportConfig; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** @@ -172,7 +172,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity protected $_categoryColFactory; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resourceModel; @@ -199,9 +199,9 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity /** * @param \Magento\Core\Model\LocaleInterface $localeInterface * @param \Magento\Eav\Model\Config $config - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Catalog\Model\Resource\Product\Collection $collection * @param \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig * @param \Magento\Catalog\Model\Resource\ProductFactory $productFactory @@ -215,9 +215,9 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity public function __construct( \Magento\Core\Model\LocaleInterface $localeInterface, \Magento\Eav\Model\Config $config, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Catalog\Model\Resource\Product\Collection $collection, \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig, \Magento\Catalog\Model\Resource\ProductFactory $productFactory, diff --git a/app/code/Magento/Core/Model/Config/StorageInterface.php b/app/code/Magento/ImportExport/Model/HttpAdapterFactory.php similarity index 74% rename from app/code/Magento/Core/Model/Config/StorageInterface.php rename to app/code/Magento/ImportExport/Model/HttpAdapterFactory.php index cd836a7d157d0c6dabf17fb39c197e03a553f09b..11eb9370105cac341b83e07831316b0f38a843c9 100644 --- a/app/code/Magento/Core/Model/Config/StorageInterface.php +++ b/app/code/Magento/ImportExport/Model/HttpAdapterFactory.php @@ -1,7 +1,5 @@ <?php /** - * Application config storage interface - * * Magento * * NOTICE OF LICENSE @@ -23,19 +21,18 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\ImportExport\Model; -interface StorageInterface +class HttpAdapterFactory { /** - * Get loaded configuration + * Create HTTP adapter * - * @return \Magento\Core\Model\ConfigInterface - */ - public function getConfiguration(); - - /** - * Remove configuration cache + * @param array $options + * @return \Zend_File_Transfer_Adapter_Http */ - public function removeCache(); -} + public function create(array $options = array()) + { + return new \Zend_File_Transfer_Adapter_Http($options); + } +} \ No newline at end of file diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php index f10e6a2a7ceb0d8311d6e1136df02d5fce2627a8..b6b8620e1e1c678d62dce577e3d8dcfc21e8f40c 100644 --- a/app/code/Magento/ImportExport/Model/Import.php +++ b/app/code/Magento/ImportExport/Model/Import.php @@ -111,7 +111,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel protected $_csvFactory; /** - * @var \Zend_File_Transfer_Adapter_HttpFactory + * @var \Magento\ImportExport\Model\HttpAdapterFactory */ protected $_httpFactory; @@ -131,23 +131,23 @@ class Import extends \Magento\ImportExport\Model\AbstractModel protected $_behaviorFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\App\Dir $dir * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory * @param \Magento\ImportExport\Helper\Data $importExportData * @param \Magento\Core\Model\Config $coreConfig - * @param \Magento\ImportExport\Model\Import\ConfigInterface $importConfig - * @param \Magento\ImportExport\Model\Import\Entity\Factory $entityFactory - * @param \Magento\ImportExport\Model\Resource\Import\Data $importData - * @param \Magento\ImportExport\Model\Export\Adapter\CsvFactory $csvFactory - * @param \Zend_File_Transfer_Adapter_HttpFactory $httpFactory + * @param Import\ConfigInterface $importConfig + * @param Import\Entity\Factory $entityFactory + * @param Resource\Import\Data $importData + * @param Export\Adapter\CsvFactory $csvFactory + * @param HttpAdapterFactory $httpFactory * @param \Magento\Core\Model\File\UploaderFactory $uploaderFactory - * @param \Magento\ImportExport\Model\Source\Import\Behavior\Factory $behaviorFactory + * @param Source\Import\Behavior\Factory $behaviorFactory * @param \Magento\Index\Model\Indexer $indexer * @param array $data */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\App\Dir $dir, \Magento\Core\Model\Log\AdapterFactory $adapterFactory, \Magento\ImportExport\Helper\Data $importExportData, @@ -156,7 +156,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel \Magento\ImportExport\Model\Import\Entity\Factory $entityFactory, \Magento\ImportExport\Model\Resource\Import\Data $importData, \Magento\ImportExport\Model\Export\Adapter\CsvFactory $csvFactory, - \Zend_File_Transfer_Adapter_HttpFactory $httpFactory, + \Magento\ImportExport\Model\HttpAdapterFactory $httpFactory, \Magento\Core\Model\File\UploaderFactory $uploaderFactory, \Magento\ImportExport\Model\Source\Import\Behavior\Factory $behaviorFactory, \Magento\Index\Model\Indexer $indexer, diff --git a/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php index f42c56f13501e456e588ffe403d7175d40604ca2..a499f9cfa27ea0622dada0f814ad67a3ec07c44c 100644 --- a/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\ImportExport\Model\Import; + /** * Import entity abstract model - * - * @category Magento - * @package Magento_ImportExport - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\ImportExport\Model\Import; - abstract class AbstractEntity { /** @@ -137,11 +133,11 @@ abstract class AbstractEntity protected $_jsonHelper; /** - * Helper to manipulate with string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_stringHelper; + protected $string; /** * Entity model parameters @@ -251,20 +247,20 @@ abstract class AbstractEntity /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param array $data */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, array $data = array() ) { $this->_coreStoreConfig = $coreStoreConfig; @@ -273,7 +269,7 @@ abstract class AbstractEntity $this->_connection = isset($data['connection']) ? $data['connection'] : $resource->getConnection('write'); $this->_jsonHelper = $coreData; - $this->_stringHelper = $coreString; + $this->string = $string; $this->_pageSize = isset($data['page_size']) ? $data['page_size'] : (static::XML_PATH_PAGE_SIZE ? (int)$this->_coreStoreConfig->getConfig(static::XML_PATH_PAGE_SIZE) : 0); $this->_maxDataSize = isset($data['max_data_size']) ? $data['max_data_size'] @@ -581,8 +577,8 @@ abstract class AbstractEntity { switch ($attributeParams['type']) { case 'varchar': - $value = $this->_stringHelper->cleanString($rowData[$attributeCode]); - $valid = $this->_stringHelper->strlen($value) < self::DB_MAX_VARCHAR_LENGTH; + $value = $this->string->cleanString($rowData[$attributeCode]); + $valid = $this->string->strlen($value) < self::DB_MAX_VARCHAR_LENGTH; break; case 'decimal': $value = trim($rowData[$attributeCode]); @@ -601,8 +597,8 @@ abstract class AbstractEntity $valid = strtotime($value) !== false; break; case 'text': - $value = $this->_stringHelper->cleanString($rowData[$attributeCode]); - $valid = $this->_stringHelper->strlen($value) < self::DB_MAX_TEXT_LENGTH; + $value = $this->string->cleanString($rowData[$attributeCode]); + $valid = $this->string->strlen($value) < self::DB_MAX_TEXT_LENGTH; break; default: $valid = true; @@ -701,11 +697,10 @@ abstract class AbstractEntity { if (!$this->_dataValidated) { // do all permanent columns exist? - if ($absentColumns = array_diff($this->_permanentAttributes, $this->getSource()->getColNames())) { + $absentColumns = array_diff($this->_permanentAttributes, $this->getSource()->getColNames()); + if ($absentColumns) { throw new \Magento\Core\Exception( - __('Cannot find required columns: %1', - implode(', ', $absentColumns) - ) + __('Cannot find required columns: %1', implode(', ', $absentColumns)) ); } @@ -726,16 +721,12 @@ abstract class AbstractEntity if ($emptyHeaderColumns) { throw new \Magento\Core\Exception( - __('Columns number: "%1" have empty headers', - implode('", "', $emptyHeaderColumns) - ) + __('Columns number: "%1" have empty headers', implode('", "', $emptyHeaderColumns)) ); } if ($invalidColumns) { throw new \Magento\Core\Exception( - __('Column names: "%1" are invalid', - implode('", "', $invalidColumns) - ) + __('Column names: "%1" are invalid', implode('", "', $invalidColumns)) ); } diff --git a/app/code/Magento/ImportExport/Model/Import/Config/SchemaLocator.php b/app/code/Magento/ImportExport/Model/Import/Config/SchemaLocator.php index a4898cf09814bc2c5f9f9c2948806a5d2e95eefc..d7eb2c0e89260bc45fb37b8ef90f3b561159f0cc 100644 --- a/app/code/Magento/ImportExport/Model/Import/Config/SchemaLocator.php +++ b/app/code/Magento/ImportExport/Model/Import/Config/SchemaLocator.php @@ -40,9 +40,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $etcDir = $moduleReader->getModuleDir('etc', 'Magento_ImportExport'); $this->_schema = $etcDir . DIRECTORY_SEPARATOR . 'import_merged.xsd'; diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php index 552abd8a2a4e5434afd4ce57ab02d3f64d63b23f..c64a85c42aa7f4b5faeb6f94250b5adc38dea7a4 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php @@ -102,11 +102,11 @@ abstract class AbstractEav /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\App $app * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\Eav\Model\Config $eavConfig @@ -114,18 +114,18 @@ abstract class AbstractEav */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\App $app, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, array $data = array() ) { parent::__construct( - $coreData, $coreString, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $data + $coreData, $string, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $data ); $this->_websiteManager = isset($data['website_manager']) ? $data['website_manager'] : $app; diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php index d39bf56404495cc986c025a3bfd210fc6b7a2851..12d8f3a596039633d39e2cd8e9e8e57ac6712d6e 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php @@ -24,20 +24,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\ImportExport\Model\Import\Entity; + /** * Import entity abstract model - * - * @category Magento - * @package Magento_ImportExport - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\ImportExport\Model\Import\Entity; - abstract class AbstractEntity { /** * Database constants - * */ const DB_MAX_PACKET_COEFFICIENT = 900000; const DB_MAX_PACKET_DATA = 1048576; @@ -200,48 +195,49 @@ abstract class AbstractEntity * * @var \Magento\ImportExport\Helper\Data */ - protected $_importExportData = null; + protected $_importExportData; /** * Core data * * @var \Magento\Core\Helper\Data */ - protected $_coreData = null; + protected $_coreData; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; + /** * @var \Magento\ImportExport\Model\Resource\Helper */ protected $_resourceHelper; /** - * @param \Magento\Core\Helper\String $coreString * @param \Magento\Core\Helper\Data $coreData * @param \Magento\ImportExport\Helper\Data $importExportData * @param \Magento\ImportExport\Model\Resource\Import\Data $importData * @param \Magento\Eav\Model\Config $config - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\String $string */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Core\Helper\Data $coreData, \Magento\ImportExport\Helper\Data $importExportData, \Magento\ImportExport\Model\Resource\Import\Data $importData, \Magento\Eav\Model\Config $config, - \Magento\Core\Model\Resource $resource, - \Magento\ImportExport\Model\Resource\Helper $resourceHelper + \Magento\App\Resource $resource, + \Magento\ImportExport\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\String $string ) { - $this->_coreString = $coreString; $this->_coreData = $coreData; $this->_importExportData = $importExportData; $this->_resourceHelper = $resourceHelper; + $this->string = $string; $entityType = $config->getEntityType($this->getEntityTypeCode()); @@ -254,6 +250,7 @@ abstract class AbstractEntity * Inner source object getter. * * @return \Magento\ImportExport\Model\Import\AbstractSource + * @throws \Magento\Core\Exception */ protected function _getSource() { @@ -591,8 +588,8 @@ abstract class AbstractEntity { switch ($attrParams['type']) { case 'varchar': - $val = $this->_coreString->cleanString($rowData[$attrCode]); - $valid = $this->_coreString->strlen($val) < self::DB_MAX_VARCHAR_LENGTH; + $val = $this->string->cleanString($rowData[$attrCode]); + $valid = $this->string->strlen($val) < self::DB_MAX_VARCHAR_LENGTH; break; case 'decimal': $val = trim($rowData[$attrCode]); @@ -611,8 +608,8 @@ abstract class AbstractEntity $valid = strtotime($val) !== false; break; case 'text': - $val = $this->_coreString->cleanString($rowData[$attrCode]); - $valid = $this->_coreString->strlen($val) < self::DB_MAX_TEXT_LENGTH; + $val = $this->string->cleanString($rowData[$attrCode]); + $valid = $this->string->strlen($val) < self::DB_MAX_TEXT_LENGTH; break; default: $valid = true; diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/CustomerComposite.php b/app/code/Magento/ImportExport/Model/Import/Entity/CustomerComposite.php index d66dcde49dcb3b96b9bdac0086bf4ab110716062..144bc0c24788bd45a27fb10ae0ea88e19f501f2a 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/CustomerComposite.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/CustomerComposite.php @@ -140,11 +140,11 @@ class CustomerComposite /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\ImportExport\Model\Resource\Import\CustomerComposite\DataFactory $dataFactory * @param \Magento\ImportExport\Model\Import\Entity\Eav\CustomerFactory $customerFactory * @param \Magento\ImportExport\Model\Import\Entity\Eav\Customer\AddressFactory $addressFactory @@ -154,18 +154,18 @@ class CustomerComposite */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\ImportExport\Model\Resource\Import\CustomerComposite\DataFactory $dataFactory, \Magento\ImportExport\Model\Import\Entity\Eav\CustomerFactory $customerFactory, \Magento\ImportExport\Model\Import\Entity\Eav\Customer\AddressFactory $addressFactory, array $data = array() ) { parent::__construct( - $coreData, $coreString, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $data + $coreData, $string, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $data ); $this->addMessageTemplate(self::ERROR_ROW_IS_ORPHAN, diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/AbstractCustomer.php b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/AbstractCustomer.php index 920204d6f820feb33762658dec138f4f25d14402..947f34ad931111e01758ed7c0f77f86f5ab7df06 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/AbstractCustomer.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/AbstractCustomer.php @@ -24,17 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\ImportExport\Model\Import\Entity\Eav; + /** * Import entity abstract customer model - * - * @category Magento - * @package Magento_ImportExport - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\ImportExport\Model\Import\Entity\Eav; - -abstract class AbstractCustomer - extends \Magento\ImportExport\Model\Import\Entity\AbstractEav +abstract class AbstractCustomer extends \Magento\ImportExport\Model\Import\Entity\AbstractEav { /**#@+ * Permanent column names @@ -80,11 +75,11 @@ abstract class AbstractCustomer /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\App $app * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\Eav\Model\Config $eavConfig @@ -93,11 +88,11 @@ abstract class AbstractCustomer */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\App $app, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, @@ -106,7 +101,7 @@ abstract class AbstractCustomer ) { $this->_storageFactory = $storageFactory; parent::__construct( - $coreData, $coreString, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $app, + $coreData, $string, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $app, $collectionFactory, $eavConfig, $data ); diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer.php b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer.php index d9a8bb9740c6f58046b51fcff6cd5549e8d064f8..c273b9aa8fc3155ff1853bc7eba23d87b21729fc 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer.php @@ -133,11 +133,11 @@ class Customer /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\App $app * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\Eav\Model\Config $eavConfig @@ -148,11 +148,11 @@ class Customer */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\App $app, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, @@ -172,7 +172,7 @@ class Customer $data['attribute_collection'] = $this->_attributeCollection; } - parent::__construct($coreData, $coreString, $coreStoreConfig, $importFactory, $resourceHelper, $resource, + parent::__construct($coreData, $string, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $app, $collectionFactory, $eavConfig, $storageFactory, $data); $this->_specialAttributes[] = self::COLUMN_WEBSITE; @@ -197,8 +197,7 @@ class Customer __('Invalid password length') ); - $this->_initStores(true) - ->_initAttributes(); + $this->_initStores(true)->_initAttributes(); $this->_customerModel = $customerFactory->create(); /** @var $customerResource \Magento\Customer\Model\Resource\Customer */ @@ -314,8 +313,8 @@ class Customer 'store_id' => empty($rowData[self::COLUMN_STORE]) ? 0 : $this->_storeCodeToId[$rowData[self::COLUMN_STORE]], - 'created_at' => $createdAt->format(\Magento\Date::DATETIME_PHP_FORMAT), - 'updated_at' => $now->format(\Magento\Date::DATETIME_PHP_FORMAT), + 'created_at' => $createdAt->format(\Magento\Stdlib\DateTime::DATETIME_PHP_FORMAT), + 'updated_at' => $now->format(\Magento\Stdlib\DateTime::DATETIME_PHP_FORMAT), ); $emailInLowercase = strtolower($rowData[self::COLUMN_EMAIL]); @@ -347,7 +346,7 @@ class Customer $value = $attributeParameters['options'][strtolower($value)]; } elseif ('datetime' == $attributeParameters['type']) { $value = new \DateTime('@' . strtotime($value)); - $value = $value->format(\Magento\Date::DATETIME_PHP_FORMAT); + $value = $value->format(\Magento\Stdlib\DateTime::DATETIME_PHP_FORMAT); } elseif ($backendModel) { $attribute->getBackend()->beforeSave($this->_customerModel->setData($attributeCode, $value)); $value = $this->_customerModel->getData($attributeCode); @@ -459,7 +458,7 @@ class Customer } // check password if (isset($rowData['password']) && strlen($rowData['password']) - && $this->_stringHelper->strlen($rowData['password']) < self::MIN_PASSWORD_LENGTH + && $this->string->strlen($rowData['password']) < self::MIN_PASSWORD_LENGTH ) { $this->addRowError(self::ERROR_PASSWORD_LENGTH, $rowNumber); } diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer/Address.php b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer/Address.php index 37333663570e049899d7bf17db25d7c640a65d08..b8bc661303bae6c32d6cb2b0f390860f73152a3c 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer/Address.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer/Address.php @@ -24,18 +24,14 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\ImportExport\Model\Import\Entity\Eav\Customer; + /** * Import entity customer address model * - * @category Magento - * @package Magento_ImportExport - * @author Magento Core Team <core@magentocommerce.com> - * * @todo finish moving dependencies to constructor in the scope of * @todo https://wiki.magento.com/display/MAGE2/Technical+Debt+%28Team-Donetsk-B%29 */ -namespace Magento\ImportExport\Model\Import\Entity\Eav\Customer; - class Address extends \Magento\ImportExport\Model\Import\Entity\Eav\AbstractCustomer { @@ -224,13 +220,18 @@ class Address */ protected $_addressFactory; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\App $app * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\Eav\Model\Config $eavConfig @@ -240,15 +241,16 @@ class Address * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Customer\Model\Resource\Address\CollectionFactory $addressColFactory * @param \Magento\Customer\Model\Resource\Address\Attribute\CollectionFactory $attributesFactory + * @param \Magento\Stdlib\DateTime $dateTime * @param array $data */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\App $app, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, @@ -258,12 +260,14 @@ class Address \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Customer\Model\Resource\Address\CollectionFactory $addressColFactory, \Magento\Customer\Model\Resource\Address\Attribute\CollectionFactory $attributesFactory, + \Magento\Stdlib\DateTime $dateTime, array $data = array() ) { $this->_customerFactory = $customerFactory; $this->_addressFactory = $addressFactory; $this->_eavConfig = $eavConfig; $this->_resourceHelper = $resourceHelper; + $this->dateTime = $dateTime; if (!isset($data['attribute_collection'])) { /** @var $attributeCollection \Magento\Customer\Model\Resource\Address\Attribute\Collection */ @@ -273,7 +277,7 @@ class Address $data['attribute_collection'] = $attributeCollection; } parent::__construct( - $coreData, $coreString, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $app, + $coreData, $string, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $app, $collectionFactory, $eavConfig, $storageFactory, $data ); @@ -469,7 +473,7 @@ class Address $value = $attributeParams['options'][strtolower($rowData[$attributeAlias])]; } elseif ('datetime' == $attributeParams['type']) { $value = new \DateTime('@' . strtotime($rowData[$attributeAlias])); - $value = $value->format(\Magento\Date::DATETIME_PHP_FORMAT); + $value = $value->format(\Magento\Stdlib\DateTime::DATETIME_PHP_FORMAT); } else { $value = $rowData[$attributeAlias]; } @@ -491,8 +495,8 @@ class Address 'entity_id' => $addressId, 'entity_type_id' => $this->getEntityTypeId(), 'parent_id' => $customerId, - 'created_at' => now(), - 'updated_at' => now() + 'created_at' => $this->dateTime->now(), + 'updated_at' => $this->dateTime->now() ); // attribute values diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php index a4a1ace7c8719b306e58127e531a6e458d818eae..05cf9bbc4402962ffbec9566ce39ed9fe69545c8 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php @@ -24,11 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\ImportExport\Model\Import\Entity; + /** * Import entity product model */ -namespace Magento\ImportExport\Model\Import\Entity; - class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity { const CONFIG_KEY_PRODUCT_TYPES = 'global/importexport/import_product_types'; @@ -391,13 +391,18 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity protected $_locale; /** - * @param \Magento\Core\Helper\String $coreString + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\ImportExport\Helper\Data $importExportData * @param \Magento\ImportExport\Model\Resource\Import\Data $importData * @param \Magento\Eav\Model\Config $config - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\String $string * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData * @param \Magento\Catalog\Helper\Data $catalogData @@ -417,21 +422,21 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param \Magento\CatalogInventory\Model\Resource\Stock\ItemFactory $stockResItemFac * @param \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\Stdlib\DateTime $dateTime * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Core\Helper\Data $coreData, \Magento\ImportExport\Helper\Data $importExportData, \Magento\ImportExport\Model\Resource\Import\Data $importData, \Magento\Eav\Model\Config $config, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\String $string, \Magento\Event\ManagerInterface $eventManager, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, \Magento\Catalog\Helper\Data $catalogData, \Magento\ImportExport\Model\Import\Config $importConfig, - \Magento\ImportExport\Model\Import\Proxy\Product\ResourceFactory $resourceFactory, \Magento\ImportExport\Model\Import\Entity\Product\OptionFactory $optionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setColFactory, @@ -447,6 +452,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity \Magento\CatalogInventory\Model\Resource\Stock\ItemFactory $stockResItemFac, \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory, \Magento\Core\Model\LocaleInterface $locale, + \Magento\Stdlib\DateTime $dateTime, array $data = array() ) { $this->_eventManager = $eventManager; @@ -467,8 +473,15 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $this->_stockResItemFac = $stockResItemFac; $this->_stockItemFactory = $stockItemFactory; $this->_locale = $locale; + $this->dateTime = $dateTime; parent::__construct( - $coreString, $coreData, $importExportData, $importData, $config, $resource, $resourceHelper + $coreData, + $importExportData, + $importData, + $config, + $resource, + $resourceHelper, + $string ); $this->_optionEntity = isset($data['option_entity']) ? $data['option_entity'] @@ -1097,7 +1110,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity // 1. Entity phase if (isset($this->_oldSku[$rowSku])) { // existing row $entityRowsUp[] = array( - 'updated_at' => now(), + 'updated_at' => $this->dateTime->now(), 'entity_id' => $this->_oldSku[$rowSku]['entity_id'] ); } else { // new row @@ -1107,8 +1120,8 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity 'attribute_set_id' => $this->_newSku[$rowSku]['attr_set_id'], 'type_id' => $this->_newSku[$rowSku]['type_id'], 'sku' => $rowSku, - 'created_at' => now(), - 'updated_at' => now() + 'created_at' => $this->dateTime->now(), + 'updated_at' => $this->dateTime->now() ); $productsQty++; } else { @@ -1225,7 +1238,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity if ('datetime' == $attribute->getBackendType() && strtotime($attrValue)) { $attrValue = new \DateTime('@' . strtotime($attrValue)); - $attrValue = $attrValue->format(\Magento\Date::DATETIME_PHP_FORMAT); + $attrValue = $attrValue->format(\Magento\Stdlib\DateTime::DATETIME_PHP_FORMAT); } elseif ($backModel) { $attribute->getBackend()->beforeSave($product); $attrValue = $product->getData($attribute->getAttributeCode()); @@ -1585,7 +1598,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity if ($stockItem->verifyNotification()) { $stockItem->setLowStockDate($this->_locale ->date(null, null, null, false) - ->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT) + ->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT) ); } $stockItem->setStockStatusChangedAuto((int) !$stockItem->verifyStock()); diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php index 8c95ecea555d7a3368242cd1660483dc65e6c1c6..51313f6938a715a56829f9591d52a405ba8989d0 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php @@ -270,7 +270,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity protected $_importFactory; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; @@ -294,9 +294,14 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity */ protected $_colIteratorFactory; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\ImportExport\Model\Resource\Import\Data $importData - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper * @param \Magento\Core\Model\StoreManagerInterface $_storeManager * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -304,13 +309,14 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $colIteratorFactory * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Stdlib\DateTime $dateTime * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\ImportExport\Model\Resource\Import\Data $importData, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, \Magento\Core\Model\StoreManagerInterface $_storeManager, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -318,6 +324,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $colIteratorFactory, \Magento\Catalog\Helper\Data $catalogData, \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Stdlib\DateTime $dateTime, array $data = array() ) { $this->_resource = $resource; @@ -328,6 +335,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $this->_optionColFactory = $optionColFactory; $this->_colIteratorFactory = $colIteratorFactory; $this->_coreStoreConfig = $coreStoreConfig; + $this->dateTime = $dateTime; if (isset($data['connection'])) { $this->_connection = $data['connection']; @@ -1269,7 +1277,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity 'entity_id' => $productId, 'has_options' => 1, 'required_options' => 0, - 'updated_at' => \Magento\Date::now(), + 'updated_at' => $this->dateTime->now(), ); if (!empty($rowData[self::COLUMN_IS_REQUIRED])) { diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Configurable.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Configurable.php index a90eba0826750810039141fe905a99b4671fc06d..244cf30a12510a3048012bd7603d53a249bdd4c2 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Configurable.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Configurable.php @@ -141,7 +141,7 @@ class Configurable protected $_resourceHelper; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; @@ -155,7 +155,7 @@ class Configurable * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypesConfig * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $_productColFac * @param array $params */ @@ -164,7 +164,7 @@ class Configurable \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypesConfig, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Catalog\Model\Resource\Product\CollectionFactory $_productColFac, array $params ) { diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php index 9cdc9ebc42216ede7e608c6a9c77bcec2a797103..9aa8c2eaa068f7b1bf2cc0df4defffa7a57d36b5 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php @@ -58,7 +58,7 @@ class Grouped protected $_importFactory; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; @@ -72,7 +72,7 @@ class Grouped * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\Catalog\Model\Resource\Product\LinkFactory $productLinkFactory - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param array $params */ public function __construct( @@ -80,7 +80,7 @@ class Grouped \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\Catalog\Model\Resource\Product\LinkFactory $productLinkFactory, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, array $params ) { diff --git a/app/code/Magento/ImportExport/Model/Resource/Helper.php b/app/code/Magento/ImportExport/Model/Resource/Helper.php index 193d7dffc871089841ecf09d326266e51a853113..ce44302ff9fe1f1795583b32438e64895a141785 100644 --- a/app/code/Magento/ImportExport/Model/Resource/Helper.php +++ b/app/code/Magento/ImportExport/Model/Resource/Helper.php @@ -43,11 +43,11 @@ class Helper extends \Magento\Core\Model\Resource\Helper const DB_MAX_PACKET_COEFFICIENT = 0.85; // The coefficient of useful data from maximum packet length /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param string $modulePrefix */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, $modulePrefix = 'importexport' ) { parent::__construct($resource, $modulePrefix); diff --git a/app/code/Magento/ImportExport/Model/Resource/Import/CustomerComposite/Data.php b/app/code/Magento/ImportExport/Model/Resource/Import/CustomerComposite/Data.php index 1aa42532d9e4abe14b95ab5a013a3ebc7b185e88..fbfb396cf8bf169c2cbec3a5afbf072b67269ffd 100644 --- a/app/code/Magento/ImportExport/Model/Resource/Import/CustomerComposite/Data.php +++ b/app/code/Magento/ImportExport/Model/Resource/Import/CustomerComposite/Data.php @@ -33,8 +33,7 @@ */ namespace Magento\ImportExport\Model\Resource\Import\CustomerComposite; -class Data - extends \Magento\ImportExport\Model\Resource\Import\Data +class Data extends \Magento\ImportExport\Model\Resource\Import\Data { /** * Entity type @@ -53,12 +52,12 @@ class Data /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Helper\Data $coreHelper * @param array $arguments */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Helper\Data $coreHelper, array $arguments = array() ) { diff --git a/app/code/Magento/ImportExport/Model/Resource/Import/Data.php b/app/code/Magento/ImportExport/Model/Resource/Import/Data.php index 4039df5fb588f239bf4db066e0f0eb074fdef2a1..15feab6f062db0e1868ed78d5ca3046d816a4cc2 100644 --- a/app/code/Magento/ImportExport/Model/Resource/Import/Data.php +++ b/app/code/Magento/ImportExport/Model/Resource/Import/Data.php @@ -52,11 +52,11 @@ class Data /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Helper\Data $coreHelper * @param array $arguments */ - public function __construct(\Magento\Core\Model\Resource $resource, + public function __construct(\Magento\App\Resource $resource, \Magento\Core\Helper\Data $coreHelper, array $arguments = array() ) { diff --git a/app/code/Magento/ImportExport/etc/import.xml b/app/code/Magento/ImportExport/etc/import.xml index 9073275c93d40ae6298e4484e0048c55da0ac9d4..03b8facff1497141a75dbee6ac286abbb945cdb4 100644 --- a/app/code/Magento/ImportExport/etc/import.xml +++ b/app/code/Magento/ImportExport/etc/import.xml @@ -25,8 +25,8 @@ --> <config> <entity name="catalog_product" label="Products" model="Magento\ImportExport\Model\Import\Entity\Product" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" /> - <entity name="customer_composite" label="Customers Main File" model="Magento\ImportExport\Model\Import\Entity\CustomerComposite" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" /> - <entity name="customer" label="Customers" model="Magento\ImportExport\Model\Import\Entity\Eav\Customer" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Custom" /> + <entity name="customer_composite" label="Customers" model="Magento\ImportExport\Model\Import\Entity\CustomerComposite" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" /> + <entity name="customer" label="Customers Main File" model="Magento\ImportExport\Model\Import\Entity\Eav\Customer" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Custom" /> <entity name="customer_address" label="Customer Addresses" model="Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Custom" /> <productType name="simple" model="Magento\ImportExport\Model\Import\Entity\Product\Type\Simple" /> <productType name="configurable" model="Magento\ImportExport\Model\Import\Entity\Product\Type\Configurable" /> diff --git a/app/code/Magento/Index/Model/EntryPoint/Indexer.php b/app/code/Magento/Index/App/Indexer.php similarity index 71% rename from app/code/Magento/Index/Model/EntryPoint/Indexer.php rename to app/code/Magento/Index/App/Indexer.php index 9b5292055dd53a8dcce4f40e7ee2c046a790b657..6278facb48f57d18683813177f35bfc2630cc950 100644 --- a/app/code/Magento/Index/Model/EntryPoint/Indexer.php +++ b/app/code/Magento/Index/App/Indexer.php @@ -1,5 +1,7 @@ <?php /** + * Indexer application + * * Magento * * NOTICE OF LICENSE @@ -21,9 +23,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Index\Model\EntryPoint; +namespace Magento\Index\App; + +use Magento\AppInterface, + Magento\Filesystem; -class Indexer extends \Magento\Core\Model\AbstractEntryPoint +class Indexer implements AppInterface { /** * Report directory @@ -38,38 +43,45 @@ class Indexer extends \Magento\Core\Model\AbstractEntryPoint protected $_filesystem; /** - * @param string $reportDir absolute path to report directory to be cleaned - * @param \Magento\Filesystem $filesystem - * @param \Magento\Core\Model\Config\Primary $config - * @param \Magento\ObjectManager $objectManager + * @var Magento\Index\Model\IndexerFactory + */ + protected $_indexerFactory; + + /** + * @param string $reportDir + * @param Filesystem $filesystem + * @param \Magento\Index\Model\IndexerFactory $indexerFactory */ public function __construct( $reportDir, - \Magento\Filesystem $filesystem, - \Magento\Core\Model\Config\Primary $config, - \Magento\ObjectManager $objectManager = null + Filesystem $filesystem, + \Magento\Index\Model\IndexerFactory $indexerFactory ) { - parent::__construct($config, $objectManager); $this->_reportDir = $reportDir; $this->_filesystem = $filesystem; + $this->_indexerFactory = $indexerFactory; } /** - * Process request to application + * Run application + * + * @return int */ - protected function _processRequest() + public function execute() { /* Clean reports */ $this->_filesystem->delete($this->_reportDir, dirname($this->_reportDir)); /* Run all indexer processes */ /** @var $indexer \Magento\Index\Model\Indexer */ - $indexer = $this->_objectManager->create('Magento\Index\Model\Indexer'); + $indexer = $this->_indexerFactory->create(); /** @var $process \Magento\Index\Model\Process */ foreach ($indexer->getProcessesCollection() as $process) { if ($process->getIndexer()->isVisible()) { $process->reindexEverything(); } } + return 0; } } + diff --git a/app/code/Magento/Index/Model/EntryPoint/Shell.php b/app/code/Magento/Index/App/Shell.php similarity index 62% rename from app/code/Magento/Index/Model/EntryPoint/Shell.php rename to app/code/Magento/Index/App/Shell.php index c8104c01b90adcf9f50a2f57f8211667e27fc808..c00c43af8e4eb49f594f9d5cd36ef2ef5f801539 100644 --- a/app/code/Magento/Index/Model/EntryPoint/Shell.php +++ b/app/code/Magento/Index/App/Shell.php @@ -1,5 +1,7 @@ <?php /** + * Index shell application + * * Magento * * NOTICE OF LICENSE @@ -21,9 +23,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Index\Model\EntryPoint; +namespace Magento\Index\App; + +use Magento\AppInterface, + Magento\Index\App\Shell\ErrorHandler; -class Shell extends \Magento\Core\Model\AbstractEntryPoint +class Shell implements AppInterface { /** * Filename of the entry point script @@ -33,38 +38,43 @@ class Shell extends \Magento\Core\Model\AbstractEntryPoint protected $_entryFileName; /** - * @var \Magento\Index\Model\EntryPoint\Shell\ErrorHandler + * @var \Magento\Index\App\Shell\ErrorHandler */ protected $_errorHandler; /** - * @param string $entryFileName filename of the entry point script - * @param \Magento\Index\Model\EntryPoint\Shell\ErrorHandler $errorHandler - * @param \Magento\Core\Model\Config\Primary $config - * @param \Magento\ObjectManager $objectManager + * @var \Magento\Index\Model\ShellFactory + */ + protected $_shellFactory; + + /** + * @param string $entryFileName + * @param \Magento\Index\Model\ShellFactory $shellFactory + * @param ErrorHandler $errorHandler */ public function __construct( $entryFileName, - \Magento\Index\Model\EntryPoint\Shell\ErrorHandler $errorHandler, - \Magento\Core\Model\Config\Primary $config, - \Magento\ObjectManager $objectManager = null + \Magento\Index\Model\ShellFactory $shellFactory, + ErrorHandler $errorHandler ) { - parent::__construct($config, $objectManager); $this->_entryFileName = $entryFileName; + $this->_shellFactory = $shellFactory; $this->_errorHandler = $errorHandler; } /** - * Process request to application + * Run application + * + * @return int */ - protected function _processRequest() + public function execute() { /** @var $shell \Magento\Index\Model\Shell */ - $shell = $this->_objectManager - ->create('Magento\Index\Model\Shell', array('entryPoint' => $this->_entryFileName)); + $shell = $this->_shellFactory->create(array('entryPoint' => $this->_entryFileName)); $shell->run(); if ($shell->hasErrors()) { $this->_errorHandler->terminate(1); } + return 0; } } diff --git a/app/code/Magento/Index/Model/EntryPoint/Shell/ErrorHandler.php b/app/code/Magento/Index/App/Shell/ErrorHandler.php similarity index 96% rename from app/code/Magento/Index/Model/EntryPoint/Shell/ErrorHandler.php rename to app/code/Magento/Index/App/Shell/ErrorHandler.php index c6295eb519c73db32edbea16aee5210458b8069a..beb743b8d8ad9d0ffa5aace0f9c86ed6776b7799 100644 --- a/app/code/Magento/Index/Model/EntryPoint/Shell/ErrorHandler.php +++ b/app/code/Magento/Index/App/Shell/ErrorHandler.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Index\Model\EntryPoint\Shell; +namespace Magento\Index\App\Shell; class ErrorHandler { diff --git a/app/code/Magento/Index/Model/Event.php b/app/code/Magento/Index/Model/Event.php index ee8c83c05d77f29e0befe6afcdd33a694a61c2ec..288a95943f7eb532baf834148ecd9ab5ee4c9d9b 100644 --- a/app/code/Magento/Index/Model/Event.php +++ b/app/code/Magento/Index/Model/Event.php @@ -76,10 +76,16 @@ class Event extends \Magento\Core\Model\AbstractModel */ protected $_indexer; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -88,11 +94,13 @@ class Event extends \Magento\Core\Model\AbstractModel \Magento\Index\Model\Indexer $indexer, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_indexer = $indexer; + $this->dateTime = $dateTime; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -360,7 +368,7 @@ class Event extends \Magento\Core\Model\AbstractModel $newData = $this->getNewData(false); $this->setNewData(serialize($newData)); if (!$this->hasCreatedAt()) { - $this->setCreatedAt($this->_getResource()->formatDate(time(), true)); + $this->setCreatedAt($this->dateTime->formatDate(time(), true)); } return parent::_beforeSave(); } diff --git a/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php b/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php index 00c0c4be4566cf6170cc1dfe17df89899102b07d..56f3ec2357f62ba1c6f7d9dae19442a8eb40b117 100644 --- a/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php +++ b/app/code/Magento/Index/Model/Indexer/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Index') . DIRECTORY_SEPARATOR . 'indexers_merged.xsd'; diff --git a/app/code/Magento/Index/Model/Resource/Process.php b/app/code/Magento/Index/Model/Resource/Process.php index 14b1d9c71f7dfe55c21f370a4342b6f37e9516f4..de08adb9416398cbbfc83d28d01e73fe4c8293ee 100644 --- a/app/code/Magento/Index/Model/Resource/Process.php +++ b/app/code/Magento/Index/Model/Resource/Process.php @@ -36,9 +36,23 @@ namespace Magento\Index\Model\Resource; class Process extends \Magento\Core\Model\Resource\Db\AbstractDb { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\App\Resource $resource + */ + public function __construct(\Magento\Stdlib\DateTime $dateTime, \Magento\App\Resource $resource) + { + $this->dateTime = $dateTime; + parent::__construct($resource); + } + /** * Initialize table and table pk - * */ protected function _construct() { @@ -74,7 +88,7 @@ class Process extends \Magento\Core\Model\Resource\Db\AbstractDb { $data = array( 'status' => \Magento\Index\Model\Process::STATUS_PENDING, - 'ended_at' => $this->formatDate(time()), + 'ended_at' => $this->dateTime->formatDate(time()), ); $this->_updateProcessData($process->getId(), $data); return $this; @@ -90,7 +104,7 @@ class Process extends \Magento\Core\Model\Resource\Db\AbstractDb { $data = array( 'status' => \Magento\Index\Model\Process::STATUS_RUNNING, - 'started_at' => $this->formatDate(time()), + 'started_at' => $this->dateTime->formatDate(time()), ); $this->_updateProcessData($process->getId(), $data); return $this; @@ -106,7 +120,7 @@ class Process extends \Magento\Core\Model\Resource\Db\AbstractDb { $data = array( 'status' => \Magento\Index\Model\Process::STATUS_REQUIRE_REINDEX, - 'ended_at' => $this->formatDate(time()), + 'ended_at' => $this->dateTime->formatDate(time()), ); $this->_updateProcessData($process->getId(), $data); return $this; @@ -149,7 +163,7 @@ class Process extends \Magento\Core\Model\Resource\Db\AbstractDb */ public function updateProcessStartDate(\Magento\Index\Model\Process $process) { - $this->_updateProcessData($process->getId(), array('started_at' => $this->formatDate(time()))); + $this->_updateProcessData($process->getId(), array('started_at' => $this->dateTime->formatDate(time()))); return $this; } @@ -161,7 +175,7 @@ class Process extends \Magento\Core\Model\Resource\Db\AbstractDb */ public function updateProcessEndDate(\Magento\Index\Model\Process $process) { - $this->_updateProcessData($process->getId(), array('ended_at' => $this->formatDate(time()))); + $this->_updateProcessData($process->getId(), array('ended_at' => $this->dateTime->formatDate(time()))); return $this; } diff --git a/app/code/Magento/Index/etc/di.xml b/app/code/Magento/Index/etc/di.xml index ed8c9c225cbb83e81f14b58a1374333e3c3f2476..3ee825bf052bb26ee02a3bb88eb78973c928fc36 100644 --- a/app/code/Magento/Index/etc/di.xml +++ b/app/code/Magento/Index/etc/di.xml @@ -25,7 +25,7 @@ --> <config> <preference for="Magento\Index\Model\Indexer\ConfigInterface" type="Magento\Index\Model\Indexer\Config" /> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <index_setup>Magento\Index\Model\Resource\Setup</index_setup> diff --git a/app/code/Magento/Install/Model/EntryPoint/Console.php b/app/code/Magento/Install/App/Console.php similarity index 50% rename from app/code/Magento/Install/Model/EntryPoint/Console.php rename to app/code/Magento/Install/App/Console.php index 4901c562be5c4bd1b9a9b9a1c2073cf9d9e861f7..2a838aec034523b05c5d58c9f01ca1c340713a3a 100644 --- a/app/code/Magento/Install/Model/EntryPoint/Console.php +++ b/app/code/Magento/Install/App/Console.php @@ -1,6 +1,6 @@ <?php /** - * Console entry point + * Console application * * Magento * @@ -23,83 +23,79 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Install\Model\EntryPoint; +namespace Magento\Install\App; -class Console extends \Magento\Core\Model\AbstractEntryPoint +class Console implements \Magento\AppInterface { /** - * Application params - * - * @var array + * @var \Magento\Install\Model\Installer\ConsoleFactory + */ + protected $_installerFactory; + + /** @var array */ + protected $_arguments; + + /** @var \Magento\Install\App\Output */ + protected $_output; + + /** + * @var \Magento\App\ObjectManager\ConfigLoader */ - protected $_params = array(); + protected $_loader; /** - * @param \Magento\Core\Model\Config\Primary $baseDir - * @param array $params - * @param \Magento\Core\Model\Config\Primary $config + * @var \Magento\App\State + */ + protected $_state; + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + /** + * @param \Magento\Install\Model\Installer\ConsoleFactory $installerFactory + * @param Output $output + * @param \Magento\App\State $state + * @param \Magento\App\ObjectManager\ConfigLoader $loader * @param \Magento\ObjectManager $objectManager - * @param \Magento\Install\Model\EntryPoint\Output $output + * @param array $arguments */ public function __construct( - $baseDir, - array $params = array(), - \Magento\Core\Model\Config\Primary $config = null, - \Magento\ObjectManager $objectManager = null, - \Magento\Install\Model\EntryPoint\Output $output = null + \Magento\Install\Model\Installer\ConsoleFactory $installerFactory, + \Magento\Install\App\Output $output, + \Magento\App\State $state, + \Magento\App\ObjectManager\ConfigLoader $loader, + \Magento\ObjectManager $objectManager, + array $arguments = array() ) { - $this->_params = $this->_buildInitParams($params); - if (!$config) { - $config = new \Magento\Core\Model\Config\Primary($baseDir, $this->_params); - } - $this->_output = $output ?: new \Magento\Install\Model\EntryPoint\Output(); - parent::__construct($config, $objectManager); + $this->_loader = $loader; + $this->_state = $state; + $this->_installerFactory = $installerFactory; + $this->_arguments = $this->_buildInitArguments($arguments); + $this->_output = $output; + $this->_objectManager = $objectManager; } /** - * Customize application init parameters + * Customize application init arguments * * @param array $args * @return array */ - protected function _buildInitParams(array $args) + protected function _buildInitArguments(array $args) { if (!empty($args[\Magento\Install\Model\Installer\Console::OPTION_URIS])) { - $args[\Magento\Core\Model\App::PARAM_APP_URIS] = + $args[\Magento\App\Dir::PARAM_APP_URIS] = unserialize(base64_decode($args[\Magento\Install\Model\Installer\Console::OPTION_URIS])); } if (!empty($args[\Magento\Install\Model\Installer\Console::OPTION_DIRS])) { - $args[\Magento\Core\Model\App::PARAM_APP_DIRS] = + $args[\Magento\App\Dir::PARAM_APP_DIRS] = unserialize(base64_decode($args[\Magento\Install\Model\Installer\Console::OPTION_DIRS])); } return $args; } - /** - * Run http application - */ - protected function _processRequest() - { - /** - * @var $installer \Magento\Install\Model\Installer\Console - */ - $installer = $this->_objectManager->create( - 'Magento\Install\Model\Installer\Console', - array('installArgs' => $this->_params) - ); - if (isset($this->_params['show_locales'])) { - $this->_output->export($installer->getAvailableLocales()); - } else if (isset($this->_params['show_currencies'])) { - $this->_output->export($installer->getAvailableCurrencies()); - } else if (isset($this->_params['show_timezones'])) { - $this->_output->export($installer->getAvailableTimezones()); - } else if (isset($this->_params['show_install_options'])) { - $this->_output->export($installer->getAvailableInstallOptions()); - } else { - $this->_handleInstall($installer); - } - } - /** * Install/Uninstall application * @@ -107,21 +103,20 @@ class Console extends \Magento\Core\Model\AbstractEntryPoint */ protected function _handleInstall(\Magento\Install\Model\Installer\Console $installer) { - if (isset($this->_params['config']) && file_exists($this->_params['config'])) { - $config = (array) include($this->_params['config']); - $this->_params = array_merge((array)$config, $this->_params); + if (isset($this->_arguments['config']) && file_exists($this->_arguments['config'])) { + $config = (array) include($this->_arguments['config']); + $this->_arguments = array_merge((array)$config, $this->_arguments); } - $isUninstallMode = isset($this->_params['uninstall']); + $isUninstallMode = isset($this->_arguments['uninstall']); if ($isUninstallMode) { $result = $installer->uninstall(); } else { - $result = $installer->install($this->_params); + $result = $installer->install($this->_arguments); } if (!$installer->hasErrors()) { if ($isUninstallMode) { - $msg = $result ? - 'Uninstalled successfully' : - 'Ignoring attempt to uninstall non-installed application'; + $msg = $result ? 'Uninstalled successfully' + : 'Ignoring attempt to uninstall non-installed application'; } else { $msg = 'Installed successfully' . ($result ? ' (encryption key "' . $result . '")' : ''); } @@ -130,4 +125,29 @@ class Console extends \Magento\Core\Model\AbstractEntryPoint $this->_output->error(implode(PHP_EOL, $installer->getErrors()) . PHP_EOL); } } + + /** + * Execute application + * @return int + */ + public function execute() + { + $areaCode = 'install'; + $this->_state->setAreaCode($areaCode); + $this->_objectManager->configure($this->_loader->load($areaCode)); + + $installer = $this->_installerFactory->create(array('installArgs' => $this->_arguments)); + if (isset($this->_arguments['show_locales'])) { + $this->_output->export($installer->getAvailableLocales()); + } else if (isset($this->_arguments['show_currencies'])) { + $this->_output->export($installer->getAvailableCurrencies()); + } else if (isset($this->_arguments['show_timezones'])) { + $this->_output->export($installer->getAvailableTimezones()); + } else if (isset($this->_arguments['show_install_options'])) { + $this->_output->export($installer->getAvailableInstallOptions()); + } else { + $this->_handleInstall($installer); + } + return 0; + } } diff --git a/app/code/Magento/Install/Model/EntryPoint/Output.php b/app/code/Magento/Install/App/Output.php similarity index 97% rename from app/code/Magento/Install/Model/EntryPoint/Output.php rename to app/code/Magento/Install/App/Output.php index 041da09429c0ab71373bcfc6853d49c2ea32f471..122108a67788395ba3453d92a6cbcffb4c4a2423 100644 --- a/app/code/Magento/Install/Model/EntryPoint/Output.php +++ b/app/code/Magento/Install/App/Output.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Install\Model\EntryPoint; +namespace Magento\Install\App; class Output { diff --git a/app/code/Magento/Install/Block/Download.php b/app/code/Magento/Install/Block/Download.php index d7ce3d16414a03e5f72f3672376e7ae3cd77e862..bd7b215abd92cdfedb3fd22526abdfb0d831dcef 100644 --- a/app/code/Magento/Install/Block/Download.php +++ b/app/code/Magento/Install/Block/Download.php @@ -39,9 +39,9 @@ class Download extends \Magento\Install\Block\AbstractBlock protected $_template = 'download.phtml'; /** - * @var \Magento\Core\Model\Config + * @var \Magento\Module\Dir\Reader */ - protected $_coreConfig; + protected $_moduleReader; /** * @param \Magento\Core\Helper\Data $coreData @@ -49,7 +49,7 @@ class Download extends \Magento\Install\Block\AbstractBlock * @param \Magento\Install\Model\Installer $installer * @param \Magento\Install\Model\Wizard $installWizard * @param \Magento\Core\Model\Session\Generic $session - * @param \Magento\Core\Model\Config $coreConfig + * @param \Magento\Module\Dir\Reader $moduleReader * @param array $data */ public function __construct( @@ -58,11 +58,11 @@ class Download extends \Magento\Install\Block\AbstractBlock \Magento\Install\Model\Installer $installer, \Magento\Install\Model\Wizard $installWizard, \Magento\Core\Model\Session\Generic $session, - \Magento\Core\Model\Config $coreConfig, + \Magento\Module\Dir\Reader $moduleReader, array $data = array() ) { parent::__construct($coreData, $context, $installer, $installWizard, $session, $data); - $this->_coreConfig = $coreConfig; + $this->_moduleReader = $moduleReader; } /** @@ -90,7 +90,7 @@ class Download extends \Magento\Install\Block\AbstractBlock */ public function hasLocalCopy() { - $dir = $this->_coreConfig->getModuleDir('etc', 'Magento_Adminhtml'); + $dir = $this->_moduleReader->getModuleDir('etc', 'Magento_Adminhtml'); if ($dir && $this->_filesystem->isDirectory($dir)) { return true; } diff --git a/app/code/Magento/Install/Controller/Index.php b/app/code/Magento/Install/Controller/Index.php index b7169cfa109cd35b71cbd8e829e619502b3aac91..0a57e7066f4b50ed37480ddaaf1d36fea6141043 100644 --- a/app/code/Magento/Install/Controller/Index.php +++ b/app/code/Magento/Install/Controller/Index.php @@ -80,6 +80,6 @@ class Index extends \Magento\Install\Controller\Action */ public function indexAction() { - $this->_forward('begin', 'wizard', 'install'); + $this->_redirect('install/wizard/begin'); } } diff --git a/app/code/Magento/Install/Controller/Wizard.php b/app/code/Magento/Install/Controller/Wizard.php index 363d8b6fc9e1480530df1c01fef563076de0b7da..20f8e0db71c06db497c4462179b7b50ce193b0d4 100644 --- a/app/code/Magento/Install/Controller/Wizard.php +++ b/app/code/Magento/Install/Controller/Wizard.php @@ -55,7 +55,7 @@ class Wizard extends \Magento\Install\Controller\Action /** * DB Updater * - * @var \Magento\App\UpdaterInterface + * @var \Magento\Module\UpdaterInterface */ protected $_dbUpdater; @@ -76,7 +76,7 @@ class Wizard extends \Magento\Install\Controller\Action * @param \Magento\Install\Model\Installer $installer * @param \Magento\Install\Model\Wizard $wizard * @param \Magento\Core\Model\Session\Generic $session - * @param \Magento\App\UpdaterInterface $dbUpdater + * @param \Magento\Module\UpdaterInterface $dbUpdater * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( @@ -89,7 +89,7 @@ class Wizard extends \Magento\Install\Controller\Action \Magento\Install\Model\Installer $installer, \Magento\Install\Model\Wizard $wizard, \Magento\Core\Model\Session\Generic $session, - \Magento\App\UpdaterInterface $dbUpdater, + \Magento\Module\UpdaterInterface $dbUpdater, \Magento\Core\Model\StoreManagerInterface $storeManager ) { parent::__construct($context, $configScope, $viewDesign, $collectionFactory, $app, $appState); @@ -180,7 +180,7 @@ class Wizard extends \Magento\Install\Controller\Action */ public function indexAction() { - $this->_forward('begin'); + $this->_redirect('*/*/begin'); } /** diff --git a/app/code/Magento/Install/Model/Config/SchemaLocator.php b/app/code/Magento/Install/Model/Config/SchemaLocator.php index 6f71cd94ef47a5c843338d4c50870fe30f87a9a8..825709ac496bc85114cc79e895ab0ed27378a075 100644 --- a/app/code/Magento/Install/Model/Config/SchemaLocator.php +++ b/app/code/Magento/Install/Model/Config/SchemaLocator.php @@ -43,9 +43,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Install') . '/install_wizard.xsd'; $this->_perFileSchema = $moduleReader->getModuleDir('etc', 'Magento_Install') . '/install_wizard_file.xsd'; diff --git a/app/code/Magento/Install/Model/EntryPoint/Upgrade.php b/app/code/Magento/Install/Model/EntryPoint/Upgrade.php deleted file mode 100644 index 3c357ab43d8fdc021c52c4b7bdc27dcd38a097f1..0000000000000000000000000000000000000000 --- a/app/code/Magento/Install/Model/EntryPoint/Upgrade.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Entry point for upgrading application - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Install\Model\EntryPoint; - -class Upgrade extends \Magento\Core\Model\AbstractEntryPoint -{ - /** - * Key for passing reindexing parameter - */ - const REINDEX = 'reindex'; - - /**@#+ - * Reindexing modes - */ - const REINDEX_INVALID = 1; - const REINDEX_ALL = 2; - /**@#-*/ - - /** - * Apply scheme & data updates - */ - protected function _processRequest() - { - /** @var $cacheFrontendPool \Magento\Core\Model\Cache\Frontend\Pool */ - $cacheFrontendPool = $this->_objectManager->get('Magento\Core\Model\Cache\Frontend\Pool'); - /** @var $cacheFrontend \Magento\Cache\FrontendInterface */ - foreach ($cacheFrontendPool as $cacheFrontend) { - $cacheFrontend->clean(); - } - - /** @var $updater \Magento\App\Updater */ - $updater = $this->_objectManager->get('Magento\App\Updater'); - $updater->updateScheme(); - $updater->updateData(); - - $this->_reindex(); - } - - /** - * Perform reindexing if requested - */ - private function _reindex() - { - /** @var $config \Magento\Core\Model\Config\Primary */ - $config = $this->_objectManager->get('Magento\Core\Model\Config\Primary'); - $reindexMode = $config->getParam(self::REINDEX); - if ($reindexMode) { - /** @var $indexer \Magento\Index\Model\Indexer */ - $indexer = $this->_objectManager->get('Magento\Index\Model\Indexer'); - if (self::REINDEX_ALL == $reindexMode) { - $indexer->reindexAll(); - } elseif (self::REINDEX_INVALID == $reindexMode) { - $indexer->reindexRequired(); - } - } - } -} diff --git a/app/code/Magento/Install/Model/Installer.php b/app/code/Magento/Install/Model/Installer.php index 2931e96ed3efde85a3a6064b546bd3fedee56a0d..f295f4415fddbf7cbdc4ff94ab17a5632b4a5d2d 100644 --- a/app/code/Magento/Install/Model/Installer.php +++ b/app/code/Magento/Install/Model/Installer.php @@ -42,14 +42,14 @@ class Installer extends \Magento\Object /** * DB updated model * - * @var \Magento\App\UpdaterInterface + * @var \Magento\Module\UpdaterInterface */ protected $_dbUpdater; /** * Application chache model * - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; @@ -78,17 +78,10 @@ class Installer extends \Magento\Object protected $_coreData = null; /** - * @var \Magento\App\Updater\SetupFactory + * @var \Magento\Module\Updater\SetupFactory */ protected $_setupFactory; - /** - * Core Primary config - * - * @var \Magento\Core\Model\Config\Primary - */ - protected $_primaryConfig; - /** * Install installer pear * @@ -152,37 +145,49 @@ class Installer extends \Magento\Object */ protected $_session; + /** @var \Magento\App\Resource */ + protected $_resource; + + /** + * @var \Magento\Encryption\EncryptorInterface + */ + protected $_encryptor; + + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + /** - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\ConfigInterface $config - * @param \Magento\App\UpdaterInterface $dbUpdater - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\Module\UpdaterInterface $dbUpdater + * @param \Magento\App\CacheInterface $cache * @param \Magento\Core\Model\Cache\TypeListInterface $cacheTypeList * @param \Magento\Core\Model\Cache\StateInterface $cacheState - * @param \Magento\App\Updater\SetupFactory $setupFactory - * @param \Magento\Core\Model\Config\Primary $primaryConfig - * @param \Magento\Core\Model\Config\Local $localConfig + * @param \Magento\Module\Updater\SetupFactory $setupFactory + * @param \Magento\App\Config $localConfig * @param \Magento\Core\Model\App $app * @param \Magento\App\State $appState * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\User\Model\UserFactory $userModelFactory - * @param \Magento\Install\Model\Installer\Filesystem $filesystem - * @param \Magento\Install\Model\Installer\Pear $installerPear - * @param \Magento\Install\Model\Installer\Db $installerDb - * @param \Magento\Install\Model\Installer\Config $installerConfig + * @param Installer\Filesystem $filesystem + * @param Installer\Pear $installerPear + * @param Installer\Db $installerDb + * @param Installer\Config $installerConfig * @param \Magento\Core\Model\Session\Generic $session + * @param \Magento\Encryption\EncryptorInterface $encryptor + * @param \Magento\Math\Random $mathRandom + * @param \Magento\App\Resource $resource * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\ConfigInterface $config, - \Magento\App\UpdaterInterface $dbUpdater, - \Magento\Core\Model\CacheInterface $cache, + \Magento\Module\UpdaterInterface $dbUpdater, + \Magento\App\CacheInterface $cache, \Magento\Core\Model\Cache\TypeListInterface $cacheTypeList, \Magento\Core\Model\Cache\StateInterface $cacheState, - \Magento\App\Updater\SetupFactory $setupFactory, - \Magento\Core\Model\Config\Primary $primaryConfig, - \Magento\Core\Model\Config\Local $localConfig, + \Magento\Module\Updater\SetupFactory $setupFactory, + \Magento\App\Config $localConfig, \Magento\Core\Model\App $app, \Magento\App\State $appState, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -192,17 +197,20 @@ class Installer extends \Magento\Object \Magento\Install\Model\Installer\Db $installerDb, \Magento\Install\Model\Installer\Config $installerConfig, \Magento\Core\Model\Session\Generic $session, + \Magento\Encryption\EncryptorInterface $encryptor, + \Magento\Math\Random $mathRandom, + \Magento\App\Resource $resource, array $data = array() ) { - $this->_coreData = $coreData; $this->_dbUpdater = $dbUpdater; $this->_config = $config; $this->_cache = $cache; $this->_cacheState = $cacheState; $this->_cacheTypeList = $cacheTypeList; $this->_setupFactory = $setupFactory; + $this->_encryptor = $encryptor; + $this->mathRandom = $mathRandom; parent::__construct($data); - $this->_primaryConfig = $primaryConfig; $this->_localConfig = $localConfig; $this->_app = $app; $this->_appState = $appState; @@ -213,6 +221,7 @@ class Installer extends \Magento\Object $this->_installerDb = $installerDb; $this->_installerConfig = $installerConfig; $this->_session = $session; + $this->_resource = $resource; } /** @@ -314,10 +323,10 @@ class Installer extends \Magento\Object ->setConfigData($data) ->install(); - $this->_primaryConfig->reinit(); $this->_localConfig->reload(); + $this->_resource->setTablePrefix($data['db_prefix']); - $this->_config->reloadConfig(); + $this->_config->reinit(); return $this; } @@ -424,7 +433,7 @@ class Installer extends \Magento\Object { // \Magento\User\Model\User belongs to adminhtml area $this->_app - ->loadAreaPart(\Magento\Core\Model\App\Area::AREA_ADMINHTML, \Magento\Core\Model\App\Area::PART_CONFIG); + ->loadAreaPart(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \Magento\Core\Model\App\Area::PART_CONFIG); /** @var $user \Magento\User\Model\User */ $user = $this->_userModelFactory->create(); @@ -444,7 +453,7 @@ class Installer extends \Magento\Object */ public function installEncryptionKey($key) { - $this->_coreData->validateKey($key); + $this->_encryptor->validateKey($key); $this->_installerConfig->replaceTmpEncryptKey($key); $this->_refreshConfig(); return $this; @@ -459,9 +468,9 @@ class Installer extends \Magento\Object public function getValidEncryptionKey($key = null) { if (!$key) { - $key = md5($this->_coreData->getRandomString(10)); + $key = md5($this->mathRandom->getRandomString(10)); } - $this->_coreData->validateKey($key); + $this->_encryptor->validateKey($key); return $key; } @@ -472,11 +481,9 @@ class Installer extends \Magento\Object { $this->_installerConfig->replaceTmpInstallDate(); - $this->_primaryConfig->reinit(); - $this->_refreshConfig(); - $this->_config->reloadConfig(); + $this->_config->reinit(); /* Enable all cache types */ foreach (array_keys($this->_cacheTypeList->getTypes()) as $cacheTypeCode) { diff --git a/app/code/Magento/Install/Model/Installer/Console.php b/app/code/Magento/Install/Model/Installer/Console.php index e6f031c5e27969c240988bcb7c4fdb3a178639bb..22d41dcbdc30dcc8e5615a334c28e1df6a4145ea 100644 --- a/app/code/Magento/Install/Model/Installer/Console.php +++ b/app/code/Magento/Install/Model/Installer/Console.php @@ -89,14 +89,14 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller /** * Resource config * - * @var \Magento\Core\Model\Config\Resource + * @var \Magento\App\Resource\Config */ protected $_resourceConfig; /** * DB updater * - * @var \Magento\App\UpdaterInterface + * @var \Magento\Module\UpdaterInterface */ protected $_dbUpdater; @@ -137,8 +137,8 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller /** * @param \Magento\Install\Model\Installer $installer - * @param \Magento\Core\Model\Config\Resource $resourceConfig - * @param \Magento\App\UpdaterInterface $dbUpdater + * @param \Magento\App\Resource\Config $resourceConfig + * @param \Magento\Module\UpdaterInterface $dbUpdater * @param \Magento\Filesystem $filesystem * @param \Magento\Install\Model\Installer\Data $installerData * @param \Magento\App\State $appState @@ -148,8 +148,8 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller */ public function __construct( \Magento\Install\Model\Installer $installer, - \Magento\Core\Model\Config\Resource $resourceConfig, - \Magento\App\UpdaterInterface $dbUpdater, + \Magento\App\Resource\Config $resourceConfig, + \Magento\Module\UpdaterInterface $dbUpdater, \Magento\Filesystem $filesystem, \Magento\Install\Model\Installer\Data $installerData, \Magento\App\State $appState, diff --git a/app/code/Magento/Install/Model/Installer/Db.php b/app/code/Magento/Install/Model/Installer/Db.php index 07d32156e2aea944cf02adbfbb348093a3fa016b..ff22bbdbe3bc31e4fccd10ac01688e42899b876b 100644 --- a/app/code/Magento/Install/Model/Installer/Db.php +++ b/app/code/Magento/Install/Model/Installer/Db.php @@ -39,7 +39,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller protected $_dbResource; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -59,13 +59,13 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller /** * @param \Magento\Install\Model\Installer $installer - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Install\Model\Installer\Db\Factory $dbFactory * @param array $dbConfig */ public function __construct( \Magento\Install\Model\Installer $installer, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Install\Model\Installer\Db\Factory $dbFactory, array $dbConfig ) { diff --git a/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php b/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php index ee21049b23f896a7d5d25f7e5843b995309e010c..aa9af9ffd1ad2b51997a894670f2dd494c7101dd 100644 --- a/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php +++ b/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php @@ -73,12 +73,12 @@ abstract class AbstractDb /** * @param \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory - * @param \Magento\Core\Model\Config\Local $localConfig + * @param \Magento\App\Config $localConfig * @param array $dbExtensions */ public function __construct( \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory, - \Magento\Core\Model\Config\Local $localConfig, + \Magento\App\Config $localConfig, array $dbExtensions = array() ) { $this->_adapterFactory = $adapterFactory; diff --git a/app/code/Magento/Install/etc/di.xml b/app/code/Magento/Install/etc/di.xml index aeb6d1ac7f58eebe23df94dce26a0474a6c5eef8..7460d942e67b45eb059e430c65c67f10b4d66901 100644 --- a/app/code/Magento/Install/etc/di.xml +++ b/app/code/Magento/Install/etc/di.xml @@ -39,7 +39,7 @@ </type> <type name="Magento\Install\Block\End"> <param name="cryptKey"> - <value type="argument">Magento\Core\Model\Encryption::PARAM_CRYPT_KEY</value> + <value type="argument">Magento\Encryption\Encryptor::PARAM_CRYPT_KEY</value> </param> <param name='session'> <instance type="Magento\Install\Model\Session" /> @@ -134,4 +134,19 @@ <instance type="Magento\Install\Model\Installer\Proxy" /> </param> </type> + <type name="Magento\App\AreaList"> + <param name="areas"> + <value> + <install> + <frontName>install</frontName> + <router>install</router> + </install> + </value> + </param> + </type> + <type name="Magento\Backend\Model\Url"> + <param name="areaCode"> + <value>adminhtml</value> + </param> + </type> </config> diff --git a/app/code/Magento/Install/etc/install/di.xml b/app/code/Magento/Install/etc/install/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..68d9ba117725726978afa696427fa79c7459e2f4 --- /dev/null +++ b/app/code/Magento/Install/etc/install/di.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <preference for="Magento\Core\Model\Theme" type="Magento\Core\Model\Theme\Data" /> + <type name="Magento\App\RouterList" shared="true"> + <param name="routerList"> + <value> + <install> + <instance>Magento\Core\App\Router\Base</instance> + <disable type="bool">false</disable> + <sortOrder>20</sortOrder> + </install> + </value> + </param> + </type> +</config> diff --git a/app/code/Magento/Install/etc/install/routes.xml b/app/code/Magento/Install/etc/install/routes.xml new file mode 100644 index 0000000000000000000000000000000000000000..4e5b4fb93a5647a62ccf3e10cc0060be1c667de4 --- /dev/null +++ b/app/code/Magento/Install/etc/install/routes.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <router id="install"> + <route id="install" frontName="install"> + <module name="Magento_Install" /> + </route> + </router> +</config> \ No newline at end of file diff --git a/app/code/Magento/Install/etc/module.xml b/app/code/Magento/Install/etc/module.xml index 545de912ed86a0f89baeec8631765559e999ccd0..7c6fc8ec61c5dddb233b001ce9a3ce13c80bd009 100755 --- a/app/code/Magento/Install/etc/module.xml +++ b/app/code/Magento/Install/etc/module.xml @@ -34,7 +34,6 @@ <module name="Magento_Adminhtml"/> <module name="Magento_Directory"/> <module name="Magento_User"/> - <module name="Magento_Index"/> <module name="Magento_Backend"/> <module name="Magento_Page" type="soft"/> </depends> diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration.php b/app/code/Magento/Integration/Block/Adminhtml/Integration.php new file mode 100644 index 0000000000000000000000000000000000000000..384bc2c7df0c688dc950ff56387fe7879ae4fe5a --- /dev/null +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration.php @@ -0,0 +1,42 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Integration\Block\Adminhtml; + +/** + * Integration block. + */ +class Integration extends \Magento\Backend\Block\Widget\Grid\Container +{ + /** + * Define actions available on the integrations grid page. + */ + protected function _construct() + { + $this->_controller = 'adminhtml_integration'; + $this->_blockGroup = 'Magento_Integration'; + $this->_headerText = __('Integrations'); + $this->_addButtonLabel = __('Add New Integration'); + parent::_construct(); + } +} diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php new file mode 100644 index 0000000000000000000000000000000000000000..21493db48e161796d454921136b5f17bab850d15 --- /dev/null +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php @@ -0,0 +1,94 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Integration\Block\Adminhtml\Integration; + +use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; +use Magento\Integration\Controller\Adminhtml\Integration; + +class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container +{ + /** + * Core registry + * + * @var \Magento\Core\Model\Registry + */ + protected $_registry = null; + + /** + * Initialize dependencies. + * + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param array $data + */ + public function __construct( + \Magento\Core\Helper\Data $coreData, + \Magento\Backend\Block\Template\Context $context, + \Magento\Core\Model\Registry $registry, + array $data = array() + ) { + $this->_registry = $registry; + parent::__construct($coreData, $context, $data); + } + + /** + * Initialize Integration edit page + * + */ + protected function _construct() + { + $this->_controller = 'adminhtml_integration'; + $this->_blockGroup = 'Magento_Integration'; + parent::_construct(); + } + + /** + * Get header text for edit page. + * + * @return string + */ + public function getHeaderText() + { + if (isset($this->_registry->registry(Integration::REGISTRY_KEY_CURRENT_INTEGRATION)[Info::DATA_ID])) { + return __( + "Edit Integration '%1'", + $this->escapeHtml( + $this->_registry->registry(Integration::REGISTRY_KEY_CURRENT_INTEGRATION)[Info::DATA_NAME] + ) + ); + } else { + return __('New Integration'); + } + } + + /** + * {@inheritdoc} + */ + public function getFormActionUrl() + { + return $this->getUrl('*/*/save'); + } +} diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php new file mode 100644 index 0000000000000000000000000000000000000000..9c0f4ce006e401eb45ce310977141436b444302a --- /dev/null +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php @@ -0,0 +1,63 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Integration + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Integration\Block\Adminhtml\Integration\Edit; + +use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; +use Magento\Integration\Controller\Adminhtml\Integration; + +/** + * @SuppressWarnings(PHPMD.DepthOfInheritance) + */ +class Form extends \Magento\Backend\Block\Widget\Form\Generic +{ + /** + * Prepare form before rendering HTML + * + * @return \Magento\Adminhtml\Block\Widget\Form + */ + protected function _prepareForm() + { + /** @var \Magento\Data\Form $form */ + $form = $this->_formFactory->create( + array( + 'attributes' => array( + 'id' => 'edit_form', + 'action' => $this->getData('action'), + 'method' => 'post', + ) + ) + ); + $integrationData = $this->_coreRegistry->registry(Integration::REGISTRY_KEY_CURRENT_INTEGRATION); + if (isset($integrationData[Info::DATA_ID])) { + $form->addField(Info::DATA_ID, 'hidden', array('name' => 'id')); + $form->setValues($integrationData); + } + $form->setUseContainer(true); + $this->setForm($form); + return parent::_prepareForm(); + } +} diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php new file mode 100644 index 0000000000000000000000000000000000000000..a2ec2aa9681d615ad0d2128e3a282f7ef1843860 --- /dev/null +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php @@ -0,0 +1,195 @@ +<?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_Integration + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Integration\Block\Adminhtml\Integration\Edit\Tab; + +use \Magento\Integration\Controller\Adminhtml\Integration; + +/** + * Main Integration info edit form + * + * @category Magento + * @package Magento_Integration + * @SuppressWarnings(PHPMD.DepthOfInheritance) + */ +class Info extends \Magento\Backend\Block\Widget\Form\Generic + implements \Magento\Backend\Block\Widget\Tab\TabInterface +{ + /** @var \Magento\Integration\Model\Integration\Source\Authentication */ + protected $_authTypeSource; + + /**#@+ + * edit_form element names. + */ + const HTML_ID_PREFIX = 'integration_properties_'; + const DATA_ID = 'integration_id'; + const DATA_NAME = 'name'; + const DATA_EMAIL = 'email'; + const DATA_AUTHENTICATION = 'authentication'; + const DATA_ENDPOINT = 'endpoint'; + /**#@-*/ + + /** + * Construct + * + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Data\FormFactory $formFactory + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Backend\Block\Template\Context $context + * @param array $data + * @param \Magento\Integration\Model\Integration\Source\Authentication $authTypeSource + */ + public function __construct( + \Magento\Core\Model\Registry $registry, + \Magento\Data\FormFactory $formFactory, + \Magento\Core\Helper\Data $coreData, + \Magento\Backend\Block\Template\Context $context, + \Magento\Integration\Model\Integration\Source\Authentication $authTypeSource, + array $data = array() + ) { + parent::__construct($registry, $formFactory, $coreData, $context, $data); + $this->_authTypeSource = $authTypeSource; + } + + /** + * Set form id prefix, declare fields for integration info + * + * @return \Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info + */ + protected function _prepareForm() + { + /** @var \Magento\Data\Form $form */ + $form = $this->_formFactory->create(); + $form->setHtmlIdPrefix(self::HTML_ID_PREFIX); + $integrationData = $this->_coreRegistry->registry(Integration::REGISTRY_KEY_CURRENT_INTEGRATION); + $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('Integration'))); + if (isset($integrationData[self::DATA_ID])) { + $fieldset->addField(self::DATA_ID, 'hidden', array('name' => 'id')); + } + $fieldset->addField( + self::DATA_NAME, + 'text', + array( + 'label' => __('Integration Name'), + 'name' => self::DATA_NAME, + 'required' => true, + 'disabled' => false, + 'maxlength' => '255' + ) + ); + $fieldset->addField( + self::DATA_EMAIL, + 'text', + array( + 'label' => __('Email'), + 'name' => self::DATA_EMAIL, + 'required' => true, + 'disabled' => false, + 'class' => 'validate-email', + 'maxlength' => '254', + ) + ); + $fieldset->addField( + self::DATA_AUTHENTICATION, + 'select', + array( + 'label' => __('Authentication'), + 'name' => self::DATA_AUTHENTICATION, + 'disabled' => false, + 'options' => $this->_authTypeSource->toOptionArray() + ) + ); + $fieldset->addField( + self::DATA_ENDPOINT, + 'text', + array('label' => __('Endpoint URL'), 'name' => self::DATA_ENDPOINT, 'required' => true, 'disabled' => false) + ); + $form->setValues($integrationData); + $this->setForm($form); + return $this; + } + + /** + * Prepare label for tab + * + * @return string + */ + public function getTabLabel() + { + return __('Integration Info'); + } + + /** + * Prepare title for tab + * + * @return string + */ + public function getTabTitle() + { + return $this->getTabLabel(); + } + + /** + * Returns status flag about this tab can be showen or not + * + * @return true + */ + public function canShowTab() + { + return true; + } + + /** + * Returns status flag about this tab hidden or not + * + * @return true + */ + public function isHidden() + { + return false; + } + + /** + * Get additional script for tabs block + * + * @return string + */ + protected function _toHtml() + { + $oauth = \Magento\Integration\Model\Integration::AUTHENTICATION_OAUTH; + $authFieldIdSelector = '#' . self::HTML_ID_PREFIX . self::DATA_AUTHENTICATION; + $endpointIdSelector = '#' . self::HTML_ID_PREFIX . self::DATA_ENDPOINT; + $endpointClassSel = '.field-' . self::DATA_ENDPOINT; + $script = <<<HTML + jQuery(function(){ + jQuery('$authFieldIdSelector') + .mage('integration', {"authType": $oauth, "formSelector": '#edit_form', + endpointIdSelector: '$endpointIdSelector', endpointContainerClassSelector: '$endpointClassSel'}); + }); +HTML; + return parent::_toHtml() . sprintf('<script type="text/javascript">%s</script>', $script); + } +} diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tabs.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tabs.php new file mode 100644 index 0000000000000000000000000000000000000000..c2a4ed0d3faa356204576e1d86b4bfeaccf1cea1 --- /dev/null +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tabs.php @@ -0,0 +1,42 @@ +<?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_Integration + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Integration\Block\Adminhtml\Integration\Edit; + +class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs +{ + /** + * Initialize integration edit page tabs + * + */ + protected function _construct() + { + parent::_construct(); + $this->setId('integration_edit_tabs'); + $this->setDestElementId('edit_form'); + $this->setTitle(__('Integration Information')); + } +} diff --git a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php new file mode 100644 index 0000000000000000000000000000000000000000..c9af1a0b16bf98a797079d15306658405da9a008 --- /dev/null +++ b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php @@ -0,0 +1,204 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Integration\Controller\Adminhtml; + +use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; +/** + * Controller for integrations management. + */ +class Integration extends \Magento\Backend\Controller\Adminhtml\Action +{ + /** Param Key for extracting integration id from Request */ + const PARAM_INTEGRATION_ID = 'id'; + + /** Keys used for registering data into the registry */ + const REGISTRY_KEY_CURRENT_INTEGRATION = 'current_integration'; + + /** + * Core registry + * + * @var \Magento\Core\Model\Registry + */ + protected $_registry = null; + + /** @var \Magento\Integration\Service\IntegrationV1Interface */ + private $_integrationService; + + /** + * @param \Magento\Backend\Controller\Context $context + * @param \Magento\Integration\Service\IntegrationV1Interface $integrationService + * @param \Magento\Core\Model\Registry $registry + */ + public function __construct( + \Magento\Backend\Controller\Context $context, + \Magento\Integration\Service\IntegrationV1Interface $integrationService, + \Magento\Core\Model\Registry $registry + ) { + $this->_registry = $registry; + $this->_integrationService = $integrationService; + parent::__construct($context); + } + + /** + * Integrations grid. + */ + public function indexAction() + { + $this->loadLayout(); + $this->_setActiveMenu('Magento_Integration::system_integrations'); + $this->_addBreadcrumb(__('Integrations'), __('Integrations')); + $this->_title(__('Integrations')); + $this->renderLayout(); + } + + /** + * AJAX integrations grid. + */ + public function gridAction() + { + $this->loadLayout(false); + $this->renderLayout(); + } + + /** + * Check ACL. + * + * @return boolean + */ + protected function _isAllowed() + { + return $this->_authorization->isAllowed('Magento_Integration::integrations'); + } + + /** + * New integration action. + */ + public function newAction() + { + $this->loadLayout(); + $this->_setActiveMenu('Magento_Integration::system_integrations'); + $this->_addBreadcrumb(__('New Integration'), __('New Integration')); + $this->_title(__('New Integration')); + /** Try to recover integration data from session if it was added during previous request which failed. */ + $restoredIntegration = $this->_getSession()->getIntegrationData(); + if ($restoredIntegration) { + $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $restoredIntegration); + $this->_getSession()->setIntegrationData(array()); + } + $this->renderLayout(); + } + + /** + * Edit integration action. + */ + public function editAction() + { + /** Try to recover integration data from session if it was added during previous request which failed. */ + $integrationId = (int)$this->getRequest()->getParam(self::PARAM_INTEGRATION_ID); + if ($integrationId) { + $integrationData = $this->_integrationService->get($integrationId); + $restoredIntegration = $this->_getSession()->getIntegrationData(); + if (isset($restoredIntegration[Info::DATA_ID]) + && $integrationId == $restoredIntegration[Info::DATA_ID] + ) { + $integrationData = array_merge($integrationData, $restoredIntegration); + } + if (!$integrationData[Info::DATA_ID]) { + $this->_getSession()->addError(__('This integration no longer exists.')); + $this->_redirect('*/*/'); + return; + } + $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData); + } else { + $this->_getSession()->addError(__('Integration ID is not specified or is invalid.')); + $this->_redirect('*/*/'); + return; + } + $this->loadLayout(); + $this->_getSession()->setIntegrationData(array()); + $this->_setActiveMenu('Magento_Integration::system_integrations'); + $this->_addBreadcrumb( + __('Edit "%1" Integration', $integrationData[Info::DATA_NAME]), + __('Edit "%1" Integration', $integrationData[Info::DATA_NAME]) + ); + $this->_title(__('Edit "%1" Integration', $integrationData[Info::DATA_NAME])); + $this->renderLayout(); + } + + /** + * Save integration action. + */ + public function saveAction() + { + try { + $integrationId = (int)$this->getRequest()->getParam(self::PARAM_INTEGRATION_ID); + /** @var array $integrationData */ + $integrationData = array(); + if ($integrationId) { + $integrationData = $this->_integrationService->get($integrationId); + if (!$integrationData[Info::DATA_ID]) { + $this->_getSession()->addError(__('This integration no longer exists.')); + $this->_redirect('*/*/'); + return; + } + } + /** @var array $data */ + $data = $this->getRequest()->getPost(); + //Merge Post-ed data + $integrationData = array_merge($integrationData, $data); + $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData); + if (!isset($integrationData[Info::DATA_ID])) { + $this->_integrationService->create($integrationData); + } else { + $this->_integrationService->update($integrationData); + } + $this->_getSession()->addSuccess(__('The integration \'%1\' has been saved.', + $integrationData[Info::DATA_NAME])); + $this->_redirect('*/*/'); + } catch (\Magento\Integration\Exception $e) { + $this->_getSession()->addError($e->getMessage())->setIntegrationData($integrationData); + $this->_redirectOnSaveError(); + } catch (\Magento\Core\Exception $e) { + $this->_getSession()->addError($e->getMessage()); + $this->_redirectOnSaveError(); + } catch (\Exception $e) { + $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_getSession()->addError($e->getMessage()); + $this->_redirectOnSaveError(); + } + } + + /** + * Redirect merchant to 'Edit integration' or 'New integration' if error happened during integration save. + */ + protected function _redirectOnSaveError() + { + $integrationId = $this->getRequest()->getParam(self::PARAM_INTEGRATION_ID); + if ($integrationId) { + $this->_redirect('*/*/edit', array('id' => $integrationId)); + } else { + $this->_redirect('*/*/new'); + } + } +} diff --git a/app/code/Magento/Core/Model/Config/Cache/Exception.php b/app/code/Magento/Integration/Exception.php similarity index 85% rename from app/code/Magento/Core/Model/Config/Cache/Exception.php rename to app/code/Magento/Integration/Exception.php index 1a5b214a110b06e2ac73584beb6636f0e5b7da43..ce781455552b0a4311534a0971e9fb7d98c6f4fc 100644 --- a/app/code/Magento/Core/Model/Config/Cache/Exception.php +++ b/app/code/Magento/Integration/Exception.php @@ -1,7 +1,5 @@ <?php /** - * \Exception that should be thrown when config cache cannot be loaded - * * Magento * * NOTICE OF LICENSE @@ -20,12 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Integration * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Cache; +namespace Magento\Integration; -class Exception extends \LogicException +class Exception extends \Magento\Core\Exception { } diff --git a/app/code/Magento/Integration/Helper/Data.php b/app/code/Magento/Integration/Helper/Data.php new file mode 100644 index 0000000000000000000000000000000000000000..ff6e3ec78d520f6c98b0ea6565990c78c777b17f --- /dev/null +++ b/app/code/Magento/Integration/Helper/Data.php @@ -0,0 +1,32 @@ +<?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_Integration + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Integration\Helper; + +class Data extends \Magento\Core\Helper\AbstractHelper +{ + +} diff --git a/app/code/Magento/Integration/Model/Integration.php b/app/code/Magento/Integration/Model/Integration.php new file mode 100644 index 0000000000000000000000000000000000000000..ff5f86953bc08e370f5fa42162b0e3468256a075 --- /dev/null +++ b/app/code/Magento/Integration/Model/Integration.php @@ -0,0 +1,111 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Integration\Model; + +/** + * Integration model. + * + * @method \string getName() + * @method Integration setName(\string $name) + * @method \string getEmail() + * @method Integration setEmail(\string $email) + * @method \int getStatus() + * @method Integration setStatus(\int $value) + * @method \int getAuthentication() + * @method Integration setAuthentication(\int $value) + * @method \string getEndpoint() + * @method Integration setEndpoint(\string $endpoint) + * @method \string getCreatedAt() + * @method Integration setCreatedAt(\string $createdAt) + * @method \string getUpdatedAt() + * @method Integration setUpdatedAt(\string $createdAt) + */ +class Integration extends \Magento\Core\Model\AbstractModel +{ + /**#@+ + * Integration statuses. + */ + const STATUS_INACTIVE = 0; + const STATUS_ACTIVE = 1; + /**#@-*/ + + /**#@+ + * Authentication mechanism + */ + const AUTHENTICATION_OAUTH = 1; + const AUTHENTICATION_MANUAL = 2; + /**#@-*/ + + /** + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + + /** + * @param \Magento\Core\Model\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Customer\Model\Resource\Customer $resource + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Data\Collection\Db|null $resourceCollection + * @param array $data + */ + public function __construct( + \Magento\Core\Model\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Stdlib\DateTime $dateTime, + \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Data\Collection\Db $resourceCollection = null, + array $data = array() + ) { + $this->_dateTime = $dateTime; + parent::__construct($context, $registry, $resource, $resourceCollection, $data); + } + + /** + * Initialize resource model + * + * @return void + */ + protected function _construct() + { + parent::_construct(); + $this->_init('Magento\Integration\Model\Resource\Integration'); + } + + /** + * Prepare data to be saved to database + * + * @return Integration + */ + protected function _beforeSave() + { + parent::_beforeSave(); + if ($this->isObjectNew()) { + $this->setCreatedAt($this->_dateTime->formatDate(true)); + } + $this->setUpdatedAt($this->_dateTime->formatDate(true)); + return $this; + } +} diff --git a/app/code/Magento/Integration/Model/Integration/Factory.php b/app/code/Magento/Integration/Model/Integration/Factory.php new file mode 100644 index 0000000000000000000000000000000000000000..8a058c22ba00ef8cb8641f7cec7366436893d729 --- /dev/null +++ b/app/code/Magento/Integration/Model/Integration/Factory.php @@ -0,0 +1,57 @@ +<?php +/** + * Factory for \Magento\Integration\Model\Integration + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to 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_Integration + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Integration\Model\Integration; + +class Factory +{ + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + /** + * @param \Magento\ObjectManager $objectManager + */ + public function __construct(\Magento\ObjectManager $objectManager) + { + $this->_objectManager = $objectManager; + } + + /** + * Create a new instance of \Magento\Integration\Model\Integration + * + * @param array $data Data for integration + * @return \Magento\Integration\Model\Integration + */ + public function create(array $data = array()) + { + $integration = $this->_objectManager->create('Magento\Integration\Model\Integration', array()); + $integration->setData($data); + return $integration; + } +} diff --git a/app/code/Magento/Integration/Model/Integration/Source/Authentication.php b/app/code/Magento/Integration/Model/Integration/Source/Authentication.php new file mode 100644 index 0000000000000000000000000000000000000000..9deeac5ae619198a28ff8f1a5ad7ea01b8d6ab80 --- /dev/null +++ b/app/code/Magento/Integration/Model/Integration/Source/Authentication.php @@ -0,0 +1,43 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Integration\Model\Integration\Source; + +/** + * Integration authentication options. + */ +class Authentication implements \Magento\Core\Model\Option\ArrayInterface +{ + /** + * Retrieve authentication options array. + * + * @return array + */ + public function toOptionArray() + { + return array( + \Magento\Integration\Model\Integration::AUTHENTICATION_OAUTH => __('OAuth'), + \Magento\Integration\Model\Integration::AUTHENTICATION_MANUAL => __('Manual'), + ); + } +} diff --git a/app/code/Magento/Integration/Model/Integration/Source/Status.php b/app/code/Magento/Integration/Model/Integration/Source/Status.php new file mode 100644 index 0000000000000000000000000000000000000000..8dc8a0cab646d425f9666cfffa162173fccf8d00 --- /dev/null +++ b/app/code/Magento/Integration/Model/Integration/Source/Status.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Integration\Model\Integration\Source; + +/** + * Integration status options. + */ +class Status implements \Magento\Core\Model\Option\ArrayInterface +{ + /** + * Retrieve status options array. + * + * @return array + */ + public function toOptionArray() + { + return array( + array( + 'value' => \Magento\Integration\Model\Integration::STATUS_INACTIVE, + 'label' => __('Inactive') + ), + array( + 'value' => \Magento\Integration\Model\Integration::STATUS_ACTIVE, + 'label' => __('Active') + ), + ); + } +} diff --git a/app/code/Magento/Integration/Model/Resource/Integration.php b/app/code/Magento/Integration/Model/Resource/Integration.php new file mode 100644 index 0000000000000000000000000000000000000000..65f2fa75337d29f822619b5b799d1bb3866d959e --- /dev/null +++ b/app/code/Magento/Integration/Model/Resource/Integration.php @@ -0,0 +1,43 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Integration resource model + * + * @author Magento Core Team <core@magentocommerce.com> + */ +namespace Magento\Integration\Model\Resource; + +class Integration extends \Magento\Core\Model\Resource\Db\AbstractDb +{ + /** + * Initialize resource model + * + * @return void + */ + protected function _construct() + { + $this->_init('integration', 'integration_id'); + } +} diff --git a/app/code/Magento/Webapi/Model/Config/Dom.php b/app/code/Magento/Integration/Model/Resource/Integration/Collection.php similarity index 71% rename from app/code/Magento/Webapi/Model/Config/Dom.php rename to app/code/Magento/Integration/Model/Resource/Integration/Collection.php index 2571ca59544058efdef677327280440bf8c1e77f..0334992e0789ac82fbae8ca870cc263aec9b6697 100644 --- a/app/code/Magento/Webapi/Model/Config/Dom.php +++ b/app/code/Magento/Integration/Model/Resource/Integration/Collection.php @@ -21,23 +21,18 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Integration\Model\Resource\Integration; -namespace Magento\Webapi\Model\Config; - -class Dom extends \Magento\Config\Dom +/** + * Integrations collection. + */ +class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection { - /** - * Getter for node by path - * - * @param string $nodePath - * @return \DOMElement|null + * Resource collection initialization. */ - protected function _getMatchedNode($nodePath) + protected function _construct() { - if (!preg_match('/^\/config?$/i', $nodePath)) { - return null; - } - return parent::_getMatchedNode($nodePath); + $this->_init('Magento\Integration\Model\Integration', 'Magento\Integration\Model\Resource\Integration'); } } diff --git a/app/code/Magento/Integration/Service/IntegrationV1.php b/app/code/Magento/Integration/Service/IntegrationV1.php new file mode 100644 index 0000000000000000000000000000000000000000..3f57375bb723d8366dcf7a451615cea6f21fd947 --- /dev/null +++ b/app/code/Magento/Integration/Service/IntegrationV1.php @@ -0,0 +1,136 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Integration\Service; + +/** + * Integration Service. + * This service is used to interact with integrations. + */ +class IntegrationV1 implements \Magento\Integration\Service\IntegrationV1Interface +{ + /** @var \Magento\Integration\Model\Integration\Factory $_integrationFactory */ + private $_integrationFactory; + + /** + * @param \Magento\Integration\Model\Integration\Factory $integrationFactory + */ + public function __construct(\Magento\Integration\Model\Integration\Factory $integrationFactory) + { + $this->_integrationFactory = $integrationFactory; + } + + /** + * Create a new Integration + * + * @param array $integrationData + * @return array Integration data + * @throws \Magento\Integration\Exception + */ + public function create(array $integrationData) + { + $this->_checkIntegrationByName($integrationData['name']); + $integration = $this->_integrationFactory->create($integrationData); + $this->_validateIntegration($integration); + $integration->save(); + return $integration->getData(); + } + + /** + * Update an Integration. + * + * @param array $integrationData + * @return array Integration data + * @throws \Magento\Integration\Exception + */ + public function update(array $integrationData) + { + $integration = $this->_loadIntegrationById($integrationData['integration_id']); + //If name has been updated check if it conflicts with an existing integration + if ($integration->getName() != $integrationData['name']) { + $this->_checkIntegrationByName($integrationData['name']); + } + $integration->addData($integrationData); + $this->_validateIntegration($integration); + $integration->save(); + return $integration->getData(); + } + + /** + * Get the details of a specific Integration. + * + * @param int $integrationId + * @return array Integration data + * @throws \Magento\Integration\Exception + */ + public function get($integrationId) + { + $integration = $this->_loadIntegrationById($integrationId); + return $integration->getData(); + } + + /** + * Validate an integration + * + * @param \Magento\Integration\Model\Integration $integration + * @throws \Magento\Integration\Exception + */ + private function _validateIntegration(\Magento\Integration\Model\Integration $integration) + { + if ($integration->getAuthentication() == \Magento\Integration\Model\Integration::AUTHENTICATION_OAUTH + && !$integration->getEndpoint() + ) { + throw new \Magento\Integration\Exception(__('Please enter endpoint for oAuth.')); + } + } + + /** + * Check if an integration exists by the name + * + * @param string $name + * @throws \Magento\Integration\Exception + */ + private function _checkIntegrationByName($name) + { + $integration = $this->_integrationFactory->create()->load($name, 'name'); + if ($integration->getId()) { + throw new \Magento\Integration\Exception(__("Integration with name '%1' exists.", $name)); + } + } + + /** + * Load integration by id. + * + * @param int $integrationId + * @return \Magento\Integration\Model\Integration + * @throws \Magento\Integration\Exception + */ + protected function _loadIntegrationById($integrationId) + { + $integration = $this->_integrationFactory->create()->load($integrationId); + if (!$integration->getId()) { + throw new \Magento\Integration\Exception(__("Integration with ID '%1' doesn't exist.", $integrationId)); + } + return $integration; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/AbstractEntryPointTest.php b/app/code/Magento/Integration/Service/IntegrationV1Interface.php similarity index 55% rename from dev/tests/unit/testsuite/Magento/Core/Model/AbstractEntryPointTest.php rename to app/code/Magento/Integration/Service/IntegrationV1Interface.php index 6229e135b74abf89bbb0c5bbab9d46de40b8f6df..ecc31daa214541f24629f984acca01fc931f07c2 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/AbstractEntryPointTest.php +++ b/app/code/Magento/Integration/Service/IntegrationV1Interface.php @@ -21,26 +21,40 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Integration\Service; -namespace Magento\Core\Model; - -class AbstractEntryPointTest extends \PHPUnit_Framework_TestCase +/** + * Integration Service Interface + */ +interface IntegrationV1Interface { + + /** + * Create a new Integration + * + * @param array $integrationData + * @return array Integration data + * @throws \Magento\Integration\Exception + */ + public function create(array $integrationData); + /** - * Tested: successful model creation, verification of directories, call of template method _processRequest() + * Get the details of a specific Integration. * - * @magentoAppIsolation enabled + * @param int $integrationId + * @return array Integration data + * @throws \Magento\Integration\Exception */ - public function testProcessRequest() - { - $objectManager = $this->getMock('Magento\ObjectManager'); + public function get($integrationId); + - $config = $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false); + /** + * Update a Integration. + * + * @param array $integrationData + * @return array Integration data + * @throws \Magento\Integration\Exception + */ + public function update(array $integrationData); - $model = $this->getMockForAbstractClass('Magento\Core\Model\AbstractEntryPoint', - array($config, $objectManager), ''); - $model->expects($this->once()) - ->method('_processRequest'); - $model->processRequest(); - } } diff --git a/app/code/Magento/Integration/etc/adminhtml/menu.xml b/app/code/Magento/Integration/etc/adminhtml/menu.xml new file mode 100644 index 0000000000000000000000000000000000000000..d3f9e32725932e666303963b37a611036c2dd8ee --- /dev/null +++ b/app/code/Magento/Integration/etc/adminhtml/menu.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- +/** + * Configuration of Integration module menu in Magento admin panel. + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <menu> + <add id="Magento_Integration::system_extensions" title="Extensions" module="Magento_Integration" sortOrder="45" parent="Magento_Adminhtml::system" resource="Magento_Integration::extensions"/> + <add id="Magento_Integration::system_integrations" title="Integrations" module="Magento_Integration" sortOrder="10" parent="Magento_Integration::system_extensions" action="adminhtml/integration" resource="Magento_Integration::integrations"/> + </menu> +</config> diff --git a/app/code/Magento/Integration/etc/adminhtml/routes.xml b/app/code/Magento/Integration/etc/adminhtml/routes.xml new file mode 100644 index 0000000000000000000000000000000000000000..53fcd309330217ab7ad2d1b24e15ac63da0a6d76 --- /dev/null +++ b/app/code/Magento/Integration/etc/adminhtml/routes.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <router id="admin"> + <route id="adminhtml"> + <module name="Magento_Integration_Adminhtml" before="Magento_Adminhtml" /> + </route> + </router> +</config> + diff --git a/app/code/Magento/Integration/etc/di.xml b/app/code/Magento/Integration/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..74336eeea7cd1a8a12580c4dc76a0e77ff5fcdae --- /dev/null +++ b/app/code/Magento/Integration/etc/di.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <preference for="Magento\Integration\Service\IntegrationV1Interface" type="Magento\Integration\Service\IntegrationV1" /> +</config> diff --git a/app/code/Magento/Integration/etc/module.xml b/app/code/Magento/Integration/etc/module.xml new file mode 100755 index 0000000000000000000000000000000000000000..59c2b02907984899459c1dfb7a9e084502bc0da5 --- /dev/null +++ b/app/code/Magento/Integration/etc/module.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <module name="Magento_Integration" version="1.0.0.0" active="true"> + <sequence> + <module name="Magento_Adminhtml"/> + </sequence> + <depends> + <module name="Magento_Adminhtml"/> + <module name="Magento_Core"/> + <module name="Magento_Backend"/> + </depends> + </module> +</config> diff --git a/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php b/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php new file mode 100644 index 0000000000000000000000000000000000000000..61e93facc48d3f9f8003b463ffbe63f86c4bf5d0 --- /dev/null +++ b/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php @@ -0,0 +1,117 @@ +<?php +/** + * Upgrade script for integration table creation. + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/* @var \Magento\Core\Model\Resource\Setup $installer */ +$installer = $this; +$installer->startSetup(); + +$table = $installer->getConnection() + ->newTable($installer->getTable('integration')) + ->addColumn( + 'integration_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array( + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ), + 'Integration ID' + ) + ->addColumn( + 'name', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array( + 'nullable' => false, + ), + 'Integration name is displayed in the admin interface' + ) + ->addColumn( + 'email', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array( + 'nullable' => false, + ), + 'Email address of the contact person' + ) + ->addColumn( + 'authentication', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array( + 'unsigned' => true, + 'nullable' => false + ), + 'Authentication mechanism' + ) + ->addColumn( + 'endpoint', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array( + 'nullable' => false, + ), + 'Endpoint for Oauth handshake' + ) + ->addColumn( + 'status', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array( + 'unsigned' => true, + 'nullable' => false + ), + 'Integration status' + ) + ->addColumn( + 'created_at', + \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + array('nullable' => false), + 'Creation Time' + ) + ->addColumn( + 'updated_at', + \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + array('nullable' => false), + 'Update Time' + ) + ->addIndex( + $installer->getIdxName( + 'integration', + array('name'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('name'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) + ); +$installer->getConnection()->createTable($table); + +$installer->endSetup(); diff --git a/app/code/Magento/Integration/view/adminhtml/js/integration.js b/app/code/Magento/Integration/view/adminhtml/js/integration.js new file mode 100644 index 0000000000000000000000000000000000000000..a25c3c222d9b224808f7d7038fb225f2158e5f7a --- /dev/null +++ b/app/code/Magento/Integration/view/adminhtml/js/integration.js @@ -0,0 +1,77 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +/*jshint jquery:true*/ +(function($) { + "use strict"; + $.widget('mage.integration', { + options: { + authType: null, // Auth type : Manual or Oauth + formSelector: null, + endpointIdSelector: null, + endpointContainerClassSelector: null, + requiredClass: 'required-entry' + }, + + /** + * Initialize integration widget + * @private + */ + _init: function() { + this._toggleEndpoint(); + }, + + /** + * Bind a click handler to the widget's context element. + * @private + */ + _create: function() { + this._on({ + change: '_toggleEndpoint' + }); + this._on($(this.options.formSelector), { + submit: '_resetEndpoint' + }); + }, + + /** + * Toggle the visibility of the endpoint field based on Auth thype selected + * @private + */ + _toggleEndpoint: function() { + var isOauth = parseInt(this.element.val()) === this.options.authType; + $(this.options.endpointContainerClassSelector).children().toggle(isOauth); + $(this.options.endpointIdSelector).toggleClass(this.options.requiredClass, isOauth); + }, + + /** + * Reset endpoint field if the Authentication type is not Oauth + * + * @private + */ + _resetEndpoint: function() { + if (parseInt(this.element.val()) !== this.options.authType) { + $(this.options.endpointIdSelector).val(''); + } + } + }); +})(jQuery); \ No newline at end of file diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_edit.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_edit.xml new file mode 100644 index 0000000000000000000000000000000000000000..d31f920053486b2b60d63bdbbfd85414953265c7 --- /dev/null +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_edit.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="head"> + <block class="Magento\Page\Block\Html\Head\Script" name="magento-integration-adminhtml-integration-js"> + <arguments> + <argument name="file" xsi:type="string">Magento_Integration::js/integration.js</argument> + </arguments> + </block> + </referenceBlock> + <update handle="editor"/> + <referenceContainer name="left"> + <block class="Magento\Integration\Block\Adminhtml\Integration\Edit\Tabs" name="integration_edit_tabs"> + <block class="Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info" name="integration_edit_tab_info"/> + <action method="addTab"> + <argument name="name" xsi:type="string">info_section</argument> + <argument name="block" xsi:type="string">integration_edit_tab_info</argument> + </action> + </block> + </referenceContainer> + <referenceContainer name="content"> + <block class="Magento\Integration\Block\Adminhtml\Integration\Edit" name="integration_edit_content"/> + </referenceContainer> +</layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_wysiwyg_images_contents.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid.xml similarity index 80% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_wysiwyg_images_contents.xml rename to app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid.xml index 15a39a0780c1d443276ea97d134676dcc378a758..89381286edaafa62e781975d3701bf9cb51881b7 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_cms_wysiwyg_images_contents.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid.xml @@ -23,6 +23,8 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> + <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Adminhtml\Block\Cms\Wysiwyg\Images\Content\Files" name="wysiwyg_images.files" template="cms/browser/content/files.phtml" output="1"/> -</layout> + <update handle="adminhtml_integration_grid_block"/> + <block class="Magento\Integration\Block\Adminhtml\Integration" name="integration.grid.container" template="Magento_Backend::widget/grid/container/empty.phtml" output="1"/> +</layout> \ No newline at end of file diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml new file mode 100644 index 0000000000000000000000000000000000000000..32c982c2dae7f11c66c89240ae503b90302493c5 --- /dev/null +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml @@ -0,0 +1,72 @@ +<?xml version="1.0"?> +<!-- +/** + * Integrations grid block. + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="integration.grid.container"> + <block class="Magento\Backend\Block\Widget\Grid" name="integration.grid" as="grid"> + <arguments> + <argument name="id" xsi:type="string">integrationGrid</argument> + <argument name="dataSource" xsi:type="object">\Magento\Integration\Model\Resource\Integration\Collection</argument> + <argument name="use_ajax" xsi:type="string">1</argument> + <argument name="default_sort" xsi:type="string">integration_id</argument> + <argument name="default_dir" xsi:type="string">asc</argument> + <argument name="grid_url" xsi:type="url" path="*/*/grid"> + <param name="_current">1</param> + </argument> + </arguments> + <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="integration.grid.columnSet"> + <arguments> + <argument name="rowUrl" xsi:type="array"> + <item name="path" xsi:type="string">*/*/edit</item> + <item name="extraParamsTemplate" xsi:type="array"> + <item name="id" xsi:type="string">getId</item> + </item> + </argument> + <argument name="empty_text" xsi:type="string" translate="true">No Integrations Found</argument> + </arguments> + <block class="Magento\Backend\Block\Widget\Grid\Column" as="name"> + <arguments> + <argument name="header" xsi:type="string" translate="true">Name</argument> + <argument name="type" xsi:type="string">text</argument> + <argument name="index" xsi:type="string">name</argument> + <argument name="id" xsi:type="string">name</argument> + </arguments> + </block> + <block class="Magento\Backend\Block\Widget\Grid\Column" as="status"> + <arguments> + <argument name="header" xsi:type="string" translate="true">Status</argument> + <argument name="type" xsi:type="string">options</argument> + <argument name="options" xsi:type="options" model="Magento\Integration\Model\Integration\Source\Status"/> + <argument name="width" xsi:type="string">50px</argument> + <argument name="index" xsi:type="string">status</argument> + <argument name="id" xsi:type="string">status</argument> + </arguments> + </block> + </block> + </block> + </referenceBlock> +</layout> diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml new file mode 100644 index 0000000000000000000000000000000000000000..b66612e929e63e218b4f24303c62781ebbae095c --- /dev/null +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- +/** + * Handle for integrations grid rendering. + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <update handle="adminhtml_integration_grid_block"/> + <referenceContainer name="content"> + <block class="Magento\Integration\Block\Adminhtml\Integration" name="integration.grid.container"/> + </referenceContainer> +</layout> diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml new file mode 100644 index 0000000000000000000000000000000000000000..f4ea556b8ecccd6521b73a049362672e63ec6bf6 --- /dev/null +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <update handle="adminhtml_integration_edit"/> + <referenceBlock name="head"> + <block class="Magento\Page\Block\Html\Head\Script" name="magento-integration-adminhtml-integration-js"> + <arguments> + <argument name="file" xsi:type="string">Magento_Integration::js/integration.js</argument> + </arguments> + </block> + </referenceBlock> +</layout> diff --git a/app/code/Magento/Log/Model/EntryPoint/Shell.php b/app/code/Magento/Log/App/Shell.php similarity index 66% rename from app/code/Magento/Log/Model/EntryPoint/Shell.php rename to app/code/Magento/Log/App/Shell.php index 64a871767be01c9382e03073e69f8fc7a8dc4161..e6e9dc3b18c39a1ed327717a2d601afaf23b5c7d 100644 --- a/app/code/Magento/Log/Model/EntryPoint/Shell.php +++ b/app/code/Magento/Log/App/Shell.php @@ -1,5 +1,7 @@ <?php /** + * Log shell application + * * Magento * * NOTICE OF LICENSE @@ -21,9 +23,11 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Log\Model\EntryPoint; +namespace Magento\Log\App; + +use Magento\AppInterface; -class Shell extends \Magento\Core\Model\AbstractEntryPoint +class Shell implements AppInterface { /** * Filename of the entry point script @@ -33,26 +37,33 @@ class Shell extends \Magento\Core\Model\AbstractEntryPoint protected $_entryFileName; /** - * @param \Magento\Core\Model\Config\Primary $config - * @param string $entryFileName filename of the entry point script - * @param \Magento\ObjectManager $objectManager + * @var \Magento\Log\Model\ShellFactory + */ + protected $_shellFactory; + + /** + * @param string $entryFileName + * @param \Magento\Log\Model\ShellFactory $shellFactory */ public function __construct( - \Magento\Core\Model\Config\Primary $config, $entryFileName, - \Magento\ObjectManager $objectManager = null + \Magento\Log\Model\ShellFactory $shellFactory ) { - parent::__construct($config, $objectManager); $this->_entryFileName = $entryFileName; + $this->_shellFactory = $shellFactory; } + /** - * Process request to application + * Run application + * + * @return int */ - protected function _processRequest() + public function execute() { /** @var $shell \Magento\Log\Model\Shell */ - $shell = $this->_objectManager->create('Magento\Log\Model\Shell', array('entryPoint' => $this->_entryFileName)); + $shell = $this->_shellFactory->create(array('entryPoint' => $this->_entryFileName)); $shell->run(); + return 0; } } diff --git a/app/code/Magento/Log/Model/Customer.php b/app/code/Magento/Log/Model/Customer.php index f22494402b95eb089b68f78923e0e661352a1b36..4e6d4ca2d16deefb370b1815468c3a3f002c35a4 100644 --- a/app/code/Magento/Log/Model/Customer.php +++ b/app/code/Magento/Log/Model/Customer.php @@ -48,9 +48,33 @@ namespace Magento\Log\Model; class Customer extends \Magento\Core\Model\AbstractModel { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Core\Model\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Data\Collection\Db $resourceCollection + * @param array $data + */ + public function __construct( + \Magento\Core\Model\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Stdlib\DateTime $dateTime, + \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Data\Collection\Db $resourceCollection = null, + array $data = array() + ) { + $this->dateTime = $dateTime; + parent::__construct($context, $registry, $resource, $resourceCollection, $data); + } + /** * Define resource model - * */ protected function _construct() { @@ -82,7 +106,7 @@ class Customer extends \Magento\Core\Model\AbstractModel { $loginAt = $this->getLoginAt(); if ($loginAt) { - return \Magento\Date::toTimestamp($loginAt); + return $this->dateTime->toTimestamp($loginAt); } return null; diff --git a/app/code/Magento/Log/Model/Resource/Log.php b/app/code/Magento/Log/Model/Resource/Log.php index 0215c8d55ece4a03d06e8e4b554c70f72c4b59cb..4a09bf99a4b4b8ae8dec2a9c91be628836ff3546 100644 --- a/app/code/Magento/Log/Model/Resource/Log.php +++ b/app/code/Magento/Log/Model/Resource/Log.php @@ -48,18 +48,26 @@ class Log extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected $_date; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Core\Model\Date $date * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Core\Model\Date $date, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource $resource + \Magento\Stdlib\DateTime $dateTime, + \Magento\App\Resource $resource ) { $this->_date = $date; $this->_eventManager = $eventManager; + $this->dateTime = $dateTime; parent::__construct($resource); } @@ -100,7 +108,7 @@ class Log extends \Magento\Core\Model\Resource\Db\AbstractDb $readAdapter = $this->_getReadAdapter(); $writeAdapter = $this->_getWriteAdapter(); - $timeLimit = $this->formatDate($this->_date->gmtTimestamp() - $time); + $timeLimit = $this->dateTime->formatDate($this->_date->gmtTimestamp() - $time); while (true) { $select = $readAdapter->select() @@ -149,7 +157,7 @@ class Log extends \Magento\Core\Model\Resource\Db\AbstractDb $readAdapter = $this->_getReadAdapter(); $writeAdapter = $this->_getWriteAdapter(); - $timeLimit = $this->formatDate($this->_date->gmtTimestamp() - $time); + $timeLimit = $this->dateTime->formatDate($this->_date->gmtTimestamp() - $time); // retrieve last active customer log id $lastLogId = $readAdapter->fetchOne( diff --git a/app/code/Magento/Log/Model/Resource/Shell.php b/app/code/Magento/Log/Model/Resource/Shell.php index 46d47b937e76c51eec1f9bae0d1abfc6a81d6c5d..3c96479fd280ae7dc69a84a403d933e8cd160efb 100644 --- a/app/code/Magento/Log/Model/Resource/Shell.php +++ b/app/code/Magento/Log/Model/Resource/Shell.php @@ -36,7 +36,7 @@ namespace Magento\Log\Model\Resource; class Shell { /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; @@ -47,11 +47,11 @@ class Shell /** * @param \Magento\Core\Model\Resource\HelperPool $helperPool - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Core\Model\Resource\HelperPool $helperPool, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_helperPool = $helperPool; $this->_resource = $resource; diff --git a/app/code/Magento/Log/Model/Resource/Visitor.php b/app/code/Magento/Log/Model/Resource/Visitor.php index ebeb5b40e09ea3eb4dbb1602d2f75f5fd8c00219..dceb0cd97edd1647092ffe10c1a3b660963842ed 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor.php +++ b/app/code/Magento/Log/Model/Resource/Visitor.php @@ -24,24 +24,19 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Log\Model\Resource; /** * Visitor log resource - * - * @category Magento - * @package Magento_Log - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Log\Model\Resource; - class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb { /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * @var \Magento\Core\Model\Date @@ -56,18 +51,18 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb /** * @param \Magento\Core\Model\Date $date * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Helper\String $coreString - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Stdlib\String $string + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Core\Model\Date $date, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Helper\String $coreString, - \Magento\Core\Model\Resource $resource + \Magento\Stdlib\String $string, + \Magento\App\Resource $resource ) { $this->_date = $date; $this->_storeManager = $storeManager; - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($resource); } @@ -106,8 +101,8 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb { $adapter = $this->_getWriteAdapter(); $data = new \Magento\Object(array( - 'url' => $this->_coreString->substr($visitor->getUrl(), 0, 250), - 'referer'=> $this->_coreString->substr($visitor->getHttpReferer(), 0, 250) + 'url' => $this->string->substr($visitor->getUrl(), 0, 250), + 'referer'=> $this->string->substr($visitor->getHttpReferer(), 0, 250) )); $bind = $this->_prepareDataForTable($data, $this->getTable('log_url_info')); @@ -183,17 +178,17 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected function _saveVisitorInfo($visitor) { - $referer = $this->_coreString->cleanString($visitor->getHttpReferer()); - $referer = $this->_coreString->substr($referer, 0, 255); + $referer = $this->string->cleanString($visitor->getHttpReferer()); + $referer = $this->string->substr($referer, 0, 255); - $userAgent = $this->_coreString->cleanString($visitor->getHttpUserAgent()); - $userAgent = $this->_coreString->substr($userAgent, 0, 255); + $userAgent = $this->string->cleanString($visitor->getHttpUserAgent()); + $userAgent = $this->string->substr($userAgent, 0, 255); - $charset = $this->_coreString->cleanString($visitor->getHttpAcceptCharset()); - $charset = $this->_coreString->substr($charset, 0, 255); + $charset = $this->string->cleanString($visitor->getHttpAcceptCharset()); + $charset = $this->string->substr($charset, 0, 255); - $language = $this->_coreString->cleanString($visitor->getHttpAcceptLanguage()); - $language = $this->_coreString->substr($language, 0, 255); + $language = $this->string->cleanString($visitor->getHttpAcceptLanguage()); + $language = $this->string->substr($language, 0, 255); $data = new \Magento\Object(array( 'visitor_id' => $visitor->getId(), diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online.php b/app/code/Magento/Log/Model/Resource/Visitor/Online.php index 9a6423e07f5345e607847ac6fe79c6a020f37eb7..2978812ff2b46ab8fde121dfb600843bc5c5d23c 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online.php @@ -43,11 +43,11 @@ class Online extends \Magento\Core\Model\Resource\Db\AbstractDb /** * @param \Magento\Core\Model\Date $date - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Core\Model\Date $date, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_date = $date; parent::__construct($resource); diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php b/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php index 18d724d14e21c69ef7e57e0af4cb5d6046dbfaa6..8e16d8a6343fd781f6ab7096de8e1281f94648c8 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php @@ -51,7 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource @@ -59,7 +59,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl public function __construct( \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php b/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php index 08217b631bea7cfdba42f7e89312931f35bd1cb6..e2db507913dfb3b619355f5d094b92a422455ff9 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php @@ -36,7 +36,7 @@ class Collection extends \Magento\Log\Model\Resource\Visitor\Online\Collection * @param \Magento\Log\Model\Visitor\OnlineFactory $onlineFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource @@ -45,7 +45,7 @@ class Collection extends \Magento\Log\Model\Resource\Visitor\Online\Collection \Magento\Log\Model\Visitor\OnlineFactory $onlineFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/Log/Model/Visitor.php b/app/code/Magento/Log/Model/Visitor.php index 33d3a4775ab549cf5e5d1a70f7e1fe1261cebd39..383955d049a4c5c27f75cf0446f0fac6333a029a 100644 --- a/app/code/Magento/Log/Model/Visitor.php +++ b/app/code/Magento/Log/Model/Visitor.php @@ -24,6 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Log\Model; /** * @method \Magento\Log\Model\Resource\Visitor _getResource() @@ -36,13 +37,7 @@ * @method \Magento\Log\Model\Visitor setLastUrlId(int $value) * @method int getStoreId() * @method \Magento\Log\Model\Visitor setStoreId(int $value) - * - * @category Magento - * @package Magento_Log - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Log\Model; - class Visitor extends \Magento\Core\Model\AbstractModel { const DEFAULT_ONLINE_MINUTES_INTERVAL = 15; @@ -54,13 +49,6 @@ class Visitor extends \Magento\Core\Model\AbstractModel */ protected $_skipRequestLogging = false; - /** - * Core http - * - * @var \Magento\Core\Helper\Http - */ - protected $_coreHttp = null; - /** * @var array */ @@ -113,21 +101,44 @@ class Visitor extends \Magento\Core\Model\AbstractModel protected $_customerFactory; /** - * @param \Magento\Core\Model\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Customer\Model\CustomerFactory $customerFactory - * @param \Magento\Sales\Model\QuoteFactory $quoteFactory - * @param \Magento\Core\Model\Session $session + * @var \Magento\HTTP\Header + */ + protected $_httpHeader; + + /** + * @var \Magento\HTTP\PhpEnvironment\RemoteAddress + */ + protected $_remoteAddress; + + /** + * @var \Magento\HTTP\PhpEnvironment\ServerAddress + */ + protected $_serverAddress; + + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Core\Model\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param \Magento\Sales\Model\QuoteFactory $quoteFactory + * @param \Magento\Core\Model\Session $session * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $coreConfig - * @param array $data - * @param array $ignoredUserAgents - * @param array $ignores - * @param \Magento\Core\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection + * @param \Magento\Core\Model\Config $coreConfig + * @param \Magento\HTTP\Header $httpHeader + * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress + * @param \Magento\HTTP\PhpEnvironment\ServerAddress $serverAddress + * @param \Magento\Stdlib\DateTime $dateTime + * @param array $data + * @param array $ignoredUserAgents + * @param array $ignores + * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Data\Collection\Db $resourceCollection * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -140,8 +151,11 @@ class Visitor extends \Magento\Core\Model\AbstractModel \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Core\Model\Session $session, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Helper\Http $coreHttp, \Magento\Core\Model\Config $coreConfig, + \Magento\HTTP\Header $httpHeader, + \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress, + \Magento\HTTP\PhpEnvironment\ServerAddress $serverAddress, + \Magento\Stdlib\DateTime $dateTime, array $data = array(), array $ignoredUserAgents = array(), array $ignores = array(), @@ -154,9 +168,12 @@ class Visitor extends \Magento\Core\Model\AbstractModel $this->_quoteFactory = $quoteFactory; $this->_session = $session; $this->_storeManager = $storeManager; - $this->_coreHttp = $coreHttp; $this->_coreConfig = $coreConfig; $this->_ignoredUserAgents = $ignoredUserAgents; + $this->_httpHeader = $httpHeader; + $this->_remoteAddress = $remoteAddress; + $this->_serverAddress = $serverAddress; + $this->dateTime = $dateTime; parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_ignores = $ignores; @@ -168,7 +185,7 @@ class Visitor extends \Magento\Core\Model\AbstractModel protected function _construct() { $this->_init('Magento\Log\Model\Resource\Visitor'); - $userAgent = $this->_coreHttp->getHttpUserAgent(); + $userAgent = $this->_httpHeader->getHttpUserAgent(); if ($this->_ignoredUserAgents) { if (in_array($userAgent, $this->_ignoredUserAgents)) { $this->_skipRequestLogging = true; @@ -193,17 +210,18 @@ class Visitor extends \Magento\Core\Model\AbstractModel */ public function initServerData() { + $clean = true; $this->addData(array( - 'server_addr' => $this->_coreHttp->getServerAddr(true), - 'remote_addr' => $this->_coreHttp->getRemoteAddr(true), + 'server_addr' => $this->_serverAddress->getServerAddress(true), + 'remote_addr' => $this->_remoteAddress->getRemoteAddress(true), 'http_secure' => $this->_storeManager->getStore()->isCurrentlySecure(), - 'http_host' => $this->_coreHttp->getHttpHost(true), - 'http_user_agent' => $this->_coreHttp->getHttpUserAgent(true), - 'http_accept_language' => $this->_coreHttp->getHttpAcceptLanguage(true), - 'http_accept_charset' => $this->_coreHttp->getHttpAcceptCharset(true), - 'request_uri' => $this->_coreHttp->getRequestUri(true), + 'http_host' => $this->_httpHeader->getHttpHost($clean), + 'http_user_agent' => $this->_httpHeader->getHttpUserAgent($clean), + 'http_accept_language' => $this->_httpHeader->getHttpAcceptLanguage($clean), + 'http_accept_charset' => $this->_httpHeader->getHttpAcceptCharset($clean), + 'request_uri' => $this->_httpHeader->getRequestUri($clean), 'session_id' => $this->_getSession()->getSessionId(), - 'http_referer' => $this->_coreHttp->getHttpReferer(true), + 'http_referer' => $this->_httpHeader->getHttpReferer($clean), )); return $this; @@ -237,7 +255,7 @@ class Visitor extends \Magento\Core\Model\AbstractModel public function getFirstVisitAt() { if (!$this->hasData('first_visit_at')) { - $this->setData('first_visit_at', now()); + $this->setData('first_visit_at', $this->dateTime->now()); } return $this->getData('first_visit_at'); } @@ -245,7 +263,7 @@ class Visitor extends \Magento\Core\Model\AbstractModel public function getLastVisitAt() { if (!$this->hasData('last_visit_at')) { - $this->setData('last_visit_at', now()); + $this->setData('last_visit_at', $this->dateTime->now()); } return $this->getData('last_visit_at'); } @@ -268,7 +286,7 @@ class Visitor extends \Magento\Core\Model\AbstractModel $this->initServerData(); if (!$this->getId()) { - $this->setFirstVisitAt(now()); + $this->setFirstVisitAt($this->dateTime->now()); $this->setIsNewVisitor(true); $this->save(); $this->_eventManager->dispatch('visitor_init', array('visitor' => $this)); @@ -291,7 +309,7 @@ class Visitor extends \Magento\Core\Model\AbstractModel } try { - $this->setLastVisitAt(now()); + $this->setLastVisitAt($this->dateTime->now()); $this->save(); $this->_getSession()->setVisitorData($this->getData()); } catch (\Exception $e) { diff --git a/app/code/Magento/Log/Model/Visitor/Online.php b/app/code/Magento/Log/Model/Visitor/Online.php index 706a23692b2a3727ff01efd56762ea9d53259d85..e526e35db4dffd1d774f2941bb59eb10cd14363a 100644 --- a/app/code/Magento/Log/Model/Visitor/Online.php +++ b/app/code/Magento/Log/Model/Visitor/Online.php @@ -61,12 +61,12 @@ class Online extends \Magento\Core\Model\AbstractModel protected $_coreStoreConfig; /** - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; /** - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\Store\Config $coreStoreConfig @@ -75,7 +75,7 @@ class Online extends \Magento\Core\Model\AbstractModel * @param array $data */ public function __construct( - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\Store\Config $coreStoreConfig, diff --git a/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php index 818ff4a80a3273b1b760ed8cc1fdd487ac373629..cfecd07e597a29ae0468058f16a4c7f4a26240be 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php @@ -58,7 +58,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerCollectionFactory @@ -66,7 +66,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerCollectionFactory, diff --git a/app/code/Magento/Newsletter/Model/Resource/Queue.php b/app/code/Magento/Newsletter/Model/Resource/Queue.php index 43d0256785f9a3484dfaa3f5101a6e063e664c6f..be85c076c6c6614400d6df704906dd98a3d23d4c 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Queue.php +++ b/app/code/Magento/Newsletter/Model/Resource/Queue.php @@ -46,11 +46,11 @@ class Queue extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Newsletter\Model\Resource\Subscriber\Collection $subscriberCollection */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Newsletter\Model\Resource\Subscriber\Collection $subscriberCollection ) { parent::__construct($resource); diff --git a/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php index 42d5499f17586003a4064ba2d800ec978d9e1447..9e0a5c342cd5738443fbedfed00d1fe859fed25e 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php @@ -61,7 +61,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Date $date @@ -69,7 +69,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Date $date, diff --git a/app/code/Magento/Newsletter/Model/Resource/Subscriber.php b/app/code/Magento/Newsletter/Model/Resource/Subscriber.php index ba62b3e26e331f5e3487e44a3ca5ed16b701f025..cfd32b7e40f8e1fc0d379a440f9668c745c24b21 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Resource/Subscriber.php @@ -64,13 +64,6 @@ class Subscriber extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected $_messagesScope = 'newsletter/session'; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * Date * @@ -78,21 +71,26 @@ class Subscriber extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected $_date; + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Date $date - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Math\Random $mathRandom */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\Date $date, - \Magento\Core\Helper\Data $coreData + \Magento\Math\Random $mathRandom ) { - parent::__construct($resource); $this->_date = $date; - $this->_coreData = $coreData; + $this->mathRandom = $mathRandom; + parent::__construct($resource); } /** @@ -177,7 +175,7 @@ class Subscriber extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected function _generateRandomCode() { - return $this->_coreData->uniqHash(); + return $this->mathRandom->getUniqueHash(); } /** diff --git a/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php index de21c679c74317d7e636fe8e2765edd3b0dd19c5..31e4589d51466d215af08e2427cf85318d678f7c 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php @@ -83,7 +83,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory @@ -91,7 +91,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, diff --git a/app/code/Magento/Newsletter/Model/Resource/Template.php b/app/code/Magento/Newsletter/Model/Resource/Template.php index 8690065fa740df51eeb4a141782bf94d6a25e3ec..4499857d0b0b783f67520539143d560ce5c740fd 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Template.php +++ b/app/code/Magento/Newsletter/Model/Resource/Template.php @@ -46,12 +46,12 @@ class Template extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Date $date */ public function __construct( \Magento\Core\Model\Date $date, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { parent::__construct($resource); $this->_date = $date; diff --git a/app/code/Magento/Newsletter/Model/Template.php b/app/code/Magento/Newsletter/Model/Template.php index 680a672962134035a3615ee393a1f3d795f0cb64..6df0cfd49aacc3243e54f57390d6a9b4baf3f84f 100644 --- a/app/code/Magento/Newsletter/Model/Template.php +++ b/app/code/Magento/Newsletter/Model/Template.php @@ -107,6 +107,11 @@ class Template extends \Magento\Core\Model\Template */ protected $_templateFactory; + /** + * @var \Magento\Filter\FilterManager + */ + protected $_filterManager; + /** * @param \Magento\View\DesignInterface $design * @param \Magento\Core\Model\Context $context @@ -117,6 +122,7 @@ class Template extends \Magento\Core\Model\Template * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Newsletter\Model\TemplateFactory $templateFactory * @param \Magento\Core\Model\App\Emulation $appEmulation + * @param \Magento\Filter\FilterManager $filterManager * @param array $data */ public function __construct( @@ -129,6 +135,7 @@ class Template extends \Magento\Core\Model\Template \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Newsletter\Model\TemplateFactory $templateFactory, \Magento\Core\Model\App\Emulation $appEmulation, + \Magento\Filter\FilterManager $filterManager, array $data = array() ) { parent::__construct($design, $context, $registry, $appEmulation, $storeManager, $data); @@ -137,6 +144,7 @@ class Template extends \Magento\Core\Model\Template $this->_filter = $filter; $this->_coreStoreConfig = $coreStoreConfig; $this->_templateFactory = $templateFactory; + $this->_filterManager = $filterManager; } /** @@ -313,14 +321,10 @@ class Template extends \Magento\Core\Model\Template */ public function getProcessedTemplateSubject(array $variables) { - $processor = new \Magento\Filter\Template(); - if (!$this->_preprocessFlag) { $variables['this'] = $this; } - - $processor->setVariables($variables); - return $processor->filter($this->getTemplateSubject()); + return $this->_filterManager->template($this->getTemplateSubject(), array('variables' => $variables)); } /** diff --git a/app/code/Magento/Newsletter/etc/di.xml b/app/code/Magento/Newsletter/etc/di.xml index b428f17ca3fe1f4651cd1599a904561afc6101ee..8e9456d5cf75baec115368fabec6436adab1f350 100644 --- a/app/code/Magento/Newsletter/etc/di.xml +++ b/app/code/Magento/Newsletter/etc/di.xml @@ -24,7 +24,7 @@ */ --> <config> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <newsletter_setup>Magento\Newsletter\Model\Resource\Setup</newsletter_setup> diff --git a/app/code/Magento/Oauth/Block/Authorize/AbstractAuthorize.php b/app/code/Magento/Oauth/Block/Authorize/AbstractAuthorize.php index 356cd5ece3813242a750c173a655562eb9f3974a..95f032508e13d376b8f06597d48769869dd2e896 100644 --- a/app/code/Magento/Oauth/Block/Authorize/AbstractAuthorize.php +++ b/app/code/Magento/Oauth/Block/Authorize/AbstractAuthorize.php @@ -105,7 +105,7 @@ abstract class AbstractAuthorize extends \Magento\Core\Block\Template //load base template from admin area $params = array( '_relative' => true, - 'area' => 'adminhtml', + 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, 'package' => 'default' ); return $this->_viewFileSystem->getFilename($this->getTemplate(), $params); diff --git a/app/code/Magento/Oauth/Controller/Adminhtml/Oauth/Consumer.php b/app/code/Magento/Oauth/Controller/Adminhtml/Oauth/Consumer.php index 2c97ca2437258b20978730324b449a6bf1cc9f8a..1968d302e4a09e7905247c3e5ab650485a15ccd2 100644 --- a/app/code/Magento/Oauth/Controller/Adminhtml/Oauth/Consumer.php +++ b/app/code/Magento/Oauth/Controller/Adminhtml/Oauth/Consumer.php @@ -59,30 +59,26 @@ class Consumer extends \Magento\Backend\Controller\AbstractAction /** @var \Magento\Oauth\Helper\Service */ protected $_oauthHelper; - /** @var \Magento\Core\Model\Logger */ + /** @var \Magento\Logger */ protected $_logger; /** - * Class constructor - * * @param \Magento\Core\Model\Registry $registry * @param \Magento\Oauth\Helper\Service $oauthHelper * @param \Magento\Oauth\Model\Consumer\Factory $consumerFactory * @param \Magento\Oauth\Service\OauthV1Interface $oauthService - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Backend\Controller\Context $context - * @param string $areaCode */ public function __construct( \Magento\Core\Model\Registry $registry, \Magento\Oauth\Helper\Service $oauthHelper, \Magento\Oauth\Model\Consumer\Factory $consumerFactory, \Magento\Oauth\Service\OauthV1Interface $oauthService, - \Magento\Core\Model\Logger $logger, - \Magento\Backend\Controller\Context $context, - $areaCode = null + \Magento\Logger $logger, + \Magento\Backend\Controller\Context $context ) { - parent::__construct($context, $areaCode); + parent::__construct($context); $this->_registry = $registry; $this->_oauthHelper = $oauthHelper; $this->_consumerFactory = $consumerFactory; @@ -264,7 +260,7 @@ class Consumer extends \Magento\Backend\Controller\AbstractAction $this->_setFormData(null); } catch (\Magento\Core\Exception $e) { $this->_setFormData($data); - $this->_getSession()->addError($this->_oauthHelper->escapeHtml($e->getMessage())); + $this->_getSession()->addError($this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage())); $this->getRequest()->setParam('back', 'edit'); } catch (\Exception $e) { $this->_setFormData(null); diff --git a/app/code/Magento/Oauth/Exception.php b/app/code/Magento/Oauth/Exception.php index da9851438ba02a0f3e42da7cf2a6abb8041d6f00..d3e7e91c9a5fcf7ae784693da6cbc6d7707bd9a5 100644 --- a/app/code/Magento/Oauth/Exception.php +++ b/app/code/Magento/Oauth/Exception.php @@ -40,9 +40,15 @@ class Exception extends \Magento\Webapi\Exception * @param int $code * @param int $httpCode * @param array $details + * @param string $name */ - public function __construct($message, $code = 0, $httpCode = self::HTTP_UNAUTHORIZED, array $details = array()) - { - parent::__construct($message, $code, $httpCode, $details); + public function __construct( + $message, + $code = 0, + $httpCode = self::HTTP_UNAUTHORIZED, + array $details = array(), + $name = 'oauth' + ) { + parent::__construct($message, $code, $httpCode, $details, $name); } } diff --git a/app/code/Magento/Oauth/Helper/Service.php b/app/code/Magento/Oauth/Helper/Service.php index a51069f917e7f8073311f1a1c7a94ff4eaa351ca..c2af696b56ff74f65e879ad67a1f3f115e5c9433 100644 --- a/app/code/Magento/Oauth/Helper/Service.php +++ b/app/code/Magento/Oauth/Helper/Service.php @@ -53,29 +53,28 @@ class Service extends \Magento\Core\Helper\AbstractHelper */ const CALLBACK_ESTABLISHED = 'oob'; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** @var \Magento\Core\Model\Store\Config */ protected $_storeConfig; /** - * @param \Magento\Core\Helper\Data $coreData + * @var \Magento\Math\Random + */ + protected $mathRandom; + + /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Math\Random $mathRandom + * @internal param \Magento\Core\Helper\Data $coreData */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Core\Helper\Context $context, - \Magento\Core\Model\Store\Config $storeConfig + \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Math\Random $mathRandom ) { parent::__construct($context); - $this->_coreData = $coreData; $this->_storeConfig = $storeConfig; + $this->mathRandom = $mathRandom; } /** @@ -93,9 +92,9 @@ class Service extends \Magento\Core\Helper\AbstractHelper $randomString = substr($hex, 0, $length); // truncate at most 1 char if length parameter is an odd number } else { // fallback to mt_rand() if openssl is not installed - $randomString = $this->_coreData->getRandomString( + $randomString = $this->mathRandom->getRandomString( $length, - \Magento\Core\Helper\Data::CHARS_DIGITS . \Magento\Core\Helper\Data::CHARS_LOWERS + \Magento\Math\Random::CHARS_DIGITS . \Magento\Math\Random::CHARS_LOWERS ); } diff --git a/app/code/Magento/Oauth/Model/Nonce.php b/app/code/Magento/Oauth/Model/Nonce.php index a000e67fa5f82f31cfcaef1eff7f5f701059379f..a6e1a032d1a6b05f2e7944642871bc4a82e7fc12 100644 --- a/app/code/Magento/Oauth/Model/Nonce.php +++ b/app/code/Magento/Oauth/Model/Nonce.php @@ -97,7 +97,9 @@ class Nonce extends \Magento\Core\Model\AbstractModel */ public function loadByCompositeKey($nonce, $consumerId) { - $this->setData($this->getResource()->selectByCompositeKey($nonce, $consumerId)); + /** @var \Magento\Oauth\Model\Resource\Nonce $resource */ + $resource = $this->getResource(); + $this->setData($resource->selectByCompositeKey($nonce, $consumerId)); return $this; } } diff --git a/app/code/Magento/Oauth/Model/Resource/Consumer.php b/app/code/Magento/Oauth/Model/Resource/Consumer.php index 6e534a041f6260aa38e02852d1eb120be3199735..d410bcf614a66984e61ee2b735ed8bc149d1094c 100644 --- a/app/code/Magento/Oauth/Model/Resource/Consumer.php +++ b/app/code/Magento/Oauth/Model/Resource/Consumer.php @@ -31,6 +31,21 @@ namespace Magento\Oauth\Model\Resource; class Consumer extends \Magento\Core\Model\Resource\Db\AbstractDb { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\App\Resource $resource + */ + public function __construct(\Magento\Stdlib\DateTime $dateTime, \Magento\App\Resource $resource) + { + $this->dateTime = $dateTime; + parent::__construct($resource); + } + /** * Initialize resource model * @@ -49,7 +64,7 @@ class Consumer extends \Magento\Core\Model\Resource\Db\AbstractDb */ public function _beforeSave(\Magento\Core\Model\AbstractModel $object) { - $object->setUpdatedAt($this->formatDate(time())); + $object->setUpdatedAt($this->dateTime->formatDate(time())); return parent::_beforeSave($object); } diff --git a/app/code/Magento/Oauth/Model/Resource/Nonce.php b/app/code/Magento/Oauth/Model/Resource/Nonce.php index 056edffed8e6463389a4d2ba047c0569763b1fd5..33fc9f2dc2f87368119d8089033fa41329cda166 100644 --- a/app/code/Magento/Oauth/Model/Resource/Nonce.php +++ b/app/code/Magento/Oauth/Model/Resource/Nonce.php @@ -77,6 +77,8 @@ class Nonce extends \Magento\Core\Model\Resource\Db\AbstractDb $select = $adapter->select() ->from($this->getMainTable()) ->where('nonce = ?', $nonce)->where('consumer_id = ?', $consumerId); - return $adapter->fetchRow($select); + $row = $adapter->fetchRow($select); + + return $row ? $row : array(); } } diff --git a/app/code/Magento/Oauth/Model/Resource/Token.php b/app/code/Magento/Oauth/Model/Resource/Token.php index 0f302833bc12dc511d5bf1c6202162bbdddee95a..d7d55e33a24ba838180cbd0330521704c0a95796 100644 --- a/app/code/Magento/Oauth/Model/Resource/Token.php +++ b/app/code/Magento/Oauth/Model/Resource/Token.php @@ -35,10 +35,23 @@ namespace Magento\Oauth\Model\Resource; class Token extends \Magento\Core\Model\Resource\Db\AbstractDb { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\App\Resource $resource + */ + public function __construct(\Magento\Stdlib\DateTime $dateTime, \Magento\App\Resource $resource) + { + $this->dateTime = $dateTime; + parent::__construct($resource); + } + /** * Initialize resource model - * - * @return void */ protected function _construct() { @@ -88,7 +101,7 @@ class Token extends \Magento\Core\Model\Resource\Db\AbstractDb $this->getMainTable(), $adapter->quoteInto( 'type = "' . \Magento\Oauth\Model\Token::TYPE_REQUEST . '" AND created_at <= ?', - \Magento\Date::formatDate(time() - $minutes * 60) + $this->dateTime->formatDate(time() - $minutes * 60) ) ); } else { diff --git a/app/code/Magento/Oauth/Model/Token.php b/app/code/Magento/Oauth/Model/Token.php index 2b521313ba7c1e1d09771dbe49ad544ad72db8a4..5239c3bfe57c4cc4cc342110672de4bdc3633b48 100644 --- a/app/code/Magento/Oauth/Model/Token.php +++ b/app/code/Magento/Oauth/Model/Token.php @@ -22,12 +22,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Oauth\Model; + /** * oAuth token model * - * @category Magento - * @package Magento_Oauth - * @author Magento Core Team <core@magentocommerce.com> * @method string getName() Consumer name (joined from consumer table) * @method \Magento\Oauth\Model\Resource\Token\Collection getCollection() * @method \Magento\Oauth\Model\Resource\Token\Collection getResourceCollection() @@ -54,8 +53,6 @@ * @method int getAuthorized() * @method \Magento\Oauth\Model\Token setAuthorized() setAuthorized(int $authorized) */ -namespace Magento\Oauth\Model; - class Token extends \Magento\Core\Model\AbstractModel { /**#@+ @@ -96,9 +93,15 @@ class Token extends \Magento\Core\Model\AbstractModel */ protected $keyLengthFactory; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Oauth\Model\Consumer\Validator\KeyLengthFactory $keyLengthFactory * @param \Magento\Url\Validator $urlValidator + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Oauth\Model\Consumer\Factory $consumerFactory * @param \Magento\Oauth\Helper\Service $oauthData * @param \Magento\Core\Model\Context $context @@ -110,6 +113,7 @@ class Token extends \Magento\Core\Model\AbstractModel public function __construct( \Magento\Oauth\Model\Consumer\Validator\KeyLengthFactory $keyLengthFactory, \Magento\Url\Validator $urlValidator, + \Magento\Stdlib\DateTime $dateTime, \Magento\Oauth\Model\Consumer\Factory $consumerFactory, \Magento\Oauth\Helper\Service $oauthData, \Magento\Core\Model\Context $context, @@ -120,6 +124,7 @@ class Token extends \Magento\Core\Model\AbstractModel ) { $this->keyLengthFactory = $keyLengthFactory; $this->urlValidator = $urlValidator; + $this->dateTime = $dateTime; parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_consumerFactory = $consumerFactory; $this->_oauthData = $oauthData; @@ -289,7 +294,7 @@ class Token extends \Magento\Core\Model\AbstractModel $this->validate(); if ($this->isObjectNew() && null === $this->getCreatedAt()) { - $this->setCreatedAt(\Magento\Date::now()); + $this->setCreatedAt($this->dateTime->now()); } parent::_beforeSave(); return $this; diff --git a/app/code/Magento/Oauth/Service/OauthV1.php b/app/code/Magento/Oauth/Service/OauthV1.php index ccf67ae46aad191f23b356d61c68b4cfc33cfef1..62886e5b155dd0319dfc98298834d85620d46f40 100644 --- a/app/code/Magento/Oauth/Service/OauthV1.php +++ b/app/code/Magento/Oauth/Service/OauthV1.php @@ -90,8 +90,8 @@ class OauthV1 implements \Magento\Oauth\Service\OauthV1Interface * @param \Magento\Oauth\Model\Consumer\Factory $consumerFactory * @param \Magento\Oauth\Model\Nonce\Factory $nonceFactory * @param \Magento\Oauth\Model\Token\Factory $tokenFactory - * @param \Magento\Core\Model\StoreManagerInterface - * @param \Magento\HTTP\ZendClient + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\HTTP\ZendClient $httpClient * @param \Zend_Oauth_Http_Utility $httpUtility * @param \Magento\Core\Model\Date $date */ diff --git a/app/code/Magento/Oauth/etc/config.xml b/app/code/Magento/Oauth/etc/config.xml index bd080e724dc005e97f0a6db2423d3df1cd4a6b65..a42cd98b1d77075a8ccd7b25512aeb2029b1e76f 100644 --- a/app/code/Magento/Oauth/etc/config.xml +++ b/app/code/Magento/Oauth/etc/config.xml @@ -26,8 +26,6 @@ */ --> <config> - <global> - </global> <default> <oauth> <cleanup> diff --git a/app/code/Magento/Oauth/etc/di.xml b/app/code/Magento/Oauth/etc/di.xml index cb21abad3a0517f2e093907c12eed44c340544d2..9b7e5c54053daeffab8322373784be68fc50f505 100644 --- a/app/code/Magento/Oauth/etc/di.xml +++ b/app/code/Magento/Oauth/etc/di.xml @@ -23,5 +23,10 @@ */ --> <config> - <preference for="Magento\Oauth\Service\OauthV1Interface" type="Magento\Oauth\Service\OauthV1" /> + <preference for="Magento\Oauth\Service\OauthV1Interface" type="Magento\Oauth\Service\OauthV1"/> + <type name="Magento\Oauth\Service\OauthV1"> + <param name="date"> + <instance type="Magento\Core\Model\Date\Proxy"/> + </param> + </type> </config> diff --git a/app/code/Magento/Ogone/Model/Api.php b/app/code/Magento/Ogone/Model/Api.php index 1c0008bf831dcd258cc692c3e2bba7feaea427c1..3c4b524c0e43eadda9a7176b488e9c51d138b196 100644 --- a/app/code/Magento/Ogone/Model/Api.php +++ b/app/code/Magento/Ogone/Model/Api.php @@ -24,11 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Ogone\Model; + /** * Ogone payment method model */ -namespace Magento\Ogone\Model; - class Api extends \Magento\Payment\Model\Method\AbstractMethod { /** @@ -168,25 +168,23 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod /** * Parameters hashing context - * @var string */ const HASH_DIR_OUT = 'out'; const HASH_DIR_IN = 'in'; /** * Supported hashing algorithms - * @var string */ const HASH_SHA1 = 'sha1'; const HASH_SHA256 = 'sha256'; const HASH_SHA512 = 'sha512'; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * @var \Magento\UrlInterface @@ -212,7 +210,7 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\UrlInterface $urlBuilder - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Ogone\Model\Config $config * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param array $data @@ -224,7 +222,7 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\LocaleInterface $locale, \Magento\UrlInterface $urlBuilder, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Ogone\Model\Config $config, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, array $data = array() @@ -232,7 +230,7 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod $this->_storeManager = $storeManager; $this->_locale = $locale; $this->_urlBuilder = $urlBuilder; - $this->_coreString = $coreString; + $this->string = $string; $this->_config = $config; parent::__construct($eventManager, $paymentData, $coreStoreConfig, $logAdapterFactory, $data); } @@ -455,12 +453,12 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod continue; } //COM filed can only handle max 100 - if ($this->_coreString->strlen($invoiceDesc.$item->getName()) > 100) { + if ($this->string->strlen($invoiceDesc.$item->getName()) > 100) { break; } $invoiceDesc .= $item->getName() . ', '; } - return $this->_coreString->substr($invoiceDesc, 0, -2); + return $this->string->substr($invoiceDesc, 0, -2); } /** diff --git a/app/code/Magento/Ogone/Model/Config.php b/app/code/Magento/Ogone/Model/Config.php index 7539df6ea65ad0f8427788bdeaf3c625f48b59ff..b9f33c660f2f21affcf88b0219fc57ff3132d12d 100644 --- a/app/code/Magento/Ogone/Model/Config.php +++ b/app/code/Magento/Ogone/Model/Config.php @@ -34,20 +34,18 @@ class Config extends \Magento\Payment\Model\Config const OGONE_PAYMENT_PATH = 'payment/ogone/'; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\UrlInterface */ - protected $_coreData = null; + protected $_urlBuilder; /** - * @var \Magento\UrlInterface + * @var \Magento\Encryption\EncryptorInterface */ - protected $_urlBuilder; + protected $_encryptor; /** * @param \Magento\UrlInterface $urlBuilder - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\Payment\Model\Method\Factory $paymentMethodFactory @@ -56,7 +54,7 @@ class Config extends \Magento\Payment\Model\Config */ public function __construct( \Magento\UrlInterface $urlBuilder, - \Magento\Core\Helper\Data $coreData, + \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Config $coreConfig, \Magento\Payment\Model\Method\Factory $paymentMethodFactory, @@ -65,7 +63,7 @@ class Config extends \Magento\Payment\Model\Config ) { parent::__construct($coreStoreConfig, $coreConfig, $paymentMethodFactory, $locale, $dataStorage); $this->_urlBuilder = $urlBuilder; - $this->_coreData = $coreData; + $this->_encryptor = $encryptor; } /** @@ -91,7 +89,7 @@ class Config extends \Magento\Payment\Model\Config */ public function getShaInCode($storeId=null) { - return $this->_coreData->decrypt($this->getConfigData('secret_key_in', $storeId)); + return $this->_encryptor->decrypt($this->getConfigData('secret_key_in', $storeId)); } /** @@ -101,7 +99,7 @@ class Config extends \Magento\Payment\Model\Config */ public function getShaOutCode($storeId=null) { - return $this->_coreData->decrypt($this->getConfigData('secret_key_out', $storeId)); + return $this->_encryptor->decrypt($this->getConfigData('secret_key_out', $storeId)); } /** diff --git a/app/code/Magento/Page/Block/Html/Welcome.php b/app/code/Magento/Page/Block/Html/Welcome.php index e9588db92f73a56ee42efbe660dc1d37e052b3ed..54a510c4ba284d0f735a2a913d38f57803124d88 100644 --- a/app/code/Magento/Page/Block/Html/Welcome.php +++ b/app/code/Magento/Page/Block/Html/Welcome.php @@ -24,40 +24,28 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Page\Block\Html; + /** * Html page block - * - * @category Magento - * @package Magento_Page - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Page\Block\Html; - class Welcome extends \Magento\Core\Block\Template { /** - * @var \Magento\View\LayoutInterface - */ - protected $_layout; - - /** - * @param \Magento\View\LayoutInterface $layout * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Block\Template\Context $context * @param array $data */ public function __construct( - \Magento\View\LayoutInterface $layout, \Magento\Core\Helper\Data $coreData, \Magento\Core\Block\Template\Context $context, array $data = array() ) { - $this->_layout = $layout; parent::__construct($coreData, $context, $data); } /** - * Get block messsage + * Get block message * * @return string */ diff --git a/app/code/Magento/Page/Block/Link/Current.php b/app/code/Magento/Page/Block/Link/Current.php index 14d2de1622cf0de5a640d759f5e9b21b64a0ad1b..82611b37c396cc1f1f9f81f82ce8deaf4cde637c 100644 --- a/app/code/Magento/Page/Block/Link/Current.php +++ b/app/code/Magento/Page/Block/Link/Current.php @@ -41,6 +41,30 @@ class Current extends \Magento\Core\Block\Template */ protected $_template = 'Magento_Page::link/current.phtml'; + /** + * Default path + * + * @var \Magento\App\DefaultPathInterface + */ + protected $_defaultPath; + + /** + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Core\Block\Template\Context $context + * @param \Magento\App\DefaultPathInterface $defaultPath + * @param array $data + */ + public function __construct( + \Magento\Core\Helper\Data $coreData, + \Magento\Core\Block\Template\Context $context, + \Magento\App\DefaultPathInterface $defaultPath, + array $data = array() + ) { + parent::__construct($coreData, $context, $data); + $this->_defaultPath = $defaultPath; + } + + /** * @return string */ @@ -61,11 +85,10 @@ class Current extends \Magento\Core\Block\Template 'controller' => $this->_request->getControllerName(), 'action' => $this->_request->getActionName(), ); - $dafaultsParams = $this->_frontController->getDefault(); $parts = array(); foreach ($routeParts as $key => $value) { - if (!empty($value) && (!isset($dafaultsParams[$key]) || $value != $dafaultsParams[$key])) { + if (!empty($value) && ($value != $this->_defaultPath->getPart($key))) { $parts[] = $value; } } diff --git a/app/code/Magento/Page/Block/Redirect.php b/app/code/Magento/Page/Block/Redirect.php index f16b53527e15516d758d63f637405685330bdc3c..f3a8f66a0308d6e1665164abb5629f56b6ca92ec 100644 --- a/app/code/Magento/Page/Block/Redirect.php +++ b/app/code/Magento/Page/Block/Redirect.php @@ -47,13 +47,13 @@ class Redirect extends \Magento\Core\Block\Template protected $_formFactory; /** - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Block\Template\Context $context * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Core\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Page/Model/Config/SchemaLocator.php b/app/code/Magento/Page/Model/Config/SchemaLocator.php index e0bb038821b6fb342e53aeafa8129ef1d2cdf9d6..cd17bdabf20db7218b2ac984555f26baa84425a7 100644 --- a/app/code/Magento/Page/Model/Config/SchemaLocator.php +++ b/app/code/Magento/Page/Model/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Page') . '/page_layouts.xsd'; $this->_perFileSchema = $moduleReader->getModuleDir('etc', 'Magento_Page') . '/page_layouts_file.xsd'; diff --git a/app/code/Magento/PageCache/Model/CacheControlFactory.php b/app/code/Magento/PageCache/Model/CacheControlFactory.php index 756bd2fbf678532650e1779edf332fbeb75be1d9..4f2bccbb436acd7f2f64c860cab3646d94307968 100644 --- a/app/code/Magento/PageCache/Model/CacheControlFactory.php +++ b/app/code/Magento/PageCache/Model/CacheControlFactory.php @@ -31,11 +31,6 @@ namespace Magento\PageCache\Model; class CacheControlFactory { - /** - * Path to external cache controls - */ - const XML_PATH_EXTERNAL_CACHE_CONTROLS = 'global/external_cache/controls'; - /** * Paths to external cache config option */ @@ -49,32 +44,30 @@ class CacheControlFactory protected $_objectManager; /** - * Config + * Core store config * - * @var \Magento\Centinel\Model\Config + * @var \Magento\Core\Model\Store\Config */ - protected $_config; + protected $_storeConfig; /** - * Core store config - * - * @var \Magento\Core\Model\Store\Config + * @var array */ - protected $_coreStoreConfig; + protected $_cacheControls; /** * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\ConfigInterface $config - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Core\Model\Store\Config $storeConfig + * @param array $cacheControls */ public function __construct( \Magento\ObjectManager $objectManager, - \Magento\Core\Model\ConfigInterface $config, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\Core\Model\Store\Config $storeConfig, + array $cacheControls = array() ) { $this->_objectManager = $objectManager; - $this->_config = $config; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_storeConfig = $storeConfig; + $this->_cacheControls = $cacheControls; } /** @@ -84,8 +77,7 @@ class CacheControlFactory */ public function getCacheControls() { - $controls = $this->_config->getNode(self::XML_PATH_EXTERNAL_CACHE_CONTROLS); - return $controls instanceof \Magento\Simplexml\Element ? $controls->asCanonicalArray() : array(); + return $this->_cacheControls; } /** @@ -96,11 +88,11 @@ class CacheControlFactory */ public function getCacheControlInstance() { - $usedControl = $this->_coreStoreConfig->getConfig(self::XML_PATH_EXTERNAL_CACHE_CONTROL); + $usedControl = $this->_storeConfig->getConfig(self::XML_PATH_EXTERNAL_CACHE_CONTROL); if ($usedControl) { foreach ($this->getCacheControls() as $control => $info) { - if ($control == $usedControl && !empty($info['class'])) { - return $this->_objectManager->get($info['class']); + if ($control == $usedControl && !empty($info['instance'])) { + return $this->_objectManager->get($info['instance']); } } } diff --git a/app/code/Magento/PageCache/Model/Observer.php b/app/code/Magento/PageCache/Model/Observer.php index e9aed9bfa7689d567582a77e4c00ecabaab5d611..ae7564d39aab6bd4a9467c58feb7ecc754358d13 100644 --- a/app/code/Magento/PageCache/Model/Observer.php +++ b/app/code/Magento/PageCache/Model/Observer.php @@ -45,20 +45,18 @@ class Observer protected $_pageCacheData = null; /** - * @var \Magento\Core\Model\Config + * @var array */ - protected $_coreConfig; + protected $_allowedCache; /** * @param \Magento\PageCache\Helper\Data $pageCacheData - * @param \Magento\Core\Model\Config $coreConfig + * @param array $allowedCache */ - public function __construct( - \Magento\PageCache\Helper\Data $pageCacheData, - \Magento\Core\Model\Config $coreConfig - ) { + public function __construct(\Magento\PageCache\Helper\Data $pageCacheData, array $allowedCache = array()) + { $this->_pageCacheData = $pageCacheData; - $this->_coreConfig = $coreConfig; + $this->_allowedCache = $allowedCache; } /** @@ -90,26 +88,26 @@ class Observer $needCaching = false; } - $configuration = $this->_coreConfig->getNode(self::XML_NODE_ALLOWED_CACHE); - - if (!$configuration) { + if (empty($this->_allowedCache)) { $needCaching = false; } - $configuration = $configuration->asArray(); $module = $request->getModuleName(); $controller = $request->getControllerName(); $action = $request->getActionName(); - if (!isset($configuration[$module])) { + + if (!isset($this->_allowedCache[$module])) { $needCaching = false; } - if (isset($configuration[$module]['controller']) && $configuration[$module]['controller'] != $controller) { + if (isset($this->_allowedCache[$module]['controller']) + && $this->_allowedCache[$module]['controller'] != $controller + ) { $needCaching = false; } - if (isset($configuration[$module]['action']) && $configuration[$module]['action'] != $action) { + if (isset($this->_allowedCache[$module]['action']) && $this->_allowedCache[$module]['action'] != $action) { $needCaching = false; } diff --git a/app/code/Magento/PageCache/etc/config.xml b/app/code/Magento/PageCache/etc/config.xml index a6ef64b34126e3c51010143e48dbfa7d1b816762..3f514e828b0e96a027c66f4bf868a03f6325be43 100644 --- a/app/code/Magento/PageCache/etc/config.xml +++ b/app/code/Magento/PageCache/etc/config.xml @@ -26,23 +26,6 @@ */ --> <config> - <frontend> - <cache> - <allowed_requests> - <cms /> - <catalog> - <category> - <view /> - </category> - </catalog> - <catalog> - <product> - <view /> - </product> - </catalog> - </allowed_requests> - </cache> - </frontend> <default> <system> <external_page_cache> diff --git a/app/code/Magento/PageCache/etc/di.xml b/app/code/Magento/PageCache/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..71fb3df45807c9c310592fcda2895c10082c2f67 --- /dev/null +++ b/app/code/Magento/PageCache/etc/di.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <type name="Magento\PageCache\Model\CacheControlFactory"> + <param name="cacheControls"> + <value> + <zendPageCache> + <instance>Magento\PageCache\Model\Control\Zend</instance> + <label>Zend Full Page Cache</label> + </zendPageCache> + </value> + </param> + </type> +</config> \ No newline at end of file diff --git a/app/code/Magento/PageCache/etc/frontend/di.xml b/app/code/Magento/PageCache/etc/frontend/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc8b77c9ed6eee609b61dbefc4e2eab7963c1ef3 --- /dev/null +++ b/app/code/Magento/PageCache/etc/frontend/di.xml @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <type name="Magento\PageCache\Model\Observer"> + <param name="allowedCache"> + <value> + <cms>true</cms> + <catalog> + <category> + <view>true</view> + </category> + <product> + <view>true</view> + </product> + </catalog> + </value> + </param> + </type> +</config> \ No newline at end of file diff --git a/app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php b/app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php index dc6eb3ea7f7809d8dfb43976ec4f76944ca513a1..28bda85ce6d4bfd2ecb595a8812f2b5c372c134c 100644 --- a/app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php +++ b/app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php @@ -77,10 +77,10 @@ class Payment extends \Magento\Backend\Controller\Adminhtml\Action $result['success'] = true; $result['update_html'] = $this->_getPaymentMethodsHtml(); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $result['error_message'] = $e->getMessage(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $result['error_message'] = __('Something went wrong canceling the transactions.'); } diff --git a/app/code/Magento/Paygate/Controller/Authorizenet/Payment.php b/app/code/Magento/Paygate/Controller/Authorizenet/Payment.php index 2f7acdaa32e2caab4f243177e7790a90d228e90a..ceefc90e318e042a630268abab6966b7cacb3177 100644 --- a/app/code/Magento/Paygate/Controller/Authorizenet/Payment.php +++ b/app/code/Magento/Paygate/Controller/Authorizenet/Payment.php @@ -72,10 +72,10 @@ class Payment extends \Magento\Core\Controller\Front\Action $result['success'] = true; $result['update_html'] = $this->_getPaymentMethodsHtml(); } catch (\Magento\Core\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $result['error_message'] = $e->getMessage(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $result['error_message'] = __('There was an error canceling transactions. Please contact us or try again later.'); } diff --git a/app/code/Magento/Paygate/Model/Authorizenet.php b/app/code/Magento/Paygate/Model/Authorizenet.php index c79fd2a9da494fd10f0cc452e9cb4f206d4624dd..6ff983a39663beca414533555bba368669289cbd 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet.php +++ b/app/code/Magento/Paygate/Model/Authorizenet.php @@ -238,10 +238,10 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Core\Model\Session\AbstractSession $session - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Paygate\Helper\Data $paygateData - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory @@ -255,10 +255,10 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Core\Model\Session\AbstractSession $session, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\Paygate\Helper\Data $paygateData, - \Magento\App\ModuleListInterface $moduleList, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, diff --git a/app/code/Magento/Payment/Model/Config/SchemaLocator.php b/app/code/Magento/Payment/Model/Config/SchemaLocator.php index 48966e5466a2286231749ee5634db44ee7451374..b64b52d6f7f2ad0464bbbef8fad0871039864753 100644 --- a/app/code/Magento/Payment/Model/Config/SchemaLocator.php +++ b/app/code/Magento/Payment/Model/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Payment') . '/payment.xsd'; $this->_perFileSchema = $moduleReader->getModuleDir('etc', 'Magento_Payment') . '/payment_file.xsd'; diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php index ccc7ddc7b1ecb0dce80de691170044f15fa50277..15a7d07acded36a373ffe34427fe6dcfa5b1d452 100644 --- a/app/code/Magento/Payment/Model/Info.php +++ b/app/code/Magento/Payment/Model/Info.php @@ -46,32 +46,30 @@ class Info extends \Magento\Core\Model\AbstractModel protected $_paymentData = null; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Encryption\EncryptorInterface */ - protected $_coreData = null; + protected $_encryptor; /** - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreData = $coreData; $this->_paymentData = $paymentData; + $this->_encryptor = $encryptor; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -129,7 +127,7 @@ class Info extends \Magento\Core\Model\AbstractModel public function encrypt($data) { if ($data) { - return $this->_coreData->encrypt($data); + return $this->_encryptor->encrypt($data); } return $data; } @@ -143,7 +141,7 @@ class Info extends \Magento\Core\Model\AbstractModel public function decrypt($data) { if ($data) { - return $this->_coreData->decrypt($data); + return $this->_encryptor->decrypt($data); } return $data; } diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index 577b38313c745b7aaf9d503ae4847dd8969cead1..368c36a8ef2067080a5094541e52d05ad87299a3 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -33,7 +33,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod protected $_canSaveCc = false; /** - * @var \Magento\App\ModuleListInterface + * @var \Magento\Module\ModuleListInterface */ protected $_moduleList; @@ -54,17 +54,17 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * Construct * - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** * Construct * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Core\Model\LocaleInterface $locale @@ -72,10 +72,10 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod * @param array $data */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ModuleListInterface $moduleList, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Core\Model\LocaleInterface $locale, diff --git a/app/code/Magento/Payment/Model/Recurring/Profile.php b/app/code/Magento/Payment/Model/Recurring/Profile.php index 7fe2f18d7f2cfcbee2e4493555208b7e65ee7620..e73f9fc19f704d1cf96bb3387ee8987ada268e11 100644 --- a/app/code/Magento/Payment/Model/Recurring/Profile.php +++ b/app/code/Magento/Payment/Model/Recurring/Profile.php @@ -126,7 +126,7 @@ class Profile extends \Magento\Core\Model\AbstractModel // start date, order ref ID, schedule description if (!$this->getStartDatetime()) { $this->_errors['start_datetime'][] = __('The start date is undefined.'); - } elseif (!\Zend_Date::isDate($this->getStartDatetime(), \Magento\Date::DATETIME_INTERNAL_FORMAT)) { + } elseif (!\Zend_Date::isDate($this->getStartDatetime(), \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)) { $this->_errors['start_datetime'][] = __('The start date has an invalid format.'); } if (!$this->getScheduleDescription()) { @@ -248,7 +248,7 @@ class Profile extends \Magento\Core\Model\AbstractModel throw new \Magento\Core\Exception(__('The recurring profile start date has invalid format.')); } $utcTime = $this->_locale->utcDate($this->_store, $startDate, true, $dateFormat) - ->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + ->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); $this->setStartDatetime($utcTime)->setImportedStartDatetime($startDate); } return $this->_filterValues(); @@ -279,7 +279,7 @@ class Profile extends \Magento\Core\Model\AbstractModel if (is_array($options)) { if (isset($options['start_datetime'])) { $startDatetime = new \Zend_Date($options['start_datetime'], - \Magento\Date::DATETIME_INTERNAL_FORMAT); + \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); $this->setNearestStartDatetime($startDatetime); } } @@ -326,7 +326,7 @@ class Profile extends \Magento\Core\Model\AbstractModel if (!$date || $date->getTimestamp() < time()) { $date = new \Zend_Date(time()); } - $this->setStartDatetime($date->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT)); + $this->setStartDatetime($date->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)); return $this; } @@ -578,7 +578,7 @@ class Profile extends \Magento\Core\Model\AbstractModel // automatically determine start date, if not set if ($this->getStartDatetime()) { - $date = new \Zend_Date($this->getStartDatetime(), \Magento\Date::DATETIME_INTERNAL_FORMAT); + $date = new \Zend_Date($this->getStartDatetime(), \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); $this->setNearestStartDatetime($date); } else { $this->setNearestStartDatetime(); diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details/Form.php b/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details/Form.php index 8747e62dd4e0817a56c8029100fef431e158fc77..3cfa27be14f216782dd8595691d2db411632e6e4 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details/Form.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/Settlement/Details/Form.php @@ -43,7 +43,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\LocaleInterface $locale @@ -52,7 +52,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\LocaleInterface $locale, diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php index b113e6489cdef34ede85cddf4f2775927f252f31..810742ccde5d9800179cefea1bc73559c6dc896e 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php @@ -213,7 +213,7 @@ class Location if (conflict && !confirmationShowed && anotherEnabler.value == 1) { if (isEvent) { - confirmationApproved = confirm(\'' . $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('There is already another PayPal solution enabled. Enable this solution instead?')) . '\'); + confirmationApproved = confirm(\'' . $this->escapeJsQuote(__('There is already another PayPal solution enabled. Enable this solution instead?')) . '\'); } else { paypalConflictsObject.isConflict = true; } @@ -312,14 +312,14 @@ class Location paypalConflictsObject.checkPaymentConflicts(enablerElement, "initial"); }); if (paypalConflictsObject.isConflict || paypalConflictsObject.ecMissed) { - var notification = \'' . $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('The following error(s) occured:')) . '\'; + var notification = \'' . $this->escapeJsQuote(__('The following error(s) occured:')) . '\'; if (paypalConflictsObject.isConflict) { - notification += "\\n " + \'' . $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Some PayPal solutions conflict.')) . '\'; + notification += "\\n " + \'' . $this->escapeJsQuote(__('Some PayPal solutions conflict.')) . '\'; } if (paypalConflictsObject.ecMissed) { - notification += "\\n " + \'' . $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('PayPal Express Checkout is not enabled.')) . '\'; + notification += "\\n " + \'' . $this->escapeJsQuote(__('PayPal Express Checkout is not enabled.')) . '\'; } - notification += "\\n" + \'' . $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Please re-enable the previously enabled payment solutions.')) . '\'; + notification += "\\n" + \'' . $this->escapeJsQuote(__('Please re-enable the previously enabled payment solutions.')) . '\'; setTimeout(function() { alert(notification); }, 1); diff --git a/app/code/Magento/Paypal/Block/Express/Shortcut.php b/app/code/Magento/Paypal/Block/Express/Shortcut.php index 36b1ec7a8b1dc926cbba9952e3c169ec56807158..86c0b5e0a5d4a8634033058dff09fd7ec408807c 100644 --- a/app/code/Magento/Paypal/Block/Express/Shortcut.php +++ b/app/code/Magento/Paypal/Block/Express/Shortcut.php @@ -111,6 +111,11 @@ class Shortcut extends \Magento\Core\Block\Template */ protected $_checkoutFactory; + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + /** * @param \Magento\Paypal\Helper\Data $paypalData * @param \Magento\Payment\Helper\Data $paymentData @@ -122,6 +127,7 @@ class Shortcut extends \Magento\Core\Block\Template * @param \Magento\Paypal\Model\ConfigFactory $paypalConfigFactory * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory + * @param \Magento\Math\Random $mathRandom * @param array $data */ public function __construct( @@ -135,6 +141,7 @@ class Shortcut extends \Magento\Core\Block\Template \Magento\Paypal\Model\ConfigFactory $paypalConfigFactory, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory, + \Magento\Math\Random $mathRandom, array $data = array() ) { $this->_coreRegistry = $registry; @@ -145,6 +152,7 @@ class Shortcut extends \Magento\Core\Block\Template $this->_paypalConfigFactory = $paypalConfigFactory; $this->_checkoutSession = $checkoutSession; $this->_checkoutFactory = $checkoutFactory; + $this->mathRandom = $mathRandom; parent::__construct($coreData, $context, $data); } @@ -193,7 +201,7 @@ class Shortcut extends \Magento\Core\Block\Template } // set misc data - $this->setShortcutHtmlId($this->helper('Magento\Core\Helper\Data')->uniqHash('ec_shortcut_')) + $this->setShortcutHtmlId($this->mathRandom->getUniqueHash('ec_shortcut_')) ->setCheckoutUrl($this->getUrl($this->_startAction)) ; diff --git a/app/code/Magento/Paypal/Block/Standard/Redirect.php b/app/code/Magento/Paypal/Block/Standard/Redirect.php index df060aa7de1a055500f4af869d4ddd88662dd77b..ff2e99b4898c585ea9dc734459e15351fcd3827c 100644 --- a/app/code/Magento/Paypal/Block/Standard/Redirect.php +++ b/app/code/Magento/Paypal/Block/Standard/Redirect.php @@ -28,14 +28,7 @@ namespace Magento\Paypal\Block\Standard; class Redirect extends \Magento\Core\Block\AbstractBlock { /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData; - - /** - * @var \Magento\Data\Form\Factory + * @var \Magento\Data\FormFactory */ protected $_formFactory; @@ -50,25 +43,30 @@ class Redirect extends \Magento\Core\Block\AbstractBlock protected $_paypalStandardFactory; /** - * @param \Magento\Data\Form\Factory $formFactory + * @var \Magento\Math\Random + */ + protected $mathRandom; + + /** + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Data\Form\Element\Factory $elementFactory - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Block\Context $context * @param \Magento\Paypal\Model\StandardFactory $paypalStandardFactory + * @param \Magento\Math\Random $mathRandom * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Data\Form\Element\Factory $elementFactory, - \Magento\Core\Helper\Data $coreData, \Magento\Core\Block\Context $context, \Magento\Paypal\Model\StandardFactory $paypalStandardFactory, + \Magento\Math\Random $mathRandom, array $data = array() ) { - $this->_coreData = $coreData; $this->_formFactory = $formFactory; $this->_elementFactory = $elementFactory; $this->_paypalStandardFactory = $paypalStandardFactory; + $this->mathRandom = $mathRandom; parent::__construct($context, $data); } @@ -88,7 +86,7 @@ class Redirect extends \Magento\Core\Block\AbstractBlock foreach ($standard->getStandardCheckoutFormFields() as $field => $value) { $form->addField($field, 'hidden', array('name' => $field, 'value' => $value)); } - $idSuffix = $this->_coreData->uniqHash(); + $idSuffix = $this->mathRandom->getUniqueHash(); $submitButton = $this->_elementFactory->create('submit', array('attributes' => array( 'value' => __('Click here if you are not redirected within 10 seconds.'), ))); diff --git a/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php b/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php index f3a8d93ff9c33a5bfe368318977e2e538409a4d0..5eb5e07bda37aaaabb97d8fabd2ddf0db90d49cc 100644 --- a/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php +++ b/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php @@ -49,7 +49,7 @@ class Reports extends \Magento\Backend\Controller\Adminhtml\Action protected $_settlementFactory; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; diff --git a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php index 2ceb18108582e7acf555c1ad541a3cb8bf336732..c47bebf804a80b600567cf8cb82f531601a9440e 100644 --- a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php +++ b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php @@ -196,7 +196,7 @@ abstract class AbstractExpress extends \Magento\Core\Controller\Front\Action $this->_getCheckoutSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getCheckoutSession()->addError(__('We can\'t start Express Checkout.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('checkout/cart'); @@ -214,7 +214,7 @@ abstract class AbstractExpress extends \Magento\Core\Controller\Front\Action $response = $this->_checkout->getShippingOptionsCallbackResponse($this->getRequest()->getParams()); $this->getResponse()->setBody($response); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } @@ -245,7 +245,7 @@ abstract class AbstractExpress extends \Magento\Core\Controller\Front\Action $this->_getCheckoutSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getCheckoutSession()->addError(__('Unable to cancel Express Checkout')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('checkout/cart'); @@ -265,7 +265,7 @@ abstract class AbstractExpress extends \Magento\Core\Controller\Front\Action $this->_checkoutSession->addError($e->getMessage()); } catch (\Exception $e) { $this->_checkoutSession->addError(__('We can\'t process Express Checkout approval.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('checkout/cart'); } @@ -294,7 +294,7 @@ abstract class AbstractExpress extends \Magento\Core\Controller\Front\Action $this->_checkoutSession->addError( __('We can\'t initialize Express Checkout review.') ); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('checkout/cart'); } @@ -332,7 +332,7 @@ abstract class AbstractExpress extends \Magento\Core\Controller\Front\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We can\'t update shipping method.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } if ($isAjax) { $this->getResponse()->setBody('<script type="text/javascript">window.location.href = ' @@ -360,7 +360,7 @@ abstract class AbstractExpress extends \Magento\Core\Controller\Front\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We can\'t update Order data.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody('<script type="text/javascript">window.location.href = ' . $this->_urlBuilder->getUrl('*/*/review') . ';</script>'); @@ -386,7 +386,7 @@ abstract class AbstractExpress extends \Magento\Core\Controller\Front\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We can\'t update Order data.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } if ($isAjax) { $this->getResponse()->setBody('<script type="text/javascript">window.location.href = ' @@ -460,7 +460,7 @@ abstract class AbstractExpress extends \Magento\Core\Controller\Front\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We can\'t place the order.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('*/*/review'); } diff --git a/app/code/Magento/Paypal/Controller/Ipn.php b/app/code/Magento/Paypal/Controller/Ipn.php index 8dbb5cf66819b4a3982e997e80d0c1a32b682a2a..194f0c9316aca0fe83ff174ee4fb97ad561c4879 100644 --- a/app/code/Magento/Paypal/Controller/Ipn.php +++ b/app/code/Magento/Paypal/Controller/Ipn.php @@ -30,7 +30,7 @@ namespace Magento\Paypal\Controller; class Ipn extends \Magento\Core\Controller\Front\Action { /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; diff --git a/app/code/Magento/Paypal/Controller/Payflow.php b/app/code/Magento/Paypal/Controller/Payflow.php index 49aa14b3310c38791fb3fff470094695df51dcb7..a1b20ef02dc19aa0b2e25d00cdfce42b1ebe843c 100644 --- a/app/code/Magento/Paypal/Controller/Payflow.php +++ b/app/code/Magento/Paypal/Controller/Payflow.php @@ -40,7 +40,7 @@ class Payflow extends \Magento\Core\Controller\Front\Action protected $_orderFactory; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; diff --git a/app/code/Magento/Paypal/Controller/Payflowadvanced.php b/app/code/Magento/Paypal/Controller/Payflowadvanced.php index e47af1598a87018746a74e8779371d2bb77c82a1..ed1b94c7dd8e56d259a3564098a29c585af22c74 100644 --- a/app/code/Magento/Paypal/Controller/Payflowadvanced.php +++ b/app/code/Magento/Paypal/Controller/Payflowadvanced.php @@ -51,7 +51,7 @@ class Payflowadvanced extends \Magento\Paypal\Controller\Express\AbstractExpress protected $_checkoutType = 'Magento\Paypal\Model\Payflowadvanced'; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; diff --git a/app/code/Magento/Paypal/Model/Api/AbstractApi.php b/app/code/Magento/Paypal/Model/Api/AbstractApi.php index 67d7652eba0bc8c7ef45e4ef1937d70aca80fefb..0809145454f2a74f6158589ee796178e9fad9755 100644 --- a/app/code/Magento/Paypal/Model/Api/AbstractApi.php +++ b/app/code/Magento/Paypal/Model/Api/AbstractApi.php @@ -103,7 +103,7 @@ abstract class AbstractApi extends \Magento\Object protected $_customerAddress; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -129,7 +129,7 @@ abstract class AbstractApi extends \Magento\Object * attributes This behavior may change in child classes * * @param \Magento\Customer\Helper\Address $customerAddress - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory @@ -137,7 +137,7 @@ abstract class AbstractApi extends \Magento\Object */ public function __construct( \Magento\Customer\Helper\Address $customerAddress, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\LocaleInterface $locale, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, diff --git a/app/code/Magento/Paypal/Model/Api/Nvp.php b/app/code/Magento/Paypal/Model/Api/Nvp.php index 1bbc4c306dc1446a96686ddf867393e8817104c1..2c4091f348a3c741fbd3bdee6d39b3bc48c0984f 100644 --- a/app/code/Magento/Paypal/Model/Api/Nvp.php +++ b/app/code/Magento/Paypal/Model/Api/Nvp.php @@ -576,7 +576,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi /** * @param \Magento\Customer\Helper\Address $customerAddress - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory @@ -585,7 +585,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi */ public function __construct( \Magento\Customer\Helper\Address $customerAddress, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\LocaleInterface $locale, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, diff --git a/app/code/Magento/Paypal/Model/Cert.php b/app/code/Magento/Paypal/Model/Cert.php index b6d50975ff98616cccab24ce922ca4107eb30c92..3130e8070f56dd7287d6a9d938d6304506158a6a 100644 --- a/app/code/Magento/Paypal/Model/Cert.php +++ b/app/code/Magento/Paypal/Model/Cert.php @@ -37,37 +37,35 @@ class Cert extends \Magento\Core\Model\AbstractModel const BASEPATH_PAYPAL_CERT = 'cert/paypal'; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\App\Dir */ - protected $_coreData; + protected $_coreDir; /** - * @var \Magento\App\Dir + * @var \Magento\Encryption\EncryptorInterface */ - protected $_coreDir; + protected $_encryptor; /** - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\App\Dir $coreDir + * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\App\Dir $coreDir, + \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreData = $coreData; $this->_coreDir = $coreDir; + $this->_encryptor = $encryptor; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -129,7 +127,7 @@ class Cert extends \Magento\Core\Model\AbstractModel $this->_removeOutdatedCertFile(); } - file_put_contents($file, $this->_coreData->decrypt($this->getContent())); + file_put_contents($file, $this->_encryptor->decrypt($this->getContent())); } /** diff --git a/app/code/Magento/Paypal/Model/Direct.php b/app/code/Magento/Paypal/Model/Direct.php index f671cdad2b9d7a2870affd81748722b3d0567542..7e0e8f0aa57feefde43cb56422fb89b624a54abd 100644 --- a/app/code/Magento/Paypal/Model/Direct.php +++ b/app/code/Magento/Paypal/Model/Direct.php @@ -99,10 +99,10 @@ class Direct extends \Magento\Payment\Model\Method\Cc protected $_cartFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Core\Model\LocaleInterface $locale @@ -117,10 +117,10 @@ class Direct extends \Magento\Payment\Model\Method\Cc * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ModuleListInterface $moduleList, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Core\Model\LocaleInterface $locale, diff --git a/app/code/Magento/Paypal/Model/Express/Checkout.php b/app/code/Magento/Paypal/Model/Express/Checkout.php index 760b2746eaf0d3037e05a7c349e82a08104d2583..0b0f3291b61d0c876c13712d6657909dcc6b105b 100644 --- a/app/code/Magento/Paypal/Model/Express/Checkout.php +++ b/app/code/Magento/Paypal/Model/Express/Checkout.php @@ -172,7 +172,7 @@ class Checkout protected $_customerData; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -229,7 +229,7 @@ class Checkout /** * Set config, session and quote instances * - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Customer\Helper\Data $customerData * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Tax\Helper\Data $taxData @@ -252,7 +252,7 @@ class Checkout * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Customer\Helper\Data $customerData, \Magento\Core\Helper\Data $coreData, \Magento\Tax\Helper\Data $taxData, diff --git a/app/code/Magento/Paypal/Model/Hostedpro.php b/app/code/Magento/Paypal/Model/Hostedpro.php index 9a70f8e3944435e9a90c645d64b799a623c3dc83..0791831edffe00201d04a69a0985b0a519c0b989 100644 --- a/app/code/Magento/Paypal/Model/Hostedpro.php +++ b/app/code/Magento/Paypal/Model/Hostedpro.php @@ -78,10 +78,10 @@ class Hostedpro extends \Magento\Paypal\Model\Direct protected $_hostedproRequestFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Core\Model\LocaleInterface $locale @@ -97,10 +97,10 @@ class Hostedpro extends \Magento\Paypal\Model\Direct * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ModuleListInterface $moduleList, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Core\Model\LocaleInterface $locale, diff --git a/app/code/Magento/Paypal/Model/Observer.php b/app/code/Magento/Paypal/Model/Observer.php index eaa57c6a4845ef10858dbd6a1baa80b023ba7645..702476d6b86ee29ac5b46aa0dcb0f873167eb968 100644 --- a/app/code/Magento/Paypal/Model/Observer.php +++ b/app/code/Magento/Paypal/Model/Observer.php @@ -53,7 +53,7 @@ class Observer protected $_coreData; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -66,14 +66,14 @@ class Observer * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Paypal\Helper\Hss $paypalHss * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Paypal\Model\Report\SettlementFactory $settlementFactory */ public function __construct( \Magento\Core\Helper\Data $coreData, \Magento\Paypal\Helper\Hss $paypalHss, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Paypal\Model\Report\SettlementFactory $settlementFactory ) { $this->_coreData = $coreData; diff --git a/app/code/Magento/Paypal/Model/Payflowlink.php b/app/code/Magento/Paypal/Model/Payflowlink.php index 61410d9f25a82c72ead2d0cca56aa9ae1d44daf8..e54f6d13b8af24e771a5d2997d1fdd2a2f27a58f 100644 --- a/app/code/Magento/Paypal/Model/Payflowlink.php +++ b/app/code/Magento/Paypal/Model/Payflowlink.php @@ -140,17 +140,17 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro protected $_websiteFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Centinel\Model\Service $centinelService - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Paypal\Model\ConfigFactory $configFactory + * @param \Magento\Math\Random $mathRandom * @param \Magento\Paypal\Model\Payflow\RequestFactory $requestFactory * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory @@ -161,17 +161,17 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ModuleListInterface $moduleList, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Core\Model\LocaleInterface $locale, \Magento\Centinel\Model\Service $centinelService, - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Paypal\Model\ConfigFactory $configFactory, + \Magento\Math\Random $mathRandom, \Magento\Paypal\Model\Payflow\RequestFactory $requestFactory, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Sales\Model\OrderFactory $orderFactory, @@ -193,9 +193,9 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro $logAdapterFactory, $locale, $centinelService, - $coreData, $storeManager, $configFactory, + $mathRandom, $data ); } @@ -573,7 +573,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro */ protected function _generateSecureTokenId() { - return $this->_coreData->uniqHash(); + return $this->mathRandom->getUniqueHash(); } /** @@ -628,7 +628,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro */ protected function _generateSecureSilentPostHash($payment) { - $secureHash = md5($this->_coreData->getRandomString(10)); + $secureHash = md5($this->mathRandom->getRandomString(10)); $payment->setAdditionalInformation($this->_secureSilentPostHashKey, $secureHash); return $secureHash; } diff --git a/app/code/Magento/Paypal/Model/Payflowpro.php b/app/code/Magento/Paypal/Model/Payflowpro.php index 5f2496cc75679e0db178f955c2d2632d7ee47f46..c393c14471c3562be63e0ae294b46e8c04117eb1 100644 --- a/app/code/Magento/Paypal/Model/Payflowpro.php +++ b/app/code/Magento/Paypal/Model/Payflowpro.php @@ -112,14 +112,6 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc 'centinel_eci' => 'ECI', 'centinel_xid' => 'XID', ); - - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData; - /** * @var \Magento\Core\Model\StoreManagerInterface */ @@ -131,38 +123,43 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc protected $_configFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @var \Magento\Math\Random + */ + protected $mathRandom; + + /** + * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Centinel\Model\Service $centinelService - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Paypal\Model\ConfigFactory $configFactory + * @param ConfigFactory $configFactory + * @param \Magento\Math\Random $mathRandom * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ModuleListInterface $moduleList, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Core\Model\LocaleInterface $locale, \Magento\Centinel\Model\Service $centinelService, - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Paypal\Model\ConfigFactory $configFactory, + \Magento\Math\Random $mathRandom, array $data = array() ) { - $this->_coreData = $coreData; $this->_storeManager = $storeManager; $this->_configFactory = $configFactory; + $this->mathRandom = $mathRandom; parent::__construct( $logger, $eventManager, @@ -551,7 +548,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc */ protected function _generateRequestId() { - return $this->_coreData->uniqHash(); + return $this->mathRandom->getUniqueHash(); } /** diff --git a/app/code/Magento/Paypal/Model/Report/Settlement.php b/app/code/Magento/Paypal/Model/Report/Settlement.php index ea17542067c966a5f6790297197a07f75669324f..ad4da16cec4f4a111449fcbf5022a7346b05139e 100644 --- a/app/code/Magento/Paypal/Model/Report/Settlement.php +++ b/app/code/Magento/Paypal/Model/Report/Settlement.php @@ -248,7 +248,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel // Set last modified date, this value will be overwritten during parsing if (isset($attributes['mtime'])) { $lastModified = new \Zend_Date($attributes['mtime']); - $this->setReportLastModified($lastModified->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT)); + $this->setReportLastModified($lastModified->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)); } $this->setReportDate($this->_fileNameToDate($filename)) @@ -318,7 +318,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel switch($lineType) { case 'RH': // Report header. $lastModified = new \Zend_Date($line[1]); - $this->setReportLastModified($lastModified->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT)); + $this->setReportLastModified($lastModified->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)); //$this->setAccountId($columns[2]); -- probably we'll just take that from the section header... break; case 'FH': // File header. diff --git a/app/code/Magento/Paypal/Model/Resource/Cert.php b/app/code/Magento/Paypal/Model/Resource/Cert.php index 13d7dc256b7c6bda6a21928005201738dec69b4a..9417e9eebc3c6907b5ae84401f18483cc83b3367 100644 --- a/app/code/Magento/Paypal/Model/Resource/Cert.php +++ b/app/code/Magento/Paypal/Model/Resource/Cert.php @@ -37,12 +37,22 @@ class Cert extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_coreDate; /** - * @param \Magento\Core\Model\Resource $resource + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Date $coreDate + * @param \Magento\Stdlib\DateTime $dateTime */ - public function __construct(\Magento\Core\Model\Resource $resource, \Magento\Core\Model\Date $coreDate) - { + public function __construct( + \Magento\App\Resource $resource, + \Magento\Core\Model\Date $coreDate, + \Magento\Stdlib\DateTime $dateTime + ) { $this->_coreDate = $coreDate; + $this->dateTime = $dateTime; parent::__construct($resource); } @@ -62,7 +72,7 @@ class Cert extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) { - $object->setUpdatedAt($this->formatDate($this->_coreDate->gmtDate())); + $object->setUpdatedAt($this->dateTime->formatDate($this->_coreDate->gmtDate())); return parent::_beforeSave($object); } diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php index 34db3116dad5aeff3cf3961a7abe5e9aa0b639ea..54e526c8e94dfa7f3cbd41422cf0978e6a98309b 100644 --- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php +++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php @@ -44,10 +44,10 @@ class Settlement extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_coreDate; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Date $coreDate */ - public function __construct(\Magento\Core\Model\Resource $resource, \Magento\Core\Model\Date $coreDate) + public function __construct(\Magento\App\Resource $resource, \Magento\Core\Model\Date $coreDate) { $this->_coreDate = $coreDate; parent::__construct($resource); diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php index c98253ad389310635ac76ddceecef8b5c3eedc28..daaee2bfddf41c9f419ffed984ebb4cc3c356484 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php @@ -32,41 +32,39 @@ namespace Magento\Paypal\Model\System\Config\Backend; class Cert extends \Magento\Core\Model\Config\Value { /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Paypal\Model\CertFactory */ - protected $_coreData; + protected $_certFactory; /** - * @var \Magento\Paypal\Model\CertFactory + * @var \Magento\Encryption\EncryptorInterface */ - protected $_certFactory; + protected $_encryptor; /** - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Config $config * @param \Magento\Paypal\Model\CertFactory $certFactory + * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Config $config, \Magento\Paypal\Model\CertFactory $certFactory, + \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreData = $coreData; $this->_certFactory = $certFactory; + $this->_encryptor = $encryptor; parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); } @@ -93,7 +91,7 @@ class Cert extends \Magento\Core\Model\Config\Value throw new \Magento\Core\Exception(__('The PayPal certificate file is empty.')); } $this->setValue($_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value']); - $content = $this->_coreData->encrypt(file_get_contents($tmpPath)); + $content = $this->_encryptor->encrypt(file_get_contents($tmpPath)); $this->_certFactory->create()->loadByWebsite($this->getScopeId()) ->setContent($content) ->save(); diff --git a/app/code/Magento/Paypal/etc/di.xml b/app/code/Magento/Paypal/etc/di.xml index 8fdbdbc7fd947b00609d5b445d59da171f386e8a..369c39bb37e4b5699ba5414af267a3a39850b153 100644 --- a/app/code/Magento/Paypal/etc/di.xml +++ b/app/code/Magento/Paypal/etc/di.xml @@ -24,7 +24,7 @@ */ --> <config> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <paypal_setup>Magento\Sales\Model\Resource\Setup</paypal_setup> diff --git a/app/code/Magento/Paypal/view/frontend/express/shortcut.phtml b/app/code/Magento/Paypal/view/frontend/express/shortcut.phtml index 4bbf6636819f99bec44724856afdd9a5ab4a512e..ed4c4cf1ba3c4e13ae154a2a1ba61052ff5e2240 100644 --- a/app/code/Magento/Paypal/view/frontend/express/shortcut.phtml +++ b/app/code/Magento/Paypal/view/frontend/express/shortcut.phtml @@ -57,7 +57,7 @@ if ($this->isOrPositionBefore()) { "<?php echo $this->getViewFileUrl('Magento_Paypal::js/paypal-checkout.js') ?>", function () { $('.paypal-logo').paypalCheckout({ - confirmMessage: "<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape($this->getConfirmationMessage())?>", + confirmMessage: "<?php echo $this->escapeJsQuote($this->getConfirmationMessage())?>", confirmUrl: "<?php echo !empty($confirmationUrl) ? $confirmationUrl : false ?>", isCatalogProduct: "<?php echo !empty($isInCatalogProduct) ? $isInCatalogProduct : false ?>", paypalCheckoutSelector: '#pp-checkout-url', @@ -66,4 +66,4 @@ if ($this->isOrPositionBefore()) { }); })(jQuery); </script> -</div> \ No newline at end of file +</div> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review_details.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review_details.xml index 6de51a8c3a0393679233d16ca8157160e9e3c101..f340c6287044ac02cbf05c40f9695db510518968 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review_details.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review_details.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Paypal\Block\Express\Review\Details" output="1" name="paypal.express.review.details" template="express/review/details.phtml"> + <block class="Magento\Paypal\Block\Express\Review\Details" output="1" name="root" template="express/review/details.phtml"> <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="onepage/review/item.phtml"/> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="onepage/review/item.phtml"/> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="onepage/review/item.phtml"/> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_hostedpro_cancel.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_hostedpro_cancel.xml index bcdd5b3d58adc0713268b7cdeacf5f503155cc9d..e40967effa8e0758ecd7ae1e10d4198021135015 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_hostedpro_cancel.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_hostedpro_cancel.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Hosted Pro Frame" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Hosted\Pro\Iframe" name="hosted.pro.iframe" template="hss/redirect.phtml"/> - </block> + <block class="Magento\Paypal\Block\Hosted\Pro\Iframe" name="hosted.pro.iframe" output="1" template="hss/redirect.phtml"/> </layout> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_cancelpayment.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_cancelpayment.xml index 8903d93d453fd8cd69e206f2edbd9f1f2282f256..68f8ce811fab1983e335fc5fd18f1c378e43bc5a 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_cancelpayment.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_cancelpayment.xml @@ -24,8 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Cancel Payment" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" - template="payflowlink/redirect.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" output="1" + template="payflowlink/redirect.phtml"/> </layout> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_form.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_form.xml index 1ce93f586dea669320f43fbada4bb716bd70da33..ff64b403b62829908c33776bd5b298772941b8de 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_form.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_form.xml @@ -24,8 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Form" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" - template="payflowlink/form.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" output="1" + template="payflowlink/form.phtml"/> </layout> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_returnurl.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_returnurl.xml index aa16a52ef338c950b7e7aba8da7d805965e17312..c8a429aa448eab83aff3421ce3808f755770fdc3 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_returnurl.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflow_returnurl.xml @@ -24,8 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Return URL" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" - template="payflowlink/redirect.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" output="1" + template="payflowlink/redirect.phtml"/> </layout> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml index f6282dcfa94aae55eb899b4d4d07d1ceac88ea84..a72eb037793f521f0a276bfa5ac1c7045a15e534 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml @@ -24,8 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Advanced Cancel Payment" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" - template="payflowadvanced/redirect.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" + template="payflowadvanced/redirect.phtml"/> </layout> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml index 8c2a6b505ea0ffff2c90c13eeebaeb94a1af60f7..c1d41e2be0ff6de32d0547186c4e3de5ee74032b 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml @@ -24,8 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Advanced Form" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" - template="payflowadvanced/form.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" + template="payflowadvanced/form.phtml"/> </layout> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml index f92c3490b3c87e1a108064b46a2c0d1e8839a3d1..dc3bb8c003233785125f6f0fef8618e68728d108 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml @@ -24,8 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Advanced Return URL" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" - template="payflowadvanced/redirect.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" + template="payflowadvanced/redirect.phtml"/> </layout> diff --git a/app/code/Magento/PaypalUk/Model/Api/Nvp.php b/app/code/Magento/PaypalUk/Model/Api/Nvp.php index 3c04521c2e1d36910e1d4180d21ffdb2ac5af396..2ff463316c202436eb43c52877cbac5940c50150 100644 --- a/app/code/Magento/PaypalUk/Model/Api/Nvp.php +++ b/app/code/Magento/PaypalUk/Model/Api/Nvp.php @@ -334,11 +334,9 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp ); /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Math\Random */ - protected $_coreData; + protected $mathRandom; /** * Constructor @@ -347,23 +345,23 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp * attributes This behavior may change in child classes * * @param \Magento\Customer\Helper\Address $customerAddress - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Math\Random $mathRandom */ public function __construct( \Magento\Customer\Helper\Address $customerAddress, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\LocaleInterface $locale, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Directory\Model\CountryFactory $countryFactory, - \Magento\Core\Helper\Data $coreData + \Magento\Math\Random $mathRandom ) { - $this->_coreData = $coreData; + $this->mathRandom = $mathRandom; parent::__construct($customerAddress, $logger, $locale, $regionFactory, $logAdapterFactory, $countryFactory); } @@ -507,7 +505,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp * Catch success calls and collect warnings * * @param array - * @return bool| success flag + * @return bool success flag */ protected function _isCallSuccessful($response) { @@ -560,7 +558,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp */ protected function getRequestId() { - return $this->_coreData->uniqHash(); + return $this->mathRandom->getUniqueHash(); } /** diff --git a/app/code/Magento/PaypalUk/etc/module.xml b/app/code/Magento/PaypalUk/etc/module.xml index 0ae081388813e653f642514bb8341d582075b88c..9fd63905f573ce3f4212d58385395f733744595a 100755 --- a/app/code/Magento/PaypalUk/etc/module.xml +++ b/app/code/Magento/PaypalUk/etc/module.xml @@ -38,7 +38,6 @@ <module name="Magento_Payment"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> - <module name="Magento_Page"/> </depends> </module> </config> diff --git a/app/code/Magento/PaypalUk/view/frontend/layout/paypal_express_review_details.xml b/app/code/Magento/PaypalUk/view/frontend/layout/paypal_express_review_details.xml index 8b5fee65e7cafa6194a08f535fb4d717799cd9fa..8ac62f38ae263f3c21ebf7db3c59c82b22835488 100644 --- a/app/code/Magento/PaypalUk/view/frontend/layout/paypal_express_review_details.xml +++ b/app/code/Magento/PaypalUk/view/frontend/layout/paypal_express_review_details.xml @@ -24,16 +24,14 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Express\Review\Details" name="paypal.express.review.details" - template="express/review/details.phtml"> - <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="onepage/review/item.phtml"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" - template="onepage/review/item.phtml"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" - template="onepage/review/item.phtml"/> - <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" - template="onepage/review/totals.phtml"/> - </block> + <block class="Magento\Paypal\Block\Express\Review\Details" name="root" output="1" + template="express/review/details.phtml"> + <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="onepage/review/item.phtml"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" + template="onepage/review/item.phtml"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" + template="onepage/review/item.phtml"/> + <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" + template="onepage/review/totals.phtml"/> </block> </layout> diff --git a/app/code/Magento/Persistent/Helper/Data.php b/app/code/Magento/Persistent/Helper/Data.php index 22107706a0d895dbe4ba88f15fe1708d24b0d4de..242d0d90cf37bdbe33cc1fc5e7410eaa6ee6cb18 100644 --- a/app/code/Magento/Persistent/Helper/Data.php +++ b/app/code/Magento/Persistent/Helper/Data.php @@ -59,6 +59,11 @@ class Data extends \Magento\Core\Helper\Data */ protected $_checkoutData; + /** + * @var \Magento\Escaper + */ + protected $_escaper; + /** * Core url * @@ -66,44 +71,56 @@ class Data extends \Magento\Core\Helper\Data */ protected $_coreUrl; + /** + * @var \Magento\Module\Dir\Reader + */ + protected $_modulesReader; + /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config + * @param \Magento\Module\Dir\Reader $modulesReader * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor * @param \Magento\Core\Helper\Url $coreUrl * @param \Magento\Checkout\Helper\Data $checkoutData - * @param \Magento\Persistent\Helper\Session $persistentSession + * @param Session $persistentSession + * @param \Magento\Escaper $escaper * @param bool $dbCompatibleMode */ public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, + \Magento\Module\Dir\Reader $modulesReader, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, \Magento\Core\Helper\Url $coreUrl, \Magento\Checkout\Helper\Data $checkoutData, \Magento\Persistent\Helper\Session $persistentSession, + \Magento\Escaper $escaper, $dbCompatibleMode = true - ) - { + ) { + $this->_modulesReader = $modulesReader; $this->_coreUrl = $coreUrl; $this->_checkoutData = $checkoutData; $this->_persistentSession = $persistentSession; - parent::__construct($context, $eventManager, $coreHttp, $config, $coreStoreConfig, $storeManager, - $locale, $dateModel, $appState, $encryptor, $dbCompatibleMode + $this->_escaper = $escaper; + + parent::__construct( + $context, + $eventManager, + $coreStoreConfig, + $storeManager, + $locale, + $dateModel, + $appState, + $dbCompatibleMode ); } @@ -190,7 +207,7 @@ class Data extends \Magento\Core\Helper\Data */ public function getPersistentName() { - return __('(Not %1?)', $this->escapeHtml($this->_persistentSession->getCustomer()->getName())); + return __('(Not %1?)', $this->_escaper->escapeHtml($this->_persistentSession->getCustomer()->getName())); } /** @@ -200,7 +217,7 @@ class Data extends \Magento\Core\Helper\Data */ public function getPersistentConfigFilePath() { - return $this->_config->getModuleDir('etc', $this->_getModuleName()) . DS . $this->_configFileName; + return $this->_modulesReader->getModuleDir('etc', $this->_getModuleName()) . DS . $this->_configFileName; } /** diff --git a/app/code/Magento/Persistent/Helper/Session.php b/app/code/Magento/Persistent/Helper/Session.php index b28b2b32d7f2d8d07e8e6f7bb13c5ce12e3f1957..165c4887a9c53b19424f738625995d5a2cfef120 100644 --- a/app/code/Magento/Persistent/Helper/Session.php +++ b/app/code/Magento/Persistent/Helper/Session.php @@ -23,12 +23,11 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Persistent\Helper; /** * Persistent Shopping Cart Data Helper */ -namespace Magento\Persistent\Helper; - class Session extends \Magento\Core\Helper\Data { /** @@ -83,15 +82,12 @@ class Session extends \Magento\Core\Helper\Data /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor - * @param \Magento\Persistent\Helper\Data $persistentData + * @param Data $persistentData * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Persistent\Model\SessionFactory $sessionFactory @@ -100,27 +96,30 @@ class Session extends \Magento\Core\Helper\Data public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, \Magento\Persistent\Helper\Data $persistentData, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Persistent\Model\SessionFactory $sessionFactory, $dbCompatibleMode = true - ) - { + ) { $this->_persistentData = $persistentData; $this->_checkoutSession = $checkoutSession; $this->_customerFactory = $customerFactory; $this->_sessionFactory = $sessionFactory; - parent::__construct($context, $eventManager, $coreHttp, $config, $coreStoreConfig, $storeManager, - $locale, $dateModel, $appState, $encryptor, $dbCompatibleMode + parent::__construct( + $context, + $eventManager, + $coreStoreConfig, + $storeManager, + $locale, + $dateModel, + $appState, + $dbCompatibleMode ); } diff --git a/app/code/Magento/Persistent/Model/Observer.php b/app/code/Magento/Persistent/Model/Observer.php index 07d256bef1ea78b334ddaf6c8a77e07ff3620a28..0a34b81d8bf19cb910d6f102d8bd5f29299b54da 100644 --- a/app/code/Magento/Persistent/Model/Observer.php +++ b/app/code/Magento/Persistent/Model/Observer.php @@ -47,13 +47,6 @@ class Observer */ protected $_persistentData = null; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * Persistent session * @@ -146,9 +139,15 @@ class Observer protected $_websiteCollectionFactory; /** + * @var \Magento\Escaper + */ + protected $_escaper; + + /** + * Construct + * * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Persistent\Helper\Session $persistentSession - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Persistent\Helper\Data $persistentData * @param \Magento\Core\Model\Resource\Website\CollectionFactory $websiteCollectionFactory * @param \Magento\Core\Model\Session $session @@ -161,13 +160,13 @@ class Observer * @param Persistent\ConfigFactory $persistentConfigFactory * @param \Magento\App\RequestInterface $requestHttp * @param \Magento\View\LayoutInterface $layout - * + * @param \Magento\Escaper $escaper + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Persistent\Helper\Session $persistentSession, - \Magento\Core\Helper\Data $coreData, \Magento\Persistent\Helper\Data $persistentData, \Magento\Core\Model\Resource\Website\CollectionFactory $websiteCollectionFactory, \Magento\Core\Model\Session $session, @@ -179,11 +178,11 @@ class Observer \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Persistent\Model\Persistent\ConfigFactory $persistentConfigFactory, \Magento\App\RequestInterface $requestHttp, - \Magento\View\LayoutInterface $layout + \Magento\View\LayoutInterface $layout, + \Magento\Escaper $escaper ) { $this->_eventManager = $eventManager; $this->_persistentSession = $persistentSession; - $this->_coreData = $coreData; $this->_persistentData = $persistentData; $this->_websiteCollectionFactory = $websiteCollectionFactory; $this->_session = $session; @@ -196,6 +195,7 @@ class Observer $this->_persistentConfigFactory = $persistentConfigFactory; $this->_requestHttp = $requestHttp; $this->_layout = $layout; + $this->_escaper = $escaper; } /** @@ -262,8 +262,7 @@ class Observer */ public function emulateWelcomeBlock($block) { - $escapedName = $this->_coreData - ->escapeHtml($this->_getPersistentCustomer()->getName(), null); + $escapedName = $this->_escaper->escapeHtml($this->_getPersistentCustomer()->getName(), null); $this->_applyAccountLinksPersistentData(); $welcomeMessage = __('Welcome, %1!', $escapedName) diff --git a/app/code/Magento/Persistent/Model/Observer/Session.php b/app/code/Magento/Persistent/Model/Observer/Session.php index 9ff965a3d5d044dfa5c9b47d4b3d5581a71749b7..a0f0a31cfa3d97beb12f8b960ad829e24eeecce0 100644 --- a/app/code/Magento/Persistent/Model/Observer/Session.php +++ b/app/code/Magento/Persistent/Model/Observer/Session.php @@ -196,7 +196,7 @@ class Session $sessionModel = $this->_persistentSession->getSession(); /** @var $request \Magento\App\RequestInterface */ - $request = $observer->getEvent()->getFront()->getRequest(); + $request = $observer->getEvent()->getRequest(); // Quote Id could be changed only by logged in customer if ($this->_customerSession->isLoggedIn() diff --git a/app/code/Magento/Persistent/Model/Persistent/Config.php b/app/code/Magento/Persistent/Model/Persistent/Config.php index e890c87ff9071e0e98d0ab311aa68fb5ebbc5005..7744d099f1d5483addea52f1bd6e1571e66b9c1b 100644 --- a/app/code/Magento/Persistent/Model/Persistent/Config.php +++ b/app/code/Magento/Persistent/Model/Persistent/Config.php @@ -42,7 +42,7 @@ class Config /** @var \Magento\Config\DomFactory */ protected $_domFactory; - /** @var \Magento\Core\Model\Config\Modules\Reader */ + /** @var \Magento\Module\Dir\Reader */ protected $_moduleReader; /** @var \DOMXPath */ @@ -71,14 +71,14 @@ class Config /** * @param \Magento\Config\DomFactory $domFactory - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader * @param \Magento\View\LayoutInterface $layout * @param \Magento\App\State $appState * @param \Magento\Persistent\Model\Factory $persistentFactory */ public function __construct( \Magento\Config\DomFactory $domFactory, - \Magento\Core\Model\Config\Modules\Reader $moduleReader, + \Magento\Module\Dir\Reader $moduleReader, \Magento\View\LayoutInterface $layout, \Magento\App\State $appState, \Magento\Persistent\Model\Factory $persistentFactory diff --git a/app/code/Magento/Persistent/Model/Resource/Session.php b/app/code/Magento/Persistent/Model/Resource/Session.php index 4cb592015f524696b595fa6244e73cd13ae4f469..6d00532d6846d786e181bd1d260c36efe0ca22da 100644 --- a/app/code/Magento/Persistent/Model/Resource/Session.php +++ b/app/code/Magento/Persistent/Model/Resource/Session.php @@ -49,11 +49,11 @@ class Session extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Class constructor * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Persistent\Model\SessionFactory $sessionFactory */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Persistent\Model\SessionFactory $sessionFactory ) { $this->_sessionFactory = $sessionFactory; diff --git a/app/code/Magento/Persistent/Model/Session.php b/app/code/Magento/Persistent/Model/Session.php index 0250a21cf05ad1cd2f3f21052b196f4b0d22095f..18bc72cc3bec5c93bb2d7c6c909ca58ff072ca4a 100644 --- a/app/code/Magento/Persistent/Model/Session.php +++ b/app/code/Magento/Persistent/Model/Session.php @@ -86,6 +86,11 @@ class Session extends \Magento\Core\Model\AbstractModel */ protected $_cookie; + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + /** * Construct * @@ -96,6 +101,7 @@ class Session extends \Magento\Core\Model\AbstractModel * @param \Magento\Persistent\Helper\Data $persistentData * @param \Magento\Core\Model\Cookie $cookie * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Math\Random $mathRandom * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -108,6 +114,7 @@ class Session extends \Magento\Core\Model\AbstractModel \Magento\Persistent\Helper\Data $persistentData, \Magento\Core\Model\Cookie $cookie, \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Math\Random $mathRandom, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -117,6 +124,7 @@ class Session extends \Magento\Core\Model\AbstractModel $this->_coreConfig = $coreConfig; $this->_cookie = $cookie; $this->_storeManager = $storeManager; + $this->mathRandom = $mathRandom; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -184,7 +192,7 @@ class Session extends \Magento\Core\Model\AbstractModel $this->setWebsiteId($this->_storeManager->getStore()->getWebsiteId()); // Setting cookie key do { - $this->setKey($this->_coreData->getRandomString(self::KEY_LENGTH)); + $this->setKey($this->mathRandom->getRandomString(self::KEY_LENGTH)); } while (!$this->getResource()->isKeyAllowed($this->getKey())); } diff --git a/app/code/Magento/Persistent/etc/di.xml b/app/code/Magento/Persistent/etc/di.xml index 1328c683ff48776051a0dc940253734228a05741..232553da278211c11c64a0be0ba5f8e74955a171 100644 --- a/app/code/Magento/Persistent/etc/di.xml +++ b/app/code/Magento/Persistent/etc/di.xml @@ -26,10 +26,7 @@ <config> <type name="Magento\Persistent\Helper\Data"> <param name="persistentSession"> - <instance type="Magento\Persistent\Helper\SessionProxy" /> - </param> - <param name="config"> - <instance type="Magento\Core\Model\ConfigProxy" /> + <instance type="Magento\Persistent\Helper\Session\Proxy" /> </param> </type> </config> diff --git a/app/code/Magento/ProductAlert/Model/Resource/Price.php b/app/code/Magento/ProductAlert/Model/Resource/Price.php index df1b0e56fd0d28570034df5313e479fff90b3f6e..354f6dd53e36eefb4d360ef1f4713e022558b7cc 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Price.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Price.php @@ -37,11 +37,11 @@ class Price extends \Magento\ProductAlert\Model\Resource\AbstractResource protected $_dateFactory; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\DateFactory $dateFactory */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\DateFactory $dateFactory ) { $this->_dateFactory = $dateFactory; diff --git a/app/code/Magento/ProductAlert/Model/Resource/Stock.php b/app/code/Magento/ProductAlert/Model/Resource/Stock.php index 037241f8c8518b8f2cd4e87d6b582e36da4d2245..8a8d3ec6561d678ed9ab7126f7c17f064ab2bb49 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Stock.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Stock.php @@ -37,11 +37,11 @@ class Stock extends \Magento\ProductAlert\Model\Resource\AbstractResource protected $_dateFactory; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\DateFactory $dateFactory */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\DateFactory $dateFactory ) { $this->_dateFactory = $dateFactory; diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php index 84c914747dc38c836b3d57063abba3786303ffa0..68f53c58483ca4a2e777fad6b2c9d86471cc0366 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php +++ b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php @@ -61,7 +61,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Rating\Model\Rating\OptionFactory $optionFactory * @param \Magento\Core\Model\Session\AbstractSession $session * @param \Magento\Core\Model\System\Store $systemStore - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -72,7 +72,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Rating\Model\Rating\OptionFactory $optionFactory, \Magento\Core\Model\Session\AbstractSession $session, \Magento\Core\Model\System\Store $systemStore, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php index 93f43f79378c8da4b8c64ce9be47d08ba4484143..b69d2f2fc3b56ffa5e533f3d99bc4d0ca590b3ea 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php +++ b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php @@ -38,7 +38,7 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Rating\Model\Rating\OptionFactory $optionFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -46,7 +46,7 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic public function __construct( \Magento\Rating\Model\Rating\OptionFactory $optionFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Rating/Model/Resource/Rating.php b/app/code/Magento/Rating/Model/Resource/Rating.php index a7af06dbc1b5b907e9297ec8bd48110838d7645e..d11f9b6b8454798a4a22a073342e3632337083f0 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating.php +++ b/app/code/Magento/Rating/Model/Resource/Rating.php @@ -52,21 +52,21 @@ class Rating extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_ratingData = null; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Rating\Helper\Data $ratingData - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Review\Model\Resource\Review\Summary $reviewSummary */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Rating\Helper\Data $ratingData, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\StoreManager $storeManager, \Magento\Review\Model\Resource\Review\Summary $reviewSummary ) { diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Collection.php index 215f1e57437b40b98d1883e552ebdb95b7b877fe..2c8bbaf4012e7b210168f22f1a78da573290fb26 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Collection.php @@ -47,7 +47,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -56,7 +56,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php index a7bd91c2c5832565b411f76e14d0dcecb0309747..b720426d35f58ab2090a1bd8311098da84cee5cd 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php @@ -44,7 +44,7 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -54,7 +54,7 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option.php b/app/code/Magento/Rating/Model/Resource/Rating/Option.php index b27c44044371049bef3b371a3228bd248b45f3f1..5fe3887860e3a3b89e698ecc53b66a22b63d7264 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Option.php @@ -91,13 +91,6 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected $_optionId; - /** - * Core http - * - * @var \Magento\Core\Helper\Http - */ - protected $_coreHttp = null; - /** * @var \Magento\Customer\Model\Session */ @@ -109,20 +102,20 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_ratingOptionVoteF; /** - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Rating\Model\Rating\Option\VoteFactory $ratingOptionVoteF + * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress */ public function __construct( - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Customer\Model\Session $customerSession, - \Magento\Rating\Model\Rating\Option\VoteFactory $ratingOptionVoteF + \Magento\Rating\Model\Rating\Option\VoteFactory $ratingOptionVoteF, + \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress ) { - $this->_coreHttp = $coreHttp; $this->_customerSession = $customerSession; $this->_ratingOptionVoteF = $ratingOptionVoteF; + $this->_remoteAddress = $remoteAddress; parent::__construct($resource); } @@ -160,8 +153,8 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb ); if (!$option->getDoUpdate()) { - $data['remote_ip'] = $this->_coreHttp->getRemoteAddr(); - $data['remote_ip_long'] = $this->_coreHttp->getRemoteAddr(true); + $data['remote_ip'] = $this->_remoteAddress->getRemoteAddress(); + $data['remote_ip_long'] = $this->_remoteAddress->getRemoteAddress(true); $data['customer_id'] = $this->_customerSession->getCustomerId(); $data['entity_pk_value'] = $option->getEntityPkValue(); $data['rating_id'] = $option->getRatingId(); diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php index e04759091c84de91d3a19444e810ebed308a393e..705e0687f743097538781c959078f9979b630583 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php @@ -49,7 +49,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -58,7 +58,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Rating/view/adminhtml/rating/detailed.phtml b/app/code/Magento/Rating/view/adminhtml/rating/detailed.phtml index 9e40c58c3a1c447c7b6b0dc2bacd825fdc5ed5a5..ed230745bab639cf8543ab8adf03c5a7ea2cc012 100644 --- a/app/code/Magento/Rating/view/adminhtml/rating/detailed.phtml +++ b/app/code/Magento/Rating/view/adminhtml/rating/detailed.phtml @@ -47,7 +47,7 @@ (function($) { "use strict"; $.mage.extend('validation', 'validation', - '<?php echo $this->getViewFileUrl('Magento_Adminhtml::validation-rules.js'); ?>'); + '<?php echo $this->getViewFileUrl('Magento_Rating::rating/validation-rules.js'); ?>'); $('[data-widget="ratingControl"]').ratingControl(); })(jQuery); </script> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/validation-rules.js b/app/code/Magento/Rating/view/adminhtml/rating/validation-rules.js similarity index 95% rename from app/code/Magento/Adminhtml/view/adminhtml/validation-rules.js rename to app/code/Magento/Rating/view/adminhtml/rating/validation-rules.js index 91389725ab79580caada0814399f5ec767ea35ab..1eef30af2c86ca12f92ae363844ca7f1255537f9 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/validation-rules.js +++ b/app/code/Magento/Rating/view/adminhtml/rating/validation-rules.js @@ -1,5 +1,5 @@ /** - * Adminhtml client side validation rules + * Rating validation rules * * Magento * @@ -20,7 +20,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Rating * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Reports/Helper/Data.php b/app/code/Magento/Reports/Helper/Data.php index 287d5c70cda4abddd91ecbf4690fdb78b0b3c2ec..4b05f9cbb18b5b0920b83a6da5b6c6ad7dce8715 100644 --- a/app/code/Magento/Reports/Helper/Data.php +++ b/app/code/Magento/Reports/Helper/Data.php @@ -67,21 +67,21 @@ class Data extends \Magento\Core\Helper\AbstractHelper return $intervals; } - $start = new \Zend_Date($from, \Magento\Date::DATE_INTERNAL_FORMAT); + $start = new \Zend_Date($from, \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT); if ($period == self::REPORT_PERIOD_TYPE_DAY) { $dateStart = $start; } if ($period == self::REPORT_PERIOD_TYPE_MONTH) { - $dateStart = new \Zend_Date(date("Y-m", $start->getTimestamp()), \Magento\Date::DATE_INTERNAL_FORMAT); + $dateStart = new \Zend_Date(date("Y-m", $start->getTimestamp()), \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT); } if ($period == self::REPORT_PERIOD_TYPE_YEAR) { - $dateStart = new \Zend_Date(date("Y", $start->getTimestamp()), \Magento\Date::DATE_INTERNAL_FORMAT); + $dateStart = new \Zend_Date(date("Y", $start->getTimestamp()), \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT); } - $dateEnd = new \Zend_Date($to, \Magento\Date::DATE_INTERNAL_FORMAT); + $dateEnd = new \Zend_Date($to, \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT); while ($dateStart->compare($dateEnd) <= 0) { switch ($period) { diff --git a/app/code/Magento/Reports/Model/Config.php b/app/code/Magento/Reports/Model/Config.php index 93fb148be9ea5b16fb04aa32c553ea2c2cacfd7c..0b1147bf0c9cc44e4ac79147457c3bde18befabe 100644 --- a/app/code/Magento/Reports/Model/Config.php +++ b/app/code/Magento/Reports/Model/Config.php @@ -32,7 +32,7 @@ namespace Magento\Reports\Model; class Config extends \Magento\Object { /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_moduleReader; @@ -42,12 +42,12 @@ class Config extends \Magento\Object protected $_storeManager; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param array $data */ public function __construct( - \Magento\Core\Model\Config\Modules\Reader $moduleReader, + \Magento\Module\Dir\Reader $moduleReader, \Magento\Core\Model\StoreManagerInterface $storeManager, array $data = array() ) { diff --git a/app/code/Magento/Reports/Model/DateFactory.php b/app/code/Magento/Reports/Model/DateFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..3cb4c14b1ddde3e6f74f00d9c14aa821f9a4464b --- /dev/null +++ b/app/code/Magento/Reports/Model/DateFactory.php @@ -0,0 +1,41 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Reports\Model; + +class DateFactory +{ + /** + * @param string|integer|\Zend_Date|array $date OPTIONAL Date value or value of date part to set + * ,depending on $part. If null the actual time is set + * @param string $part OPTIONAL Defines the input format of $date + * @param string|\Zend_Locale $locale OPTIONAL Locale for parsing input + * @return \Zend_Date + */ + public function create($date = null, $part = null, $locale = null) + { + return new \Zend_Date($date, $part, $locale); + } + +} \ No newline at end of file diff --git a/app/code/Magento/Reports/Model/Event/Observer.php b/app/code/Magento/Reports/Model/Event/Observer.php index f9c1042d1d402d4a9761572770b3484023290994..6e266a92cf8ca6238bd10be5e4e2164ad411b5e5 100644 --- a/app/code/Magento/Reports/Model/Event/Observer.php +++ b/app/code/Magento/Reports/Model/Event/Observer.php @@ -98,8 +98,7 @@ class Observer if ($this->_customerSession->isLoggedIn()) { $customer = $this->_customerSession->getCustomer(); $subjectId = $customer->getId(); - } - else { + } else { $subjectId = $this->_logVisitor->getId(); $subtype = 1; } diff --git a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php index 291b74f003d7ab565dee8f1c29554864cf0ac71f..b9812bf7203b6fc8786aef8c03ad124b4ffc6e64 100644 --- a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php +++ b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Reports\Model\Product\Index; /** * Reports Product Index Abstract Model - * - * @category Magento - * @package Magento_Reports - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Reports\Model\Product\Index; - abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel { /** @@ -68,6 +63,11 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel */ protected $_productVisibility; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -76,6 +76,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Core\Model\Session\Generic $reportSession * @param \Magento\Catalog\Model\Product\Visibility $productVisibility + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -88,13 +89,14 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel \Magento\Customer\Model\Session $customerSession, \Magento\Core\Model\Session\Generic $reportSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_storeManager = $storeManager; - + $this->dateTime = $dateTime; $this->_logVisitor = $logVisitor; $this->_customerSession = $customerSession; $this->_reportSession = $reportSession; @@ -120,7 +122,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel $this->setStoreId($this->getStoreId()); } if (!$this->hasAddedAt()) { - $this->setAddedAt(now()); + $this->setAddedAt($this->dateTime->now()); } return $this; diff --git a/app/code/Magento/Reports/Model/Product/Index/Compared.php b/app/code/Magento/Reports/Model/Product/Index/Compared.php index 3a6fd4eae11ec019487a035e6b51828173b0321a..05d91f033e67f07c791fc3bc554cab97cf2f8bee 100644 --- a/app/code/Magento/Reports/Model/Product/Index/Compared.php +++ b/app/code/Magento/Reports/Model/Product/Index/Compared.php @@ -69,6 +69,7 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Core\Model\Session\Generic $reportSession * @param \Magento\Catalog\Model\Product\Visibility $productVisibility + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -82,13 +83,14 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex \Magento\Customer\Model\Session $customerSession, \Magento\Core\Model\Session\Generic $reportSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { parent::__construct( $context, $registry, $storeManager, $logVisitor, $customerSession, - $reportSession, $productVisibility, $resource, $resourceCollection, $data + $reportSession, $productVisibility, $dateTime, $resource, $resourceCollection, $data ); $this->_productCompare = $productCompare; } diff --git a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php index a71dc4f87f60d3c49899e338cb473f036544ccdf..5161b07ebe05ed1e9c3564478c354666b784a22a 100644 --- a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php @@ -89,11 +89,11 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory @@ -105,11 +105,11 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, diff --git a/app/code/Magento/Reports/Model/Resource/Entity/Summary/Collection/AbstractCollection.php b/app/code/Magento/Reports/Model/Resource/Entity/Summary/Collection/AbstractCollection.php index eac2a83521f53ea25e3e5240fcee094a8af863e4..7ab0246581ef253a8ea5eb9b5df66d0c985fd886 100644 --- a/app/code/Magento/Reports/Model/Resource/Entity/Summary/Collection/AbstractCollection.php +++ b/app/code/Magento/Reports/Model/Resource/Entity/Summary/Collection/AbstractCollection.php @@ -43,6 +43,21 @@ class AbstractCollection extends \Magento\Data\Collection */ protected $_entityCollection; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Core\Model\EntityFactory $entityFactory + */ + public function __construct(\Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\EntityFactory $entityFactory) + { + $this->dateTime = $dateTime; + parent::__construct($entityFactory); + } + /** * Filters the summaries by some period * @@ -55,23 +70,23 @@ class AbstractCollection extends \Magento\Data\Collection { switch ($periodType) { case "24h": - $customStart = \Magento\Date::toTimestamp(true) - 86400; - $customEnd = \Magento\Date::toTimestamp(true); + $customStart = $this->dateTime->toTimestamp(true) - 86400; + $customEnd = $this->dateTime->toTimestamp(true); break; case "7d": - $customStart = \Magento\Date::toTimestamp(true) - 604800; - $customEnd = \Magento\Date::toTimestamp(true); + $customStart = $this->dateTime->toTimestamp(true) - 604800; + $customEnd = $this->dateTime->toTimestamp(true); break; case "30d": - $customStart = \Magento\Date::toTimestamp(true) - 2592000; - $customEnd = \Magento\Date::toTimestamp(true); + $customStart = $this->dateTime->toTimestamp(true) - 2592000; + $customEnd = $this->dateTime->toTimestamp(true); break; case "1y": - $customStart = \Magento\Date::toTimestamp(true) - 31536000; - $customEnd = \Magento\Date::toTimestamp(true); + $customStart = $this->dateTime->toTimestamp(true) - 31536000; + $customEnd = $this->dateTime->toTimestamp(true); break; default: diff --git a/app/code/Magento/Reports/Model/Resource/Event.php b/app/code/Magento/Reports/Model/Resource/Event.php index 97b638ace0adbb5ae05d4f0201168497a129c24b..ae2a4a85302271812e5d9cab22ce295d3a6e752f 100644 --- a/app/code/Magento/Reports/Model/Resource/Event.php +++ b/app/code/Magento/Reports/Model/Resource/Event.php @@ -49,12 +49,12 @@ class Event extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_storeManager; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager ) { diff --git a/app/code/Magento/Reports/Model/Resource/Helper.php b/app/code/Magento/Reports/Model/Resource/Helper.php index 732f0f24aca126fe87be7487a428d27cff81fb2d..1a9eac20399a2830baaef21bf6bae67be1e980fb 100644 --- a/app/code/Magento/Reports/Model/Resource/Helper.php +++ b/app/code/Magento/Reports/Model/Resource/Helper.php @@ -38,11 +38,11 @@ class Helper extends \Magento\Core\Model\Resource\Helper implements \Magento\Reports\Model\Resource\HelperInterface { /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param string $modulePrefix */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, $modulePrefix = 'reports' ) { parent::__construct($resource, $modulePrefix); diff --git a/app/code/Magento/Reports/Model/Resource/Order/Collection.php b/app/code/Magento/Reports/Model/Resource/Order/Collection.php index 8ee0676fd4083cc1ba0571374248544f8f6095a9..3ac93095fa50fb047b6f49e28e58778d245c14f5 100644 --- a/app/code/Magento/Reports/Model/Resource/Order/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Order/Collection.php @@ -79,7 +79,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Resource\Helper $coreResourceHelper @@ -92,7 +92,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Resource\Helper $coreResourceHelper, @@ -870,8 +870,8 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection } $this->addFieldToFilter($fieldToFilter, array( - 'from' => $from->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT), - 'to' => $to->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT) + 'from' => $from->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT), + 'to' => $to->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT) )); return $this; diff --git a/app/code/Magento/Reports/Model/Resource/Product/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Collection.php index 1c87e5a4e1219b66cdc058dd4e3d4b3abcfec5a8..8872079ed392345b4510020075f045e2b1e69670 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Collection.php @@ -80,11 +80,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -96,6 +96,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Catalog\Model\Resource\Product $product * @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory * @param \Magento\Catalog\Model\Product\Type $productType @@ -104,11 +105,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -120,6 +121,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime, \Magento\Catalog\Model\Resource\Product $product, \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory, \Magento\Catalog\Model\Product\Type $productType @@ -129,7 +131,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection $this->setProductEntityTypeId($product->getTypeId()); parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $coreResource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, $catalogProductFlat, $coreStoreConfig, - $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper + $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper, $dateTime ); $this->_eventTypeFactory = $eventTypeFactory; $this->_productType = $productType; diff --git a/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php b/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php index 46b73e0de5c4741e050bc4588389fc53a801f61c..1b3c50512561ab45890b18e1d189c750ea1dbad6 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php @@ -24,29 +24,36 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Reports\Model\Resource\Product\Index; /** * Reports Product Index Abstract Resource Model - * - * @category Magento - * @package Magento_Reports - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Reports\Model\Resource\Product\Index; - abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @var \Magento\Reports\Model\Resource\HelperFactory */ protected $_helperFactory; + /** + * @param \Magento\App\Resource $resource + * @param \Magento\Reports\Model\Resource\HelperFactory $helperFactory + * @param \Magento\Stdlib\DateTime $dateTime + */ public function __construct( - \Magento\Core\Model\Resource $resource, - \Magento\Reports\Model\Resource\HelperFactory $helperFactory + \Magento\App\Resource $resource, + \Magento\Reports\Model\Resource\HelperFactory $helperFactory, + \Magento\Stdlib\DateTime $dateTime ) { parent::__construct($resource); $this->_helperFactory = $helperFactory; + $this->dateTime = $dateTime; } /** @@ -91,14 +98,14 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb $data = array( 'visitor_id' => $object->getVisitorId(), 'store_id' => $object->getStoreId(), - 'added_at' => \Magento\Date::now(), + 'added_at' => $this->dateTime->now(), ); } else { $where = array('index_id = ?' => $row['index_id']); $data = array( 'customer_id' => $object->getCustomerId(), 'store_id' => $object->getStoreId(), - 'added_at' => \Magento\Date::now() + 'added_at' => $this->dateTime->now() ); } @@ -199,7 +206,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb * Add information about product ids to visitor/customer * * - * @param \Magento\Reports\Model\Product\Index\AbstractIndex $object + * @param \Magento\Object|\Magento\Reports\Model\Product\Index\AbstractIndex $object * @param array $productIds * @return \Magento\Reports\Model\Resource\Product\Index\AbstractIndex */ @@ -210,13 +217,13 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb 'customer_id' => $object->getCustomerId(), 'store_id' => $object->getStoreId(), ); - $addedAt = \Magento\Date::toTimestamp(true); + $addedAt = $this->dateTime->toTimestamp(true); $data = array(); foreach ($productIds as $productId) { $productId = (int) $productId; if ($productId) { $row['product_id'] = $productId; - $row['added_at'] = \Magento\Date::formatDate($addedAt); + $row['added_at'] = $this->dateTime->formatDate($addedAt); $data[] = $row; } $addedAt -= ($addedAt > 0) ? 1 : 0; diff --git a/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php b/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php index 45eca209d6efa2bd92163e3e0f45c1d7e9aac93a..8bbedf56bf515918ca952990314edfc6cdc4bc20 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php @@ -53,11 +53,11 @@ abstract class AbstractCollection * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -69,17 +69,18 @@ abstract class AbstractCollection * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Log\Model\Visitor $logVisitor * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -91,11 +92,12 @@ abstract class AbstractCollection \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime, \Magento\Log\Model\Visitor $logVisitor ) { parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $coreResource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, $catalogProductFlat, $coreStoreConfig, - $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper + $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper, $dateTime ); $this->_logVisitor = $logVisitor; } diff --git a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php index 257bddb3104d1aa1daf910f4abafa89234fb40fc..7adc9928b44347446f280ddc499eef736c5bd51c 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php @@ -66,11 +66,11 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection * Construct * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -82,6 +82,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Catalog\Model\Resource\Product $product * @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory * @param \Magento\Catalog\Model\Product\Type $productType @@ -92,11 +93,11 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -108,6 +109,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Resource\Helper $resourceHelper, + \Magento\Stdlib\DateTime $dateTime, \Magento\Catalog\Model\Resource\Product $product, \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory, \Magento\Catalog\Model\Product\Type $productType, @@ -116,8 +118,8 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection ) { parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $coreResource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, $catalogProductFlat, $coreStoreConfig, - $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper, $product, $eventTypeFactory, - $productType + $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper, $dateTime, $product, + $eventTypeFactory, $productType ); $this->_inventoryData = $catalogInventoryData; $this->_itemResource = $itemResource; diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php index bae1bc57c35edc65cffb7a282a1fbdba50c063e1..81c49ad55506d0480f33e7547e146fc3a493b4a1 100644 --- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php @@ -67,7 +67,7 @@ class Collection extends \Magento\Sales\Model\Resource\Quote\Collection public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Catalog\Model\Resource\Product\Collection $productResource, diff --git a/app/code/Magento/Reports/Model/Resource/Refresh/Collection.php b/app/code/Magento/Reports/Model/Resource/Refresh/Collection.php index c2c53780aec47a7632f2a54290b2a216788d0ce7..bf8dddaa31f61f96092acf9a48bc1675faf19e41 100644 --- a/app/code/Magento/Reports/Model/Resource/Refresh/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Refresh/Collection.php @@ -76,7 +76,7 @@ class Collection extends \Magento\Data\Collection ->loadSelf(); return ($flag->hasData()) ? $this->_locale - ->storeDate(0, new \Zend_Date($flag->getLastUpdate(), \Magento\Date::DATETIME_INTERNAL_FORMAT), true) + ->storeDate(0, new \Zend_Date($flag->getLastUpdate(), \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT), true) : ''; } diff --git a/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php b/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php index ccd24297d5a6b5fb086f5631034f1f2e804aec04..d23826f27d044582e3808c70acb1b580218ce7b7 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php +++ b/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php @@ -44,7 +44,7 @@ abstract class AbstractReport extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_flag = null; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -59,21 +59,24 @@ abstract class AbstractReport extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_reportsFlagFactory; /** - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Logger $logger + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Reports\Model\FlagFactory $reportsFlagFactory + * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\Resource $resource, + \Magento\Logger $logger, + \Magento\App\Resource $resource, \Magento\Core\Model\LocaleInterface $locale, - \Magento\Reports\Model\FlagFactory $reportsFlagFactory + \Magento\Reports\Model\FlagFactory $reportsFlagFactory, + \Magento\Stdlib\DateTime $dateTime ) { parent::__construct($resource); $this->_logger = $logger; $this->_locale = $locale; $this->_reportsFlagFactory = $reportsFlagFactory; + $this->dateTime = $dateTime; } /** @@ -107,9 +110,9 @@ abstract class AbstractReport extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_getFlag()->setFlagData($value); } - $time = \Magento\Date::toTimestamp(true); + $time = $this->dateTime->toTimestamp(true); // touch last_update - $this->_getFlag()->setLastUpdate($this->formatDate($time)); + $this->_getFlag()->setLastUpdate($this->dateTime->formatDate($time)); $this->_getFlag()->save(); @@ -359,11 +362,11 @@ abstract class AbstractReport extends \Magento\Core\Model\Resource\Db\AbstractDb protected function _checkDates(&$dateFrom, &$dateTo) { if ($dateFrom !== null) { - $dateFrom = $this->formatDate($dateFrom); + $dateFrom = $this->dateTime->formatDate($dateFrom); } if ($dateTo !== null) { - $dateTo = $this->formatDate($dateTo); + $dateTo = $this->dateTime->formatDate($dateTo); } return $this; @@ -428,12 +431,12 @@ abstract class AbstractReport extends \Magento\Core\Model\Resource\Db\AbstractDb $tzTransitions = array(); try { if (!empty($from)) { - $from = new \Zend_Date($from, \Magento\Date::DATETIME_INTERNAL_FORMAT); + $from = new \Zend_Date($from, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); $from = $from->getTimestamp(); } - $to = new \Zend_Date($to, \Magento\Date::DATETIME_INTERNAL_FORMAT); - $nextPeriod = $this->_getWriteAdapter()->formatDate($to->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT)); + $to = new \Zend_Date($to, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); + $nextPeriod = $this->_getWriteAdapter()->formatDate($to->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)); $to = $to->getTimestamp(); $dtz = new \DateTimeZone($timezone); @@ -448,7 +451,7 @@ abstract class AbstractReport extends \Magento\Core\Model\Resource\Db\AbstractDb $dateTimeObject->set($tr['time']); $tr['time'] = $this->_getWriteAdapter() - ->formatDate($dateTimeObject->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT)); + ->formatDate($dateTimeObject->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)); $tzTransitions[$tr['offset']][] = array('from' => $tr['time'], 'to' => $nextPeriod); if (!empty($from) && $tr['ts'] < $from) { diff --git a/app/code/Magento/Reports/Model/Resource/Report/Collection.php b/app/code/Magento/Reports/Model/Resource/Report/Collection.php index dd98e09775c9b0b6d1f594803c3fbc3c4d3d6336..dd47253cc36b6a8b63b3fdc431252de80b096f3e 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Collection.php @@ -93,7 +93,7 @@ class Collection extends \Magento\Data\Collection protected $_reportCollection = null; /** - * @var \Zend_DateFactory + * @var \Magento\Reports\Model\DateFactory */ protected $_dateFactory; @@ -109,13 +109,13 @@ class Collection extends \Magento\Data\Collection /** * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Zend_DateFactory $dateFactory - * @param \Magento\Reports\Model\Resource\Report\Collection\Factory $collectionFactory + * @param \Magento\Reports\Model\DateFactory $dateFactory + * @param Collection\Factory $collectionFactory * @param \Magento\Core\Model\EntityFactory $entityFactory */ public function __construct( \Magento\Core\Model\LocaleInterface $locale, - \Zend_DateFactory $dateFactory, + \Magento\Reports\Model\DateFactory $dateFactory, \Magento\Reports\Model\Resource\Report\Collection\Factory $collectionFactory, \Magento\Core\Model\EntityFactory $entityFactory ) { @@ -164,8 +164,8 @@ class Collection extends \Magento\Data\Collection if (!$this->_from && !$this->_to) { return $this->_intervals; } - $dateStart = $this->_dateFactory->create(array('date' => $this->_from)); - $dateEnd = $this->_dateFactory->create(array('date' => $this->_to)); + $dateStart = $this->_dateFactory->create($this->_from); + $dateEnd = $this->_dateFactory->create($this->_to); $interval = array(); $firstInterval = true; @@ -392,8 +392,8 @@ class Collection extends \Magento\Data\Collection public function timeShift($datetime) { return $this->_locale - ->utcDate(null, $datetime, true, \Magento\Date::DATETIME_INTERNAL_FORMAT) - ->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + ->utcDate(null, $datetime, true, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT) + ->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); } /** diff --git a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php index ce8f95c901f4266002ed0e6d1e12ec2499c4eeea..057332551edee56f8b45aa14fc12b91b424b0e7f 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php @@ -62,22 +62,24 @@ class Viewed extends \Magento\Sales\Model\Resource\Report\AbstractReport protected $_helperFactory; /** - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Logger $logger + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Reports\Model\FlagFactory $reportsFlagFactory + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Catalog\Model\Resource\Product $productResource * @param \Magento\Reports\Model\Resource\HelperFactory $helperFactory */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\Resource $resource, + \Magento\Logger $logger, + \Magento\App\Resource $resource, \Magento\Core\Model\LocaleInterface $locale, \Magento\Reports\Model\FlagFactory $reportsFlagFactory, + \Magento\Stdlib\DateTime $dateTime, \Magento\Catalog\Model\Resource\Product $productResource, \Magento\Reports\Model\Resource\HelperFactory $helperFactory ) { - parent::__construct($logger, $resource, $locale, $reportsFlagFactory); + parent::__construct($logger, $resource, $locale, $reportsFlagFactory, $dateTime); $this->_productResource = $productResource; $this->_helperFactory = $helperFactory; } diff --git a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php index ebdd74a71cca2dbf91026ced4040ba4195adb08c..59a053cf2bf5088236b76c9583cfc4b177284944 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php @@ -49,14 +49,14 @@ class Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource @@ -226,7 +226,7 @@ class Collection $selectUnions = array(); // apply date boundaries (before calling $this->_applyDateRangeFilter()) - $dtFormat = \Magento\Date::DATE_INTERNAL_FORMAT; + $dtFormat = \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT; $periodFrom = (!is_null($this->_from) ? new \Zend_Date($this->_from, $dtFormat) : null); $periodTo = (!is_null($this->_to) ? new \Zend_Date($this->_to, $dtFormat) : null); if ('year' == $this->_period) { diff --git a/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php b/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php index 77380a7f39fee69352290b9a521a279b0ecf22ec..4a99ca15354c902859a0b7fbb95c51c5f33cbd1d 100644 --- a/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php @@ -43,7 +43,7 @@ class Collection extends \Magento\Review\Model\Resource\Review\Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Review\Helper\Data $reviewData * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory @@ -54,7 +54,7 @@ class Collection extends \Magento\Review\Model\Resource\Review\Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Review\Helper\Data $reviewData, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, diff --git a/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php b/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php index 24ed7cc5a239e9cddaa28fc84907345114706fe5..69f27ede6ee58117a96aedba219053ab3ba0d178 100644 --- a/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php @@ -50,7 +50,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerResFactory @@ -58,7 +58,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerResFactory, diff --git a/app/code/Magento/Reports/etc/adminhtml/di.xml b/app/code/Magento/Reports/etc/adminhtml/di.xml index 353c9c47da64ab984002ce04de4ff072eda2e890..78baa2be87a04860b1af31c363f1b5702405bb50 100644 --- a/app/code/Magento/Reports/etc/adminhtml/di.xml +++ b/app/code/Magento/Reports/etc/adminhtml/di.xml @@ -24,20 +24,9 @@ */ --> <config> - <virtualType name="Magento\Reports\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> - <value>reports</value> - </param> + <virtualType name="Magento\Reports\Model\Session"> <param name="sessionName"> <value>adminhtml</value> </param> </virtualType> - <type name="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> - <value>reports</value> - </param> - <param name="sessionName"> - <value>adminhtml</value> - </param> - </type> </config> diff --git a/app/code/Magento/Reports/etc/di.xml b/app/code/Magento/Reports/etc/di.xml index 2b2880ac3f08e03e9e0716122d77dd5220c88221..e94a86e861a6a5cb6597a5b4b4b1cad586d27c3a 100644 --- a/app/code/Magento/Reports/etc/di.xml +++ b/app/code/Magento/Reports/etc/di.xml @@ -27,11 +27,21 @@ <type name="Magento\Log\Model\Resource\Log"> <plugin name="reportLog" type="Magento\Reports\Model\Plugin\Log" /> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <reports_setup>Magento\Reports\Model\Resource\Setup</reports_setup> </value> </param> </type> + <virtualType name="Magento\Reports\Model\Session" type="Magento\Core\Model\Session\Generic"> + <param name="sessionNamespace"> + <value>reports</value> + </param> + </virtualType> + <type name="Magento\Reports\Model\Product\Index\AbstractIndex"> + <param name="reportSession"> + <instance type="Magento\Reports\Model\Session" /> + </param> + </type> </config> diff --git a/app/code/Magento/Reports/etc/frontend/di.xml b/app/code/Magento/Reports/etc/frontend/di.xml index 7481807f4b6991f2682e60eca2b2ec7fc65999f9..5ddf4912602e29a1d98dfc2c474adebf50537fce 100644 --- a/app/code/Magento/Reports/etc/frontend/di.xml +++ b/app/code/Magento/Reports/etc/frontend/di.xml @@ -24,20 +24,9 @@ */ --> <config> - <virtualType name="Magento\Reports\Model\Session" type="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> - <value>reports</value> - </param> + <virtualType name="Magento\Reports\Model\Session"> <param name="sessionName"> <value>frontend</value> </param> </virtualType> - <type name="Magento\Core\Model\Session\Generic"> - <param name="sessionNamespace"> - <value>reports</value> - </param> - <param name="sessionName"> - <value>frontend</value> - </param> - </type> </config> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/adminhtml_report_review_customer_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/adminhtml_report_review_customer_grid.xml index c0e434dfd7bac5310fc45bdd12b97447ad202c38..5214043360a64d0737080327923755c035516a41 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/adminhtml_report_review_customer_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/adminhtml_report_review_customer_grid.xml @@ -51,7 +51,7 @@ <argument name="filter_visibility" xsi:type="string">0</argument> <argument name="id" xsi:type="string">customers_grid</argument> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">*/catalog_product_review</item> + <item name="path" xsi:type="string">catalog/product_review</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="customerid" xsi:type="string">getCustomerId</item> </item> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/adminhtml_report_review_product_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/adminhtml_report_review_product_grid.xml index d48fdf00bb58940e5d535b135a5b8dd4ab353140..74f9de7b8b84db36e19ad41bd02e48868c581086 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/adminhtml_report_review_product_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/adminhtml_report_review_product_grid.xml @@ -51,7 +51,7 @@ <argument name="filter_visibility" xsi:type="string">0</argument> <argument name="id" xsi:type="string">gridProducts</argument> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">*/catalog_product_review</item> + <item name="path" xsi:type="string">catalog/product_review</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="productId" xsi:type="string">getrId</item> </item> diff --git a/app/code/Magento/Review/Block/Customer/Recent.php b/app/code/Magento/Review/Block/Customer/Recent.php index 66846821528b0022cf20a4acb5b128f44d8148a1..ffb789472d38984841896e6f7b2dfcea3655f3a8 100644 --- a/app/code/Magento/Review/Block/Customer/Recent.php +++ b/app/code/Magento/Review/Block/Customer/Recent.php @@ -24,18 +24,16 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Review\Block\Customer; + /** * Recent Customer Reviews Block - * - * @category Magento - * @package Magento_Review - * @author Magento Core Team <core@magentocommerce.com> */ - -namespace Magento\Review\Block\Customer; - class Recent extends \Magento\Core\Block\Template { + /** + * @var string + */ protected $_template = 'customer/list.phtml'; /** @@ -55,12 +53,20 @@ class Recent extends \Magento\Core\Block\Template */ protected $_storeManager; + /** + * Filter manager + * + * @var \Magento\Filter\FilterManager + */ + protected $filter; + /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Block\Template\Context $context * @param \Magento\Review\Model\Resource\Review\Product\CollectionFactory $collectionFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Filter\FilterManager $filter * @param array $data */ public function __construct( @@ -69,14 +75,36 @@ class Recent extends \Magento\Core\Block\Template \Magento\Review\Model\Resource\Review\Product\CollectionFactory $collectionFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Filter\FilterManager $filter, array $data = array() ) { $this->_collection = $collectionFactory->create(); $this->_customerSession = $customerSession; $this->_storeManager = $storeManager; + $this->filter = $filter; parent::__construct($coreData, $context, $data); } + /** + * Truncate string + * + * @param string $value + * @param int $length + * @param string $etc + * @param string &$remainder + * @param bool $breakWords + * @return string + */ + public function truncateString($value, $length = 80, $etc = '...', &$remainder = '', $breakWords = true) + { + return $this->filter->truncate($value, array( + 'length' => $length, + 'etc' => $etc, + 'remainder' => $remainder, + 'breakWords' => $breakWords + )); + } + protected function _initCollection() { $this->_collection diff --git a/app/code/Magento/Review/Block/Product/View.php b/app/code/Magento/Review/Block/Product/View.php index a556a4b6e747a089a34d96ba34ed042fe6212bec..129d2c250272b01b5856cad9e2e1bdb82de7b45a 100644 --- a/app/code/Magento/Review/Block/Product/View.php +++ b/app/code/Magento/Review/Block/Product/View.php @@ -46,15 +46,13 @@ class View extends \Magento\Catalog\Block\Product\View protected $_reviewsColFactory; /** - * Construct - * * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Config $catalogConfig * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Tax\Model\Calculation $taxCalculation * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Helper\Data $coreData @@ -71,7 +69,7 @@ class View extends \Magento\Catalog\Block\Product\View \Magento\Core\Model\LocaleInterface $locale, \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Tax\Helper\Data $taxData, \Magento\Catalog\Helper\Data $catalogData, \Magento\Core\Helper\Data $coreData, @@ -81,7 +79,7 @@ class View extends \Magento\Catalog\Block\Product\View ) { $this->_reviewsColFactory = $collectionFactory; parent::__construct($storeManager, $catalogConfig, $productFactory, $locale, $taxCalculation, $coreRegistry, - $coreString, $taxData, $catalogData, $coreData, $context, $data); + $string, $taxData, $catalogData, $coreData, $context, $data); } /** diff --git a/app/code/Magento/Review/Controller/Product.php b/app/code/Magento/Review/Controller/Product.php index 31ab87e6b2b2d307bf2acfac394cedb323a093ca..e4dabd672c6d3c0fe8ad795e1f3ff22cea8993e9 100644 --- a/app/code/Magento/Review/Controller/Product.php +++ b/app/code/Magento/Review/Controller/Product.php @@ -75,7 +75,7 @@ class Product extends \Magento\Core\Controller\Front\Action protected $_categoryFactory; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -111,7 +111,7 @@ class Product extends \Magento\Core\Controller\Front\Action * @param \Magento\UrlInterface $urlModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Rating\Model\RatingFactory $ratingFactory @@ -126,7 +126,7 @@ class Product extends \Magento\Core\Controller\Front\Action \Magento\UrlInterface $urlModel, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Rating\Model\RatingFactory $ratingFactory, diff --git a/app/code/Magento/Review/Helper/Data.php b/app/code/Magento/Review/Helper/Data.php index 32f782b1830b77683fffdb7a0e4542058d9eee39..4133b1a655d1c4439e925965ab35a51fce28f5d6 100644 --- a/app/code/Magento/Review/Helper/Data.php +++ b/app/code/Magento/Review/Helper/Data.php @@ -24,23 +24,21 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Review\Helper; + /** * Default review helper - * - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Review\Helper; - class Data extends \Magento\Core\Helper\AbstractHelper { const XML_REVIEW_GUETS_ALLOW = 'catalog/review/allow_guest'; /** - * Core string + * Filter manager * - * @var \Magento\Core\Helper\String + * @var \Magento\Filter\FilterManager */ - protected $_coreString = null; + protected $filter; /** * Core store config @@ -50,23 +48,35 @@ class Data extends \Magento\Core\Helper\AbstractHelper protected $_coreStoreConfig; /** - * @param \Magento\Core\Helper\String $coreString + * @var \Magento\Escaper + */ + protected $_escaper; + + /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Escaper $escaper + * @param \Magento\Filter\FilterManager $filter */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Core\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Escaper $escaper, + \Magento\Filter\FilterManager $filter ) { - $this->_coreString = $coreString; $this->_coreStoreConfig = $coreStoreConfig; + $this->_escaper = $escaper; + $this->filter = $filter; parent::__construct($context); } + /** + * @param string $origDetail + * @return string + */ public function getDetail($origDetail) { - return nl2br($this->_coreString->truncate($origDetail, 50)); + return nl2br($this->filter->truncate($origDetail, array('length' => 50))); } /** @@ -76,7 +86,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function getDetailHtml($origDetail) { - return nl2br($this->_coreString->truncate($this->escapeHtml($origDetail), 50)); + return nl2br($this->filter->truncate($this->_escaper->escapeHtml($origDetail), array('length' => 50))); } /** @@ -109,8 +119,8 @@ class Data extends \Magento\Core\Helper\AbstractHelper public function getReviewStatusesOptionArray() { $result = array(); - foreach ($this->getReviewStatuses() as $k => $v) { - $result[] = array('value' => $k, 'label' => $v); + foreach ($this->getReviewStatuses() as $value => $label) { + $result[] = array('value' => $value, 'label' => $label); } return $result; diff --git a/app/code/Magento/Review/Model/Resource/Review.php b/app/code/Magento/Review/Model/Resource/Review.php index 306b3ffde74b5390e33fc95972dc16a5f3d8fd18..967267de2f640081cad32989bfa475f91f39f190 100644 --- a/app/code/Magento/Review/Model/Resource/Review.php +++ b/app/code/Magento/Review/Model/Resource/Review.php @@ -106,14 +106,14 @@ class Review extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_ratingOptions; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Date $date * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Rating\Model\RatingFactory $ratingFactory * @param \Magento\Rating\Model\Resource\Rating\Option $ratingOptions */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\Date $date, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Rating\Model\RatingFactory $ratingFactory, @@ -429,12 +429,9 @@ class Review extends \Magento\Core\Model\Resource\Db\AbstractDb if ($ratingIds && !is_array($ratingIds)) { $ratingIds = array((int)$ratingIds); } - $resource = $this->_ratingOptions; - if ($ratingIds && $entityPkValue && $resource) { + if ($ratingIds && $entityPkValue) { foreach ($ratingIds as $ratingId) { - $this->_ratingOption->aggregateEntityByRatingId( - $ratingId, $entityPkValue - ); + $this->_ratingOptions->aggregateEntityByRatingId($ratingId, $entityPkValue); } } return $this; diff --git a/app/code/Magento/Review/Model/Resource/Review/Collection.php b/app/code/Magento/Review/Model/Resource/Review/Collection.php index d43ea819a4275f4c018a594e97b62cc335ebb739..093bade1e48180ed7cd351ca117c01c6b799a0c4 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Review/Collection.php @@ -96,7 +96,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Review\Helper\Data $reviewData * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory @@ -106,7 +106,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Review\Helper\Data $reviewData, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, diff --git a/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php b/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php index 63df93d72e4f2b224574900a5b2f2dc337c65b19..2e23cbf34b0efd2354518361f42f0d1b726e681f 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php @@ -65,11 +65,6 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection */ protected $_storesIds = array(); - /** - * @var \Magento\Core\Model\Resource - */ - protected $_resourceModel; - /** * @var \Magento\Rating\Model\RatingFactory */ @@ -81,14 +76,12 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection protected $_voteFactory; /** - * Construct - * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -100,19 +93,19 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\Resource $resourceModel + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Rating\Model\RatingFactory $ratingFactory * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $resource, \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -124,16 +117,15 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Resource\Helper $resourceHelper, - \Magento\Core\Model\Resource $resourceModel, + \Magento\Stdlib\DateTime $dateTime, \Magento\Rating\Model\RatingFactory $ratingFactory, \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory ) { - $this->_resourceModel = $resourceModel; $this->_ratingFactory = $ratingFactory; $this->_voteFactory = $voteFactory; - parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $coreResource, + parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $eavConfig, $resource, $eavEntityFactory, $universalFactory, $storeManager, $catalogData, $catalogProductFlat, $coreStoreConfig, - $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper + $productOptionFactory, $catalogUrl, $locale, $customerSession, $resourceHelper, $dateTime ); } @@ -144,7 +136,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection { $this->_init('Magento\Catalog\Model\Product', 'Magento\Catalog\Model\Resource\Product'); $this->setRowIdFieldName('review_id'); - $this->_reviewStoreTable = $this->_resourceModel->getTableName('review_store'); + $this->_reviewStoreTable = $this->_resource->getTableName('review_store'); $this->_initTables(); } @@ -347,8 +339,8 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection */ protected function _joinFields() { - $reviewTable = $this->_resourceModel->getTableName('review'); - $reviewDetailTable = $this->_resourceModel->getTableName('review_detail'); + $reviewTable = $this->_resource->getTableName('review'); + $reviewDetailTable = $this->_resource->getTableName('review_detail'); $this->addAttributeToSelect('name') ->addAttributeToSelect('sku'); diff --git a/app/code/Magento/Review/Model/Resource/Review/Summary/Collection.php b/app/code/Magento/Review/Model/Resource/Review/Summary/Collection.php index c25c8ea8cafc263630e96844280a732d29295e5a..cef26369d3a31b817a22cea6cd5b4be8751a2af9 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Summary/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Review/Summary/Collection.php @@ -42,16 +42,16 @@ class Collection extends \Magento\Data\Collection\Db protected $_summaryTable; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_setIdFieldName('primary_id'); diff --git a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php index 475e99cb21658ae9ff21f281f173046535c392b4..48c7ffca0c2359f5efdccb1332e30f02d4be0602 100644 --- a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php +++ b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php @@ -111,11 +111,11 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog $product = $this->_productFactory->create(); $todayStartOfDayDate = $this->_locale->date() ->setTime('00:00:00') - ->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + ->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); $todayEndOfDayDate = $this->_locale->date() ->setTime('23:59:59') - ->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + ->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); /** @var $products \Magento\Catalog\Model\Resource\Product\Collection */ $products = $product->getCollection(); diff --git a/app/code/Magento/Rss/Block/Catalog/NotifyStock.php b/app/code/Magento/Rss/Block/Catalog/NotifyStock.php index eb89ad8bbe891aed67a20e946a8db6c062a9f595..b3d53567932795dd1a7e24375a4993bed41e2ff9 100644 --- a/app/code/Magento/Rss/Block/Catalog/NotifyStock.php +++ b/app/code/Magento/Rss/Block/Catalog/NotifyStock.php @@ -25,26 +25,12 @@ */ /** - * Review form block + * Catalog low stock RSS block */ namespace Magento\Rss\Block\Catalog; -class NotifyStock extends \Magento\Core\Block\AbstractBlock +class NotifyStock extends \Magento\Backend\Block\AbstractBlock { - /** - * Rss data - * - * @var \Magento\Rss\Helper\Data - */ - protected $_rssData; - - /** - * Adminhtml data - * - * @var \Magento\Backend\Helper\Data - */ - protected $_adminhtmlData; - /** * @var \Magento\Rss\Model\RssFactory */ @@ -71,9 +57,7 @@ class NotifyStock extends \Magento\Core\Block\AbstractBlock protected $_resourceIterator; /** - * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param \Magento\Rss\Helper\Data $rssData - * @param \Magento\Core\Block\Context $context + * @param \Magento\Backend\Block\Context $context * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\CatalogInventory\Model\Resource\StockFactory $stockFactory @@ -82,9 +66,7 @@ class NotifyStock extends \Magento\Core\Block\AbstractBlock * @param array $data */ public function __construct( - \Magento\Backend\Helper\Data $adminhtmlData, - \Magento\Rss\Helper\Data $rssData, - \Magento\Core\Block\Context $context, + \Magento\Backend\Block\Context $context, \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\CatalogInventory\Model\Resource\StockFactory $stockFactory, @@ -92,8 +74,6 @@ class NotifyStock extends \Magento\Core\Block\AbstractBlock \Magento\Core\Model\Resource\Iterator $resourceIterator, array $data = array() ) { - $this->_adminhtmlData = $adminhtmlData; - $this->_rssData = $rssData; $this->_rssFactory = $rssFactory; $this->_productFactory = $productFactory; $this->_stockFactory = $stockFactory; @@ -109,7 +89,7 @@ class NotifyStock extends \Magento\Core\Block\AbstractBlock */ protected function _toHtml() { - $newUrl = $this->_urlBuilder->getUrl('rss/catalog/notifystock'); + $newUrl = $this->getUrl('rss/catalog/notifystock', array('_secure' => true, '_nosecret' => true)); $title = __('Low Stock Products'); /** @var $rssObj \Magento\Rss\Model\Rss */ $rssObj = $this->_rssFactory->create(); @@ -123,7 +103,6 @@ class NotifyStock extends \Magento\Core\Block\AbstractBlock $globalNotifyStockQty = (float)$this->_storeConfig->getConfig( \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_NOTIFY_STOCK_QTY ); - $this->_rssData->disableFlat(); /* @var $product \Magento\Catalog\Model\Product */ $product = $this->_productFactory->create(); /* @var $collection \Magento\Catalog\Model\Resource\Product\Collection */ @@ -167,7 +146,7 @@ class NotifyStock extends \Magento\Core\Block\AbstractBlock /* @var $product \Magento\Catalog\Model\Product */ $product = $args['product']; $product->setData($args['row']); - $url = $this->_adminhtmlData->getUrl('catalog/product/edit/', + $url = $this->getUrl('catalog/product/edit', array('id' => $product->getId(), '_secure' => true, '_nosecret' => true)); $qty = 1 * $product->getQty(); $description = __('%1 has reached a quantity of %2.', $product->getName(), $qty); diff --git a/app/code/Magento/Rss/Block/Catalog/Review.php b/app/code/Magento/Rss/Block/Catalog/Review.php index 34270e271c8fc4b4358b71ad1face6870fc926e8..b05fe1492f0dd34b85288dc8b9acec0b605a4465 100644 --- a/app/code/Magento/Rss/Block/Catalog/Review.php +++ b/app/code/Magento/Rss/Block/Catalog/Review.php @@ -29,22 +29,8 @@ */ namespace Magento\Rss\Block\Catalog; -class Review extends \Magento\Core\Block\AbstractBlock +class Review extends \Magento\Backend\Block\AbstractBlock { - /** - * Rss data - * - * @var \Magento\Rss\Helper\Data - */ - protected $_rssData = null; - - /** - * Adminhtml data - * - * @var \Magento\Backend\Helper\Data - */ - protected $_adminhtmlData = null; - /** * @var \Magento\Rss\Model\RssFactory */ @@ -66,31 +52,33 @@ class Review extends \Magento\Core\Block\AbstractBlock protected $_storeManager; /** - * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param \Magento\Rss\Helper\Data $rssData - * @param \Magento\Core\Block\Context $context + * @var \Magento\Core\Model\Url + */ + protected $_urlModel; + + /** + * @param \Magento\Backend\Block\Context $context * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Core\Model\Resource\Iterator $resourceIterator * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Model\Url $urlModel * @param array $data */ public function __construct( - \Magento\Backend\Helper\Data $adminhtmlData, - \Magento\Rss\Helper\Data $rssData, - \Magento\Core\Block\Context $context, + \Magento\Backend\Block\Context $context, \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Core\Model\Resource\Iterator $resourceIterator, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\Model\Url $urlModel, array $data = array() ) { - $this->_adminhtmlData = $adminhtmlData; - $this->_rssData = $rssData; $this->_rssFactory = $rssFactory; $this->_resourceIterator = $resourceIterator; $this->_reviewFactory = $reviewFactory; $this->_storeManager = $storeManager; + $this->_urlModel = $urlModel; parent::__construct($context, $data); } @@ -101,9 +89,8 @@ class Review extends \Magento\Core\Block\AbstractBlock */ protected function _toHtml() { - $newUrl = $this->_urlBuilder->getUrl('rss/catalog/review'); + $newUrl = $this->getUrl('rss/catalog/review', array('_secure' => true, '_nosecret' => true)); $title = __('Pending product review(s)'); - $this->_rssData->disableFlat(); /** @var $rssObj \Magento\Rss\Model\Rss */ $rssObj = $this->_rssFactory->create(); @@ -143,13 +130,14 @@ class Review extends \Magento\Core\Block\AbstractBlock $rssObj = $args['rssObj']; $row = $args['row']; - $store = $this->_storeManager->getStore($row['store_id']); - $productUrl = $store->getUrl('catalog/product/view', array('id' => $row['entity_id'])); - $reviewUrl = $this->_adminhtmlData->getUrl( + $productUrl = $this->_urlModel + ->setStore($row['store_id']) + ->getUrl('catalog/product/view', array('id' => $row['entity_id'])); + $reviewUrl = $this->getUrl( 'catalog/product_review/edit/', array('id' => $row['review_id'], '_secure' => true, '_nosecret' => true) ); - $storeName = $store->getName(); + $storeName = $this->_storeManager->getStore($row['store_id'])->getName(); $description = '<p>' . __('Product: <a href="%1">%2</a> <br/>', $productUrl, $row['name']) . __('Summary of review: %1 <br/>', $row['title']) diff --git a/app/code/Magento/Rss/Block/Catalog/Special.php b/app/code/Magento/Rss/Block/Catalog/Special.php index 3cd3c5910083ea643ea8b44fffbc1292273866e2..0a57b1efc399a397c94eab1d362b115b1d42a016 100644 --- a/app/code/Magento/Rss/Block/Catalog/Special.php +++ b/app/code/Magento/Rss/Block/Catalog/Special.php @@ -212,7 +212,7 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog && $row['allowed_price_in_rss'] ) { $compareDate = self::$_currentDate->compareDate($row['special_to_date'], - \Magento\Date::DATE_INTERNAL_FORMAT); + \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT); if (-1 === $compareDate || 0 === $compareDate) { $row['use_special'] = true; } diff --git a/app/code/Magento/Rss/Block/Order/NewOrder.php b/app/code/Magento/Rss/Block/Order/NewOrder.php index de10f9deb931e1a9c7b8eaff93eb76c572c05eaa..3e678c837a4cf17bd84ea85b9c923e012e346758 100644 --- a/app/code/Magento/Rss/Block/Order/NewOrder.php +++ b/app/code/Magento/Rss/Block/Order/NewOrder.php @@ -29,15 +29,8 @@ */ namespace Magento\Rss\Block\Order; -class NewOrder extends \Magento\Core\Block\AbstractBlock +class NewOrder extends \Magento\Backend\Block\AbstractBlock { - /** - * Adminhtml data - * - * @var \Magento\Backend\Helper\Data - */ - protected $_adminhtmlData = null; - /** * @var \Magento\Rss\Model\RssFactory */ @@ -54,25 +47,30 @@ class NewOrder extends \Magento\Core\Block\AbstractBlock protected $_resourceIterator; /** - * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param \Magento\Core\Block\Context $context + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + + /** + * @param \Magento\Backend\Block\Context $context * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Stdlib\DateTime $dateTime * @param array $data */ public function __construct( - \Magento\Backend\Helper\Data $adminhtmlData, - \Magento\Core\Block\Context $context, + \Magento\Backend\Block\Context $context, \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Stdlib\DateTime $dateTime, array $data = array() ) { - $this->_adminhtmlData = $adminhtmlData; $this->_rssFactory = $rssFactory; $this->_orderFactory = $orderFactory; $this->_resourceIterator = $resourceIterator; + $this->_dateTime = $dateTime; parent::__construct($context, $data); } @@ -80,10 +78,8 @@ class NewOrder extends \Magento\Core\Block\AbstractBlock { /** @var $order \Magento\Sales\Model\Order */ $order = $this->_orderFactory->create(); - $passDate = $order->getResource()->formatDate(mktime(0, 0, 0, date('m'), date('d')-7)); - $newUrl = $this->_adminhtmlData->getUrl( - 'adminhtml/sales_order', array('_secure' => true, '_nosecret' => true) - ); + $passDate = $this->_dateTime->formatDate(mktime(0, 0, 0, date('m'), date('d')-7)); + $newUrl = $this->getUrl('rss/order/new', array('_secure' => true, '_nosecret' => true)); $title = __('New Orders'); /** @var $rssObj \Magento\Rss\Model\Rss */ @@ -121,13 +117,8 @@ class NewOrder extends \Magento\Core\Block\AbstractBlock $order->reset()->load($args['row']['entity_id']); if ($order && $order->getId()) { $title = __('Order #%1 created at %2', $order->getIncrementId(), $this->formatDate($order->getCreatedAt())); - $url = $this->_adminhtmlData->getUrl( - 'sales/order/view', - array( - '_secure' => true, - 'order_id' => $order->getId(), - '_nosecret' => true - ) + $url = $this->getUrl('sales/order/view', + array('_secure' => true, 'order_id' => $order->getId(), '_nosecret' => true) ); $detailBlock->setOrder($order); $rssObj->_addEntry(array( diff --git a/app/code/Magento/Rss/Controller/Adminhtml/Authenticate.php b/app/code/Magento/Rss/Controller/Adminhtml/Authenticate.php new file mode 100644 index 0000000000000000000000000000000000000000..0626a74c08598d3c74479e5bf4dabdba215cc326 --- /dev/null +++ b/app/code/Magento/Rss/Controller/Adminhtml/Authenticate.php @@ -0,0 +1,94 @@ +<?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_Rss + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * RSS Controller with HTTP Basic authentication + */ +namespace Magento\Rss\Controller\Adminhtml; + +class Authenticate extends \Magento\Backend\Controller\Adminhtml\Action +{ + /** + * @var \Magento\Core\Model\Logger + */ + protected $_logger; + + /** + * @param \Magento\Backend\Controller\Context $context + */ + public function __construct(\Magento\Backend\Controller\Context $context) + { + $this->_logger = $context->getLogger(); + parent::__construct($context); + $this->_objectManager->get('Magento\Backend\Model\Url')->turnOffSecretKey(); + } + + /** + * Return required ACL resource for current action + * @return string + */ + protected function _getActionAclResource() + { + return 'Magento_Rss::rss'; + } + + /** + * Replace standard admin login form with HTTP Basic authentication + * @return bool|\Magento\Backend\Controller\AbstractAction + */ + protected function _initAuthentication() + { + $aclResource = $this->_getActionAclResource(); + if (!$aclResource) { + return parent::_initAuthentication(); + } + + /** @var $auth \Magento\Backend\Model\Auth */ + $auth = $this->_objectManager->create('Magento\Backend\Model\Auth'); + $session = $auth->getAuthStorage(); + + // Try to login using HTTP-authentication + if (!$session->isLoggedIn()) { + list($login, $password) = $this->_objectManager->get('Magento\HTTP\Authentication')->getCredentials(); + try { + $auth->login($login, $password); + } catch (\Magento\Backend\Model\Auth\Exception $e) { + $this->_logger->logException($e); + } + } + + // Verify if logged in and authorized + if (!$session->isLoggedIn() + || !$this->_objectManager->get('Magento\AuthorizationInterface')->isAllowed($aclResource) + ) { + $this->_objectManager->get('Magento\HTTP\Authentication')->setAuthenticationFailed('RSS Feeds'); + $this->setFlag('', self::FLAG_NO_DISPATCH, true); + return false; + } + + return true; + } +} diff --git a/app/code/Magento/Rss/Controller/Adminhtml/Catalog.php b/app/code/Magento/Rss/Controller/Adminhtml/Catalog.php new file mode 100644 index 0000000000000000000000000000000000000000..1a6edf76dad8ad39344cb523b9e5b43a22693e28 --- /dev/null +++ b/app/code/Magento/Rss/Controller/Adminhtml/Catalog.php @@ -0,0 +1,68 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Rss + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * RSS Controller for Catalog feeds in Admin + */ +namespace Magento\Rss\Controller\Adminhtml; + +class Catalog extends \Magento\Rss\Controller\Adminhtml\Authenticate +{ + /** + * Return required ACL resource for current action + * + * @return bool|string + */ + protected function _getActionAclResource() + { + $acl = array( + 'notifystock' => 'Magento_Catalog::products', + 'review' => 'Magento_Review::reviews_all' + ); + $action = $this->getRequest()->getActionName(); + return isset($acl[$action]) ? $acl[$action] : false; + } + + /** + * Notify stock action + */ + public function notifystockAction() + { + $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8'); + $this->loadLayout(false); + $this->renderLayout(); + } + + /** + * Review action + */ + public function reviewAction() + { + $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8'); + $this->loadLayout(false); + $this->renderLayout(); + } +} diff --git a/app/code/Magento/Rss/Controller/Adminhtml/Order.php b/app/code/Magento/Rss/Controller/Adminhtml/Order.php new file mode 100644 index 0000000000000000000000000000000000000000..b11470376fd5e5a6cc0de8b763c077cfaeca488d --- /dev/null +++ b/app/code/Magento/Rss/Controller/Adminhtml/Order.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_Rss + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * RSS Controller for Orders feed in Admin + */ +namespace Magento\Rss\Controller\Adminhtml; + +class Order extends \Magento\Rss\Controller\Adminhtml\Authenticate +{ + /** + * Return required ACL resource for current action + * + * @return string + */ + protected function _getActionAclResource() + { + return 'Magento_Sales::sales_order'; + } + + /** + * New orders action + */ + public function newAction() + { + $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8'); + $this->loadLayout(false); + $this->renderLayout(); + } +} diff --git a/app/code/Magento/Rss/Controller/Catalog.php b/app/code/Magento/Rss/Controller/Catalog.php index cd849b309d47428668ab01574fc16d3a43b337e1..a75bea291bf5454ebdaec02884d411aaf4928f9f 100644 --- a/app/code/Magento/Rss/Controller/Catalog.php +++ b/app/code/Magento/Rss/Controller/Catalog.php @@ -25,65 +25,29 @@ */ /** - * Customer reviews controller + * RSS Controller for Catalog feeds */ namespace Magento\Rss\Controller; class Catalog extends \Magento\Core\Controller\Front\Action { - /** - * @var \Magento\Config\Scope - */ - protected $_configScope; - /** * @var \Magento\Core\Model\Store\Config */ protected $_storeConfig; - /** - * @var \Magento\Core\Model\Logger - */ - protected $_logger; - /** * @param \Magento\Core\Controller\Varien\Action\Context $context - * @param \Magento\Config\Scope $configScope * @param \Magento\Core\Model\Store\Config $storeConfig */ public function __construct( \Magento\Core\Controller\Varien\Action\Context $context, - \Magento\Config\Scope $configScope, \Magento\Core\Model\Store\Config $storeConfig ) { - $this->_configScope = $configScope; $this->_storeConfig = $storeConfig; - $this->_logger = $context->getLogger(); parent::__construct($context); } - /** - * Emulate admin area for certain actions - */ - public function preDispatch() - { - $action = $this->getRequest()->getActionName(); - /** - * Format actionName => acrResourceId - */ - $acl = array( - 'notifystock' => 'Magento_Catalog::products', - 'review' => 'Magento_Review::reviews_all', - ); - if (isset($acl[$action])) { - $this->_configScope->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); - if ($this->authenticateAndAuthorizeAdmin($acl[$action], $this->_logger)) { - return; - } - } - parent::preDispatch(); - } - public function newAction() { $this->_genericAction('new'); @@ -99,16 +63,6 @@ class Catalog extends \Magento\Core\Controller\Front\Action $this->_genericAction('salesrule'); } - public function notifystockAction() - { - $this->_render(); - } - - public function reviewAction() - { - $this->_render(); - } - public function categoryAction() { $this->_genericAction('category'); diff --git a/app/code/Magento/Rss/Controller/Index.php b/app/code/Magento/Rss/Controller/Index.php index e9bfd7f75a317350b8634749fd2b7073baae7b23..a96c00e259081efeb55787eb0b6954f58e06102c 100644 --- a/app/code/Magento/Rss/Controller/Index.php +++ b/app/code/Magento/Rss/Controller/Index.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Rss\Controller; class Index extends \Magento\Core\Controller\Front\Action diff --git a/app/code/Magento/Rss/Controller/Order.php b/app/code/Magento/Rss/Controller/Order.php index d325e19d368de55437461936facf713ba5f4bfda..d10950960928a4d36e08cfc919bb4b39959bda6f 100644 --- a/app/code/Magento/Rss/Controller/Order.php +++ b/app/code/Magento/Rss/Controller/Order.php @@ -25,17 +25,12 @@ */ /** - * Customer reviews controller + * RSS Controller for Order feed */ namespace Magento\Rss\Controller; class Order extends \Magento\Core\Controller\Front\Action { - /** - * @var \Magento\Config\Scope - */ - protected $_configScope; - /** * Core registry * @@ -43,45 +38,18 @@ class Order extends \Magento\Core\Controller\Front\Action */ protected $_coreRegistry = null; - /** - * @var \Magento\Core\Model\Logger - */ - protected $_logger; - /** * @param \Magento\Core\Controller\Varien\Action\Context $context * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Config\Scope $configScope */ public function __construct( \Magento\Core\Controller\Varien\Action\Context $context, - \Magento\Core\Model\Registry $coreRegistry, - \Magento\Config\Scope $configScope + \Magento\Core\Model\Registry $coreRegistry ) { $this->_coreRegistry = $coreRegistry; - $this->_configScope = $configScope; - $this->_logger = $context->getLogger(); parent::__construct($context); } - public function preDispatch() - { - if ('new' === $this->getRequest()->getActionName()) { - $this->_configScope->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); - if (!$this->authenticateAndAuthorizeAdmin('Magento_Sales::sales_order', $this->_logger)) { - return; - } - } - parent::preDispatch(); - } - - public function newAction() - { - $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8'); - $this->loadLayout(false); - $this->renderLayout(); - } - /** * Order status action */ diff --git a/app/code/Magento/Rss/Helper/Data.php b/app/code/Magento/Rss/Helper/Data.php deleted file mode 100644 index a5d951d0e38e6eb3d5ed7bae540bbd12acf27316..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rss/Helper/Data.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Rss - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** - * Rss data helper - * - * @category Magento - * @package Magento_Rss - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Rss\Helper; - -class Data extends \Magento\Core\Helper\AbstractHelper -{ - /** - * Catalog product flat - * - * @var \Magento\Catalog\Helper\Product\Flat - */ - protected $_catalogProductFlat; - - /** - * @var \Magento\Core\Model\App\EmulationFactory - */ - protected $_emulationFactory; - - /** - * @param \Magento\Catalog\Helper\Product\Flat $catalogProductFlat - * @param \Magento\Core\Helper\Context $context - * @param \Magento\Core\Model\App\EmulationFactory $emulationFactory - */ - public function __construct( - \Magento\Catalog\Helper\Product\Flat $catalogProductFlat, - \Magento\Core\Helper\Context $context, - \Magento\Core\Model\App\EmulationFactory $emulationFactory - ) { - $this->_catalogProductFlat = $catalogProductFlat; - $this->_emulationFactory = $emulationFactory; - parent::__construct($context); - } - - /** - * Disable using of flat catalog and/or product model to prevent limiting results to single store. Probably won't - * work inside a controller. - * - * @return null - */ - public function disableFlat() - { - if ($this->_catalogProductFlat->isAvailable()) { - /* @var $emulationModel \Magento\Core\Model\App\Emulation */ - $emulationModel = $this->_emulationFactory->create(); - // Emulate admin environment to disable using flat model - otherwise we won't get global stats - // for all stores - $emulationModel->startEnvironmentEmulation(0, \Magento\Core\Model\App\Area::AREA_ADMIN); - } - } -} diff --git a/app/code/Magento/Rss/Model/Resource/Order.php b/app/code/Magento/Rss/Model/Resource/Order.php index 80b95c552b551366cf01350e30f6eed1e0ab1b2f..9ae2b0d64a41be52448b56a64727d478db1af194 100644 --- a/app/code/Magento/Rss/Model/Resource/Order.php +++ b/app/code/Magento/Rss/Model/Resource/Order.php @@ -37,14 +37,14 @@ namespace Magento\Rss\Model\Resource; class Order { /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ - public function __construct(\Magento\Core\Model\Resource $resource) + public function __construct(\Magento\App\Resource $resource) { $this->_resource = $resource; } @@ -57,7 +57,7 @@ class Order */ public function getAllCommentCollection($orderId) { - /** @var $res \Magento\Core\Model\Resource */ + /** @var $res \Magento\App\Resource */ $res = $this->_resource; $read = $res->getConnection('core_read'); diff --git a/app/code/Magento/Rss/etc/adminhtml/routes.xml b/app/code/Magento/Rss/etc/adminhtml/routes.xml new file mode 100644 index 0000000000000000000000000000000000000000..7811ed68a4564154981b34e03e881a455f5f5135 --- /dev/null +++ b/app/code/Magento/Rss/etc/adminhtml/routes.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Rss + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <router id="admin"> + <route id="rss" frontName="rss"> + <module name="Magento_Rss_Adminhtml" before="Magento_Adminhtml" /> + </route> + </router> +</config> diff --git a/app/code/Magento/Rss/etc/frontend/routes.xml b/app/code/Magento/Rss/etc/frontend/routes.xml index 2353f26cea6e3c35230c6b272ef0497920e261f9..0e7ccc896584bf3c854ae18a869c9402c5529caa 100644 --- a/app/code/Magento/Rss/etc/frontend/routes.xml +++ b/app/code/Magento/Rss/etc/frontend/routes.xml @@ -19,6 +19,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Rss * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ @@ -29,4 +31,4 @@ <module name="Magento_Rss" /> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Rss/etc/module.xml b/app/code/Magento/Rss/etc/module.xml index 72869146b27f36dc9c8f075f4681bb6e10c7ff9b..ec96b30ed73bd5e0b5ab7802da684ba2f3ded4a7 100755 --- a/app/code/Magento/Rss/etc/module.xml +++ b/app/code/Magento/Rss/etc/module.xml @@ -19,6 +19,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Rss * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Rule/Block/Editable.php b/app/code/Magento/Rule/Block/Editable.php index 4dbe1321a0c86090a11b66440202ca525dcfb562..31a84265bdbd9c84f1ca338a30086fcf18a5b7bb 100644 --- a/app/code/Magento/Rule/Block/Editable.php +++ b/app/code/Magento/Rule/Block/Editable.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Rule\Block; class Editable @@ -36,29 +35,29 @@ class Editable * * @var \Magento\Core\Helper\Data */ - protected $_coreData = null; + protected $_coreData; /** - * Core string + * Filter manager * - * @var \Magento\Core\Helper\String + * @var \Magento\Filter\FilterManager */ - protected $_coreString = null; + protected $filter; /** - * @param \Magento\Core\Helper\String $coreString * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Block\Context $context + * @param \Magento\Filter\FilterManager $filter * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Core\Helper\Data $coreData, \Magento\Core\Block\Context $context, + \Magento\Filter\FilterManager $filter, array $data = array() ) { - $this->_coreString = $coreString; $this->_coreData = $coreData; + $this->filter = $filter; parent::__construct($context, $data); } @@ -88,9 +87,9 @@ class Editable . '<a href="javascript:void(0)" class="label">'; if ($this->_translator->isAllowed()) { - $html .= $this->_coreData->escapeHtml($valueName); + $html .= $this->escapeHtml($valueName); } else { - $html .= $this->_coreData->escapeHtml($this->_coreString->truncate($valueName, 33, '...')); + $html .= $this->escapeHtml($this->filter->truncate($valueName, array('length' => 33, 'etc' => '...'))); } $html .= '</a><span class="element"> ' . $element->getElementHtml(); diff --git a/app/code/Magento/Rule/Model/AbstractModel.php b/app/code/Magento/Rule/Model/AbstractModel.php index fc3ac88a0a68d76a233796f7f717887b9ef2aeab..ee4a13dbb46545fba0aad47b3a6e15021b569ed2 100644 --- a/app/code/Magento/Rule/Model/AbstractModel.php +++ b/app/code/Magento/Rule/Model/AbstractModel.php @@ -81,7 +81,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel abstract public function getActionsInstance(); /** - * @var \Magento\Data\Form\Factory + * @var \Magento\Data\FormFactory */ protected $_formFactory; @@ -91,7 +91,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel protected $_locale; /** - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $locale @@ -100,7 +100,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $locale, @@ -346,7 +346,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel if (in_array($key, array('from_date', 'to_date')) && $value) { $value = $this->_locale->date( $value, - \Magento\Date::DATE_INTERNAL_FORMAT, + \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT, null, false ); @@ -388,8 +388,8 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel } if ($fromDate && $toDate) { - $fromDate = new \Zend_Date($fromDate, \Magento\Date::DATE_INTERNAL_FORMAT); - $toDate = new \Zend_Date($toDate, \Magento\Date::DATE_INTERNAL_FORMAT); + $fromDate = new \Zend_Date($fromDate, \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT); + $toDate = new \Zend_Date($toDate, \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT); if ($fromDate->compare($toDate) === 1) { $result[] = __('End Date must follow Start Date.'); diff --git a/app/code/Magento/Rule/Model/Condition/AbstractCondition.php b/app/code/Magento/Rule/Model/Condition/AbstractCondition.php index be07f40687ac0debd5fea96af3c758b6f750c66b..7e36121993a1534f4f8e29029b00a049c98e7cbc 100644 --- a/app/code/Magento/Rule/Model/Condition/AbstractCondition.php +++ b/app/code/Magento/Rule/Model/Condition/AbstractCondition.php @@ -363,7 +363,7 @@ abstract class AbstractCondition // date format intentionally hard-coded $this->setValue( $this->_locale->date($this->getData('value'), - \Magento\Date::DATE_INTERNAL_FORMAT, null, false)->toString(\Magento\Date::DATE_INTERNAL_FORMAT) + \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT, null, false)->toString(\Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT) ); $this->setIsValueParsed(true); } @@ -564,8 +564,8 @@ abstract class AbstractCondition ); if ($this->getInputType() == 'date') { // date format intentionally hard-coded - $elementParams['input_format'] = \Magento\Date::DATE_INTERNAL_FORMAT; - $elementParams['date_format'] = \Magento\Date::DATE_INTERNAL_FORMAT; + $elementParams['input_format'] = \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT; + $elementParams['date_format'] = \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT; } return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() . '__value', $this->getValueElementType(), diff --git a/app/code/Magento/Rule/Model/Condition/Combine.php b/app/code/Magento/Rule/Model/Condition/Combine.php index dd62340571ae29fda7f43dab92297e8e57198b3a..32ec82ed150f981e81e8e4265fb61efaa658120b 100644 --- a/app/code/Magento/Rule/Model/Condition/Combine.php +++ b/app/code/Magento/Rule/Model/Condition/Combine.php @@ -42,7 +42,7 @@ class Combine extends \Magento\Rule\Model\Condition\AbstractCondition protected $_conditionFactory; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; diff --git a/app/code/Magento/Rule/Model/Condition/Context.php b/app/code/Magento/Rule/Model/Condition/Context.php index 4413e8d3ef5116de4d34e52b0b5c1fd9f86b5205..0e7f37f036281efa6f0a49a3706afafef9301175 100644 --- a/app/code/Magento/Rule/Model/Condition/Context.php +++ b/app/code/Magento/Rule/Model/Condition/Context.php @@ -51,7 +51,7 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_conditionFactory; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -60,14 +60,14 @@ class Context implements \Magento\ObjectManager\ContextInterface * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\View\LayoutInterface $layout * @param \Magento\Rule\Model\ConditionFactory $conditionFactory - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function __construct( \Magento\Core\Model\View\Url $viewUrl, \Magento\Core\Model\LocaleInterface $locale, \Magento\View\LayoutInterface $layout, \Magento\Rule\Model\ConditionFactory $conditionFactory, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { $this->_viewUrl = $viewUrl; $this->_locale = $locale; @@ -109,7 +109,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\Logger + * @return \Magento\Logger */ public function getLogger() { diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php index 16943800eadfe688bfc060759cae03b5c7f51b91..2144586eb27c262a091cd9bde03b7acfb032edb4 100644 --- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php +++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php @@ -423,7 +423,7 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon switch ($this->getAttribute()) { case 'sku': case 'category_ids': - $url = 'adminhtml/promo_widget/chooser/attribute/' . $this->getAttribute(); + $url = '*/promo_widget/chooser/attribute/' . $this->getAttribute(); if ($this->getJsFormObject()) { $url .= '/form/' . $this->getJsFormObject(); } diff --git a/app/code/Magento/Rule/Model/Resource/AbstractResource.php b/app/code/Magento/Rule/Model/Resource/AbstractResource.php index 133b5c7dc1f8d71d5b9c9ff8dab712ba7abeffc3..8dc446d4de5ae6de8a33e6bb917de9e5bf1e2f0a 100644 --- a/app/code/Magento/Rule/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Rule/Model/Resource/AbstractResource.php @@ -68,14 +68,14 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract { $fromDate = $object->getFromDate(); if ($fromDate instanceof \Zend_Date) { - $object->setFromDate($fromDate->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT)); + $object->setFromDate($fromDate->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)); } elseif (!is_string($fromDate) || empty($fromDate)) { $object->setFromDate(null); } $toDate = $object->getToDate(); if ($toDate instanceof \Zend_Date) { - $object->setToDate($toDate->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT)); + $object->setToDate($toDate->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)); } elseif (!is_string($toDate) || empty($toDate)) { $object->setToDate(null); } diff --git a/app/code/Magento/Rule/Model/Rule.php b/app/code/Magento/Rule/Model/Rule.php index e5911776baa86e95499b9de9e45db37162a89292..b45da837cb5e68d1c7efa070522fc91a00b5dda9 100644 --- a/app/code/Magento/Rule/Model/Rule.php +++ b/app/code/Magento/Rule/Model/Rule.php @@ -48,7 +48,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel protected $_actions; /** - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $locale @@ -59,7 +59,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $locale, diff --git a/app/code/Magento/Adminhtml/view/adminhtml/promo/rules.js b/app/code/Magento/Rule/view/adminhtml/rules.js similarity index 99% rename from app/code/Magento/Adminhtml/view/adminhtml/promo/rules.js rename to app/code/Magento/Rule/view/adminhtml/rules.js index d7bbcbefd294f165cc7a2c569ed0e792cb7d6195..f3ca673e39247afbe0d9d5644871de029b0d85ff 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/promo/rules.js +++ b/app/code/Magento/Rule/view/adminhtml/rules.js @@ -18,7 +18,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Magento_Adminhtml + * @package Magento_Rule * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php index 7638bd3efa615648d37e366fe83d3290baa232eb..bfab978fab17d36eb1b7dd21ef1ad33592f2d5ce 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php @@ -130,7 +130,7 @@ class Info extends \Magento\Backend\Block\Template $this->setReferenceId($agreement->getReferenceId()); $customer = $this->_customerFactory->create()->load($agreement->getCustomerId()); $this->setCustomerUrl( - $this->getUrl('adminhtml/customer/edit', array('id' => $customer->getId())) + $this->getUrl('customer/index/edit', array('id' => $customer->getId())) ); $this->setCustomerEmail($customer->getEmail()); $this->setStatus($agreement->getStatusLabel()); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Items/Column/Name.php b/app/code/Magento/Sales/Block/Adminhtml/Items/Column/Name.php index 280c401694ed31e92a4527e05b1482367e6bd5ef..1a0c85d96bd47b272f9cbffea06d31c93cf0f9aa 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Items/Column/Name.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Items/Column/Name.php @@ -24,43 +24,58 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Sales\Block\Adminhtml\Items\Column; /** * Sales Order items name column renderer - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Block\Adminhtml\Items\Column; - class Name extends \Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn { /** * Core string * - * @var \Magento\Core\Helper\String + * @var \Magento\Filter\FilterManager */ - protected $_coreString = null; + protected $filter; /** - * @param \Magento\Core\Helper\String $coreString * @param \Magento\Catalog\Model\Product\OptionFactory $optionFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Filter\FilterManager $filter * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Catalog\Model\Product\OptionFactory $optionFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, + \Magento\Filter\FilterManager $filter, array $data = array() ) { - $this->_coreString = $coreString; + $this->filter = $filter; parent::__construct($optionFactory, $coreData, $context, $data); } + /** + * Truncate string + * + * @param string $value + * @param int $length + * @param string $etc + * @param string &$remainder + * @param bool $breakWords + * @return string + */ + public function truncateString($value, $length = 80, $etc = '...', &$remainder = '', $breakWords = true) + { + return $this->filter->truncate($value, array( + 'length' => $length, + 'etc' => $etc, + 'remainder' => $remainder, + 'breakWords' => $breakWords + )); + } + /** * Add line breaks and truncate value * @@ -69,11 +84,11 @@ class Name extends \Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn */ public function getFormattedOption($value) { - $_remainder = ''; - $value = $this->_coreString->truncate($value, 55, '', $_remainder); + $remainder = ''; + $value = $this->truncateString($value, 55, '', $remainder); $result = array( 'value' => nl2br($value), - 'remainder' => nl2br($_remainder) + 'remainder' => nl2br($remainder) ); return $result; diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php index 8b3838ba2411ed66132fa68ce487c824767d9ff7..fc9c515019602ce3e4bd9dcabf76fbbc511e15a8 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Address/Form.php @@ -49,7 +49,7 @@ class Form * @param \Magento\Customer\Model\AddressFactory $addressFactory * @param \Magento\Customer\Model\FormFactory $customerFormFactory * @param \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Core\Helper\Data $coreData @@ -63,7 +63,7 @@ class Form \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Customer\Model\FormFactory $customerFormFactory, \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Adminhtml\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Core\Helper\Data $coreData, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php index fc4149e0ce221c03c5c0abea3c301b2656e1b7e0..826fe3f5870cfb666a452fcbc31f6a54547b9338 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php @@ -38,7 +38,7 @@ abstract class AbstractForm extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate { /** - * @var \Magento\Data\Form\Factory + * @var \Magento\Data\FormFactory */ protected $_formFactory; @@ -50,7 +50,7 @@ abstract class AbstractForm protected $_form; /** - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Core\Helper\Data $coreData @@ -58,7 +58,7 @@ abstract class AbstractForm * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Adminhtml\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Core\Helper\Data $coreData, @@ -130,9 +130,9 @@ abstract class AbstractForm protected function _getAdditionalFormElementTypes() { return array( - 'file' => 'Magento\Adminhtml\Block\Customer\Form\Element\File', - 'image' => 'Magento\Adminhtml\Block\Customer\Form\Element\Image', - 'boolean' => 'Magento\Adminhtml\Block\Customer\Form\Element\Boolean', + 'file' => 'Magento\Customer\Block\Adminhtml\Form\Element\File', + 'image' => 'Magento\Customer\Block\Adminhtml\Form\Element\Image', + 'boolean' => 'Magento\Customer\Block\Adminhtml\Form\Element\Boolean', ); } @@ -144,7 +144,7 @@ abstract class AbstractForm protected function _getAdditionalFormElementRenderers() { return array( - 'region' => $this->getLayout()->createBlock('Magento\Adminhtml\Block\Customer\Edit\Renderer\Region'), + 'region' => $this->getLayout()->createBlock('Magento\Customer\Block\Adminhtml\Edit\Renderer\Region'), ); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php index 253b286b7227e795b049e9b8d953b7d38f124432..7d1f082a730bae9a3211df7a96284877ff10be34 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php @@ -46,7 +46,7 @@ class Account extends \Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractF /** * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Customer\Model\FormFactory $customerFormFactory - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Core\Helper\Data $coreData @@ -56,7 +56,7 @@ class Account extends \Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractF public function __construct( \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Customer\Model\FormFactory $customerFormFactory, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Adminhtml\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Core\Helper\Data $coreData, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php index 70b06cb9662b66b8937a967cc5e4cb63f9eb6d1c..d266e9182040e5d392cf547c33e54a8d4274578a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php @@ -64,7 +64,7 @@ class Address * @param \Magento\Customer\Model\AddressFactory $addressFactory * @param \Magento\Customer\Model\FormFactory $customerFormFactory * @param \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote * @param \Magento\Sales\Model\AdminOrder\Create $orderCreate * @param \Magento\Core\Helper\Data $coreData @@ -75,7 +75,7 @@ class Address \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Customer\Model\FormFactory $customerFormFactory, \Magento\Adminhtml\Helper\Addresses $adminhtmlAddresses, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Adminhtml\Model\Session\Quote $sessionQuote, \Magento\Sales\Model\AdminOrder\Create $orderCreate, \Magento\Core\Helper\Data $coreData, @@ -234,7 +234,7 @@ class Address if ($vatIdElement && $this->getDisplayVatValidationButton() !== false) { $vatIdElement->setRenderer( $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Customer\Sales\Order\Address\Form\Renderer\Vat') + ->createBlock('Magento\Customer\Block\Adminhtml\Sales\Order\Address\Form\Renderer\Vat') ->setJsVariablePrefix($this->getJsVariablePrefix()) ); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php index 2841261a3f0da448da217b34c5b6cf5910411e21..0ce354e5cfa24dc4b131f295a5ecae1ae3e85831 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php @@ -61,7 +61,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -69,7 +69,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic public function __construct( \Magento\Adminhtml\Model\Session\Quote $sessionQuote, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php index 84444706e47cccce32dc162f0f632857fd4d42f5..9b3b72e27fc4e29935b5f59fe8b211cf5834aba5 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php @@ -100,7 +100,7 @@ class Totals extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate $blockName = $code.'_total_renderer'; $block = $this->getLayout()->getBlock($blockName); if (!$block) { - $configRenderer = $this->_salesConfig->getTotalsRenderer('quote', 'totals', $code, 'adminhtml'); + $configRenderer = $this->_salesConfig->getTotalsRenderer('quote', 'totals', $code); if (empty($configRenderer)) { $block = $this->_defaultRenderer; } else { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php index c806582f6a116581de2abd796425c4ef2d14dbac..6f2cf6d67896527a62763de5e51c98f0ec84244c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php @@ -45,7 +45,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Sales\Model\Order\Config $orderConfig * @param \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $collectionFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -54,7 +54,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $collectionFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php index d1562b4f729ab8c83f9725942d617888ee50eb22..94fa4523465e55a473890c5ec7114059a3323b25 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php @@ -46,7 +46,7 @@ class Tax extends \Magento\Tax\Block\Sales\Order\Tax protected $_taxCalculation; /** - * @var \Magento\Tax\Model\Sales\Order\Tax\Factory + * @var \Magento\Tax\Model\Sales\Order\TaxFactory */ protected $_taxOrderFactory; @@ -61,7 +61,7 @@ class Tax extends \Magento\Tax\Block\Sales\Order\Tax * @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Tax\Helper\Data $taxHelper * @param \Magento\Tax\Model\Calculation $taxCalculation - * @param \Magento\Tax\Model\Sales\Order\Tax\Factory $taxOrderFactory + * @param \Magento\Tax\Model\Sales\Order\TaxFactory $taxOrderFactory * @param array $data */ public function __construct( @@ -70,7 +70,7 @@ class Tax extends \Magento\Tax\Block\Sales\Order\Tax \Magento\Tax\Model\Config $taxConfig, \Magento\Tax\Helper\Data $taxHelper, \Magento\Tax\Model\Calculation $taxCalculation, - \Magento\Tax\Model\Sales\Order\Tax\Factory $taxOrderFactory, + \Magento\Tax\Model\Sales\Order\TaxFactory $taxOrderFactory, array $data = array() ) { $this->_taxHelper = $taxHelper; diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php index 4a865a7f871c4f860835db7f5f937e20e8da2c9d..38a023d3cc97b426d8a6cee071ef0053de99da6f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php @@ -134,7 +134,7 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder if ($this->getOrder()->getCustomerIsGuest() || !$this->getOrder()->getCustomerId()) { return false; } - return $this->getUrl('adminhtml/customer/edit', array('id' => $this->getOrder()->getCustomerId())); + return $this->getUrl('customer/index/edit', array('id' => $this->getOrder()->getCustomerId())); } public function getViewUrl($orderId) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php index 450f3aafecd95fd3c0237d710e5b0e19b4d7595f..e5aee0c6bd607d9d20c32b6a36f0dedd2e9b10a2 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php @@ -59,7 +59,7 @@ class Form extends \Magento\Backend\Block\AbstractBlock protected $_product = null; /** - * @var \Magento\Data\Form\Factory + * @var \Magento\Data\FormFactory */ protected $_formFactory; @@ -69,13 +69,13 @@ class Form extends \Magento\Backend\Block\AbstractBlock protected $_recurringProfile; /** - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Backend\Block\Context $context * @param \Magento\Sales\Model\Recurring\Profile $recurringProfile * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Backend\Block\Context $context, \Magento\Sales\Model\Recurring\Profile $recurringProfile, array $data = array() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php index e64237935548fa35ee13994ad0848bf8fbb5a76f..e74f37b9cc71f3fd05cc4ff5dbfbe214ae3df250 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form.php @@ -42,7 +42,7 @@ class Form extends \Magento\Adminhtml\Block\Report\Filter\Form /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Sales\Model\Order\ConfigFactory $orderConfig @@ -50,7 +50,7 @@ class Form extends \Magento\Adminhtml\Block\Report\Filter\Form */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Sales\Model\Order\ConfigFactory $orderConfig, diff --git a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php index f2cffa17bb66bf9f4addda7c9b77db3e802e8901..d9cffa1ab27295a3d1e1aa179680b09cde1e728a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php @@ -49,7 +49,7 @@ class Coupon extends \Magento\Sales\Block\Adminhtml\Report\Filter\Form /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Sales\Model\Order\ConfigFactory $orderConfig @@ -58,7 +58,7 @@ class Coupon extends \Magento\Sales\Block\Adminhtml\Report\Filter\Form */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Sales\Model\Order\ConfigFactory $orderConfig, diff --git a/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php b/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php index 775782b7931f941c99195a1a7a15c905c048cda3..6b44b07343ce049b0d0c2870edb5d20a5335295e 100644 --- a/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php @@ -24,23 +24,26 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Sales\Block\Order\Item\Renderer; + /** * Order item render block - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Block\Order\Item\Renderer; - class DefaultRenderer extends \Magento\Core\Block\Template { /** - * Core string + * Filter manager + * + * @var \Magento\Filter\FilterManager + */ + protected $filter; + + /** + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * @var \Magento\Catalog\Model\Product\OptionFactory @@ -48,21 +51,25 @@ class DefaultRenderer extends \Magento\Core\Block\Template protected $_productOptionFactory; /** - * @param \Magento\Core\Helper\String $coreString * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Block\Template\Context $context + * @param \Magento\Stdlib\String $string * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory + * @param \Magento\Filter\FilterManager $filter + * @param \Magento\Stdlib\String $string * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Core\Helper\Data $coreData, \Magento\Core\Block\Template\Context $context, + \Magento\Stdlib\String $string, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, + \Magento\Filter\FilterManager $filter, array $data = array() ) { - $this->_coreString = $coreString; + $this->string = $string; $this->_productOptionFactory = $productOptionFactory; + $this->filter = $filter; parent::__construct($coreData, $context, $data); } @@ -168,17 +175,17 @@ class DefaultRenderer extends \Magento\Core\Block\Template // truncate standard view $result = array(); if (is_array($optionValue)) { - $_truncatedValue = implode("\n", $optionValue); - $_truncatedValue = nl2br($_truncatedValue); - return array('value' => $_truncatedValue); + $truncatedValue = implode("\n", $optionValue); + $truncatedValue = nl2br($truncatedValue); + return array('value' => $truncatedValue); } else { - $_truncatedValue = $this->_coreString->truncate($optionValue, 55, ''); - $_truncatedValue = nl2br($_truncatedValue); + $truncatedValue = $this->filter->truncate($optionValue, array('length' => 55, 'etc' => '')); + $truncatedValue = nl2br($truncatedValue); } - $result = array('value' => $_truncatedValue); + $result = array('value' => $truncatedValue); - if ($this->_coreString->strlen($optionValue) > 55) { + if ($this->string->strlen($optionValue) > 55) { $result['value'] = $result['value'] . ' <a href="#" class="dots" onclick="return false">...</a>'; $optionValue = nl2br($optionValue); $result = array_merge($result, array('full_view' => $optionValue)); @@ -206,4 +213,15 @@ class DefaultRenderer extends \Magento\Core\Block\Template { return $this->getLayout()->getBlock('additional.product.info'); } + + /** + * Prepare SKU + * + * @param string $sku + * @return string + */ + public function prepareSku($sku) + { + return $this->escapeHtml($this->string->splitInjection($sku)); + } } diff --git a/app/code/Magento/Sales/Block/Order/Link.php b/app/code/Magento/Sales/Block/Order/Link.php index 915285b2e5c1b6e832c4fbfbd4643bcdaed78915..705d747215522cb3993ebe1261615eff7f00fad5 100644 --- a/app/code/Magento/Sales/Block/Order/Link.php +++ b/app/code/Magento/Sales/Block/Order/Link.php @@ -36,15 +36,17 @@ class Link extends \Magento\Page\Block\Link\Current * @param \Magento\Core\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\App\DefaultPathInterface $defaultPath * @param array $data */ public function __construct( \Magento\Core\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Helper\Data $coreData, + \Magento\App\DefaultPathInterface $defaultPath, array $data = array() ) { - parent::__construct($coreData, $context, $data); + parent::__construct($coreData, $context, $defaultPath, $data); $this->_registry = $registry; } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Billing/Agreement.php b/app/code/Magento/Sales/Controller/Adminhtml/Billing/Agreement.php index b2d82c9ec4d829af6dc1bf6e81f00e0f3acf762e..2c23216d1be9f08d9373fd47b7c1bec0875d2fc9 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Billing/Agreement.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Billing/Agreement.php @@ -135,7 +135,7 @@ class Agreement extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We could not cancel the billing agreement.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/*/view', array('_current' => true)); } @@ -159,7 +159,7 @@ class Agreement extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We could not delete the billing agreement.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/*/view', array('_current' => true)); } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order.php b/app/code/Magento/Sales/Controller/Adminhtml/Order.php index b74815b3d96b403a8f79a2f95b8b80939ade6ce6..bcb3048c40e2105b14ef13128500df9632a9aa29 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order.php @@ -149,7 +149,7 @@ class Order extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We couldn\'t send the email order.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } $this->_redirect('sales/order/view', array('order_id' => $order->getId())); @@ -172,7 +172,7 @@ class Order extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('You have not canceled the item.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/order/view', array('order_id' => $order->getId())); } @@ -258,7 +258,7 @@ class Order extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We couldn\'t update the payment.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/order/view', array('order_id' => $order->getId())); } @@ -669,7 +669,7 @@ class Order extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We couldn\'t void the payment.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/*/view', array('order_id' => $order->getId())); } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php index 9ce5f8e247bbc16d542172d0cf3f5c0773976454..4516a53e762cfc0843d96919bda09182ab2d865d 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php @@ -298,7 +298,8 @@ class Create extends \Magento\Backend\Controller\Adminhtml\Action if (!empty($couponCode)) { if ($this->_getQuote()->getCouponCode() !== $couponCode) { $this->_getSession()->addError( - __('"%1" coupon code is not valid.', $this->_getHelper()->escapeHtml($couponCode))); + __('"%1" coupon code is not valid.', $this->_objectManager->get('Magento\Escaper') + ->escapeHtml($couponCode))); } else { $this->_getSession()->addSuccess(__('The coupon code has been accepted.')); } @@ -446,7 +447,7 @@ class Create extends \Magento\Backend\Controller\Adminhtml\Action $updateResult->setJsVarName($this->getRequest()->getParam('as_js_varname')); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setCompositeProductResult($updateResult); - $this->_redirect('sales/product/showUpdateResult'); + $this->_redirect('catalog/product/showUpdateResult'); } /** diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php index 00af8725cc57912570b32bdc42953138eae49356..1dc4cf18ba4ccf917e85213e07d943e7ea25d4f4 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php @@ -340,7 +340,7 @@ class Creditmemo $this->_getSession()->addError($e->getMessage()); $this->_getSession()->setFormData($data); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__('Cannot save the credit memo.')); } $this->_redirect('sales/*/new', array('_current' => true)); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php index 8400e96948c039c53db750554e0ef92fd405b7eb..05f55d07f0c9569c3523fd86b75f49efaa5ec4a6 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php @@ -311,14 +311,14 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic try { $invoice->sendEmail(!empty($data['send_email']), $comment); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__('We can\'t send the invoice email.')); } if ($shipment) { try { $shipment->sendEmail(!empty($data['send_email'])); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__('We can\'t send the shipment.')); } } @@ -332,7 +332,7 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We can\'t save the invoice.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/*/new', array('order_id' => $orderId)); } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php index 32e23dd8ed2c975f7c638e9057d24c7a77cb6f4c..a63326e3c96435de15805ebbf5ea56c3dd954e4f 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php @@ -259,7 +259,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->_redirect('sales/*/new', array('order_id' => $this->getRequest()->getParam('order_id'))); } } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); if ($isNeedCreateLabel) { $responseAjax->setError(true); $responseAjax->setMessage( @@ -539,7 +539,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $response->setError(true); $response->setMessage($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $response->setError(true); $response->setMessage(__('An error occurred while creating shipping label.')); } @@ -581,7 +581,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession() ->addError(__('An error occurred while creating shipping label.')); } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php index ab0420d0c7c6907e69ba9d0f74c0be401158a979..3cc88cfed64809d0cbdb405dc8c5e6819e0545ee 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php @@ -128,14 +128,14 @@ class Status extends \Magento\Backend\Controller\Adminhtml\Action $statusCode = $this->getRequest()->getParam('status'); //filter tags in labels/status - /** @var $helper \Magento\Adminhtml\Helper\Data */ - $helper = $this->_objectManager->get('Magento\Adminhtml\Helper\Data'); + /** @var $filterManager \Magento\Filter\FilterManager */ + $filterManager = $this->_objectManager->get('Magento\Filter\FilterManager'); if ($isNew) { - $statusCode = $data['status'] = $helper->stripTags($data['status']); + $statusCode = $data['status'] = $filterManager->stripTags($data['status']); } - $data['label'] = $helper->stripTags($data['label']); + $data['label'] = $filterManager->stripTags($data['label']); foreach ($data['store_labels'] as &$label) { - $label = $helper->stripTags($label); + $label = $filterManager->stripTags($label); } $status = $this->_objectManager->create('Magento\Sales\Model\Order\Status') diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Recurring/Profile.php b/app/code/Magento/Sales/Controller/Adminhtml/Recurring/Profile.php index fa37b0ad3c4045f2aabf15e9a348cb9701c0aa0c..94e36507b9562669acfee84897f20fa5ebc370a2 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Recurring/Profile.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Recurring/Profile.php @@ -80,7 +80,7 @@ class Profile extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/*/'); } @@ -96,7 +96,7 @@ class Profile extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/*/'); } @@ -110,7 +110,7 @@ class Profile extends \Magento\Backend\Controller\Adminhtml\Action $this->_initProfile(); $this->loadLayout()->renderLayout(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->norouteAction(); } } @@ -140,7 +140,7 @@ class Profile extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We could not update the profile.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } if ($profile) { $this->_redirect('sales/*/view', array('profile' => $profile->getId())); @@ -168,7 +168,7 @@ class Profile extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError(__('We could not update the profile.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } if ($profile) { $this->_redirect('sales/*/view', array('profile' => $profile->getId())); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php b/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php index 7f8d80ac1fe1f57278c3373b15e65626eae9a768..d0447eb1fb82b1bd7b2374beada2070524af8db7 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php @@ -138,7 +138,7 @@ class Transactions extends \Magento\Backend\Controller\Adminhtml\Action $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( __('We can\'t update the transaction details.') ); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('sales/transactions/view', array('_current' => true)); } diff --git a/app/code/Magento/Sales/Controller/Billing/Agreement.php b/app/code/Magento/Sales/Controller/Billing/Agreement.php index 2e8de062a767777aef9a7ab1507044b5db1ac2aa..050f959ceb7757bed7c3838371f5c38f92c65ad7 100644 --- a/app/code/Magento/Sales/Controller/Billing/Agreement.php +++ b/app/code/Magento/Sales/Controller/Billing/Agreement.php @@ -121,7 +121,7 @@ class Agreement extends \Magento\Core\Controller\Front\Action } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__('We couldn\'t start the billing agreement wizard.')); } } @@ -153,7 +153,7 @@ class Agreement extends \Magento\Core\Controller\Front\Action } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__('We couldn\'t finish the billing agreement wizard.')); } $this->_redirect('*/*/index'); @@ -186,7 +186,7 @@ class Agreement extends \Magento\Core\Controller\Front\Action } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession()->addError(__('We couldn\'t cancel the billing agreement.')); } } diff --git a/app/code/Magento/Sales/Controller/Recurring/Profile.php b/app/code/Magento/Sales/Controller/Recurring/Profile.php index b3ecbfd6753c95e84e532eeba7c701d87cc65449..74cff74a97e4fad42af070155e57039a0dc14c49 100644 --- a/app/code/Magento/Sales/Controller/Recurring/Profile.php +++ b/app/code/Magento/Sales/Controller/Recurring/Profile.php @@ -118,7 +118,7 @@ class Profile extends \Magento\Core\Controller\Front\Action $this->_session->addError($e->getMessage()); } catch (\Exception $e) { $this->_session->addError(__('We couldn\'t update the profile.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } if ($profile) { $this->_redirect('*/*/view', array('profile' => $profile->getId())); @@ -146,7 +146,7 @@ class Profile extends \Magento\Core\Controller\Front\Action $this->_session->addError($e->getMessage()); } catch (\Exception $e) { $this->_session->addError(__('We couldn\'t update the profile.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } if ($profile) { $this->_redirect('*/*/view', array('profile' => $profile->getId())); @@ -174,7 +174,7 @@ class Profile extends \Magento\Core\Controller\Front\Action } catch (\Magento\Core\Exception $e) { $this->_session->addError($e->getMessage()); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('*/*/'); } diff --git a/app/code/Magento/Sales/Helper/Guest.php b/app/code/Magento/Sales/Helper/Guest.php index 7a704edae4b21f7bc6492fb1b25b5ff0618f0bf6..900a724e08c42cf54729e2c5db90b6676803e1b5 100644 --- a/app/code/Magento/Sales/Helper/Guest.php +++ b/app/code/Magento/Sales/Helper/Guest.php @@ -23,12 +23,11 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Sales\Helper; /** * Sales module base helper */ -namespace Magento\Sales\Helper; - class Guest extends \Magento\Core\Helper\Data { /** @@ -81,14 +80,11 @@ class Guest extends \Magento\Core\Helper\Data /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Core\Model\Cookie $coreCookie @@ -100,14 +96,11 @@ class Guest extends \Magento\Core\Helper\Data public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, \Magento\Core\Model\Registry $coreRegistry, \Magento\Customer\Model\Session $customerSession, \Magento\Core\Model\Cookie $coreCookie, @@ -115,16 +108,22 @@ class Guest extends \Magento\Core\Helper\Data \Magento\Core\Model\Session $coreSession, \Magento\Sales\Model\OrderFactory $orderFactory, $dbCompatibleMode = true - ) - { + ) { $this->_coreRegistry = $coreRegistry; $this->_customerSession = $customerSession; $this->_coreCookie = $coreCookie; $this->_coreApp = $coreApp; $this->_coreSession = $coreSession; $this->_orderFactory = $orderFactory; - parent::__construct($context, $eventManager, $coreHttp, $config, $coreStoreConfig, $storeManager, - $locale, $dateModel, $appState, $encryptor, $dbCompatibleMode + parent::__construct( + $context, + $eventManager, + $coreStoreConfig, + $storeManager, + $locale, + $dateModel, + $appState, + $dbCompatibleMode ); } @@ -149,7 +148,7 @@ class Guest extends \Magento\Core\Helper\Data if (empty($post) && !$this->_coreCookie->get($this->_cookieName)) { $this->_coreApp->getResponse()->setRedirect($this->_urlBuilder->getUrl('sales/guest/form')); return false; - } elseif (!empty($post) && isset($post['oar_order_id']) && isset($post['oar_type'])) { + } elseif (!empty($post) && isset($post['oar_order_id']) && isset($post['oar_type'])) { $type = $post['oar_type']; $incrementId = $post['oar_order_id']; $lastName = $post['oar_billing_lastname']; diff --git a/app/code/Magento/Sales/Helper/Reorder.php b/app/code/Magento/Sales/Helper/Reorder.php index a8938a8a668e8b77f05c5b4150f502f316a84b90..3a43e6854407350bde4bc3e04dbf74db54f4f93f 100644 --- a/app/code/Magento/Sales/Helper/Reorder.php +++ b/app/code/Magento/Sales/Helper/Reorder.php @@ -41,35 +41,35 @@ class Reorder extends \Magento\Core\Helper\Data /** * @param \Magento\Core\Helper\Context $context * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Http $coreHttp - * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\Core\Model\Date $dateModel * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Encryption $encryptor * @param \Magento\Customer\Model\Session $customerSession * @param bool $dbCompatibleMode */ public function __construct( \Magento\Core\Helper\Context $context, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Http $coreHttp, - \Magento\Core\Model\Config $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Locale $locale, \Magento\Core\Model\Date $dateModel, \Magento\App\State $appState, - \Magento\Core\Model\Encryption $encryptor, \Magento\Customer\Model\Session $customerSession, $dbCompatibleMode = true - ) - { + ) { $this->_customerSession = $customerSession; - parent::__construct($context, $eventManager, $coreHttp, $config, $coreStoreConfig, $storeManager, - $locale, $dateModel, $appState, $encryptor, $dbCompatibleMode + parent::__construct( + $context, + $eventManager, + $coreStoreConfig, + $storeManager, + $locale, + $dateModel, + $appState, + $dbCompatibleMode ); } diff --git a/app/code/Magento/Sales/Model/AbstractModel.php b/app/code/Magento/Sales/Model/AbstractModel.php index 1dbf87136eb43c693df18ac119840f1d0b6230b7..84c3806bb0a672b77d94cc2378fc88de72797d75 100644 --- a/app/code/Magento/Sales/Model/AbstractModel.php +++ b/app/code/Magento/Sales/Model/AbstractModel.php @@ -37,10 +37,16 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel */ protected $_coreLocale; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $coreLocale + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -49,15 +55,16 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() - ) - { + ) { parent::__construct( $context, $registry, $resource, $resourceCollection, $data ); $this->_coreLocale = $coreLocale; + $this->dateTime = $dateTime; } /** @@ -89,7 +96,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel public function getCreatedAtDate() { return $this->_coreLocale->date( - \Magento\Date::toTimestamp($this->getCreatedAt()), + $this->dateTime->toTimestamp($this->getCreatedAt()), null, null, true @@ -105,7 +112,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel { return $this->_coreLocale->storeDate( $this->getStore(), - \Magento\Date::toTimestamp($this->getCreatedAt()), + $this->dateTime->toTimestamp($this->getCreatedAt()), true ); } diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index c27aac7a249c74f4bde66a3c3d7dc3729124746e..6131f9f04469c0621e5e8975dcf99124b2a62b21 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -135,7 +135,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car protected $_coreData = null; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -163,7 +163,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Adminhtml\Model\Session\Quote $sessionQuote - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param array $data */ public function __construct( @@ -173,7 +173,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car \Magento\Core\Model\Registry $coreRegistry, \Magento\Sales\Model\Config $salesConfig, \Magento\Adminhtml\Model\Session\Quote $sessionQuote, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, array $data = array() ) { $this->_objectManager = $objectManager; diff --git a/app/code/Magento/Sales/Model/Config.php b/app/code/Magento/Sales/Model/Config.php index 5e2ca79b6402f4e060eb9e25e4ada9d534f0481a..1473264b1fbb6734381176b4f8e8d50f90c294ab 100644 --- a/app/code/Magento/Sales/Model/Config.php +++ b/app/code/Magento/Sales/Model/Config.php @@ -38,12 +38,21 @@ class Config implements \Magento\Sales\Model\ConfigInterface */ protected $_dataContainer; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * @param \Magento\Sales\Model\Config\Data $dataContainer + * @param \Magento\App\State $appState */ - public function __construct(\Magento\Sales\Model\Config\Data $dataContainer) - { + public function __construct( + \Magento\Sales\Model\Config\Data $dataContainer, + \Magento\App\State $appState + ) { $this->_dataContainer = $dataContainer; + $this->_appState = $appState; } /** @@ -52,12 +61,11 @@ class Config implements \Magento\Sales\Model\ConfigInterface * @param string $section * @param string $group * @param string $code - * @param string $area * @return array */ - public function getTotalsRenderer($section, $group, $code, $area) + public function getTotalsRenderer($section, $group, $code) { - $path = implode('/', array($section, $group, $code, 'renderers', $area)); + $path = implode('/', array($section, $group, $code, 'renderers', $this->_appState->getAreaCode())); return $this->_dataContainer->get($path); } diff --git a/app/code/Magento/Sales/Model/Config/Ordered.php b/app/code/Magento/Sales/Model/Config/Ordered.php index 40e0517c8863aa1213c689466b3fd8029719521c..749293f3d3b7d44b99f4296a4010dfd52df26691 100644 --- a/app/code/Magento/Sales/Model/Config/Ordered.php +++ b/app/code/Magento/Sales/Model/Config/Ordered.php @@ -83,7 +83,7 @@ abstract class Ordered extends \Magento\Core\Model\Config\Base protected $_configCacheType; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -94,13 +94,13 @@ abstract class Ordered extends \Magento\Core\Model\Config\Base /** * @param \Magento\Core\Model\Cache\Type\Config $configCacheType - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Simplexml\Element $sourceData */ public function __construct( \Magento\Core\Model\Cache\Type\Config $configCacheType, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Sales\Model\Config $salesConfig, $sourceData = null ) { diff --git a/app/code/Magento/Sales/Model/Config/SchemaLocator.php b/app/code/Magento/Sales/Model/Config/SchemaLocator.php index 58dee4f9ffe7cde6522e4b6df94f42038c5d5480..d128faa68d080005f50eb600c17616a9396e8022 100644 --- a/app/code/Magento/Sales/Model/Config/SchemaLocator.php +++ b/app/code/Magento/Sales/Model/Config/SchemaLocator.php @@ -46,9 +46,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Sales') . '/' . 'sales.xsd'; } diff --git a/app/code/Magento/Sales/Model/ConfigInterface.php b/app/code/Magento/Sales/Model/ConfigInterface.php index d18dae87eff7c3146dd658ad20c3e682014e69cf..4253a95c943637ef1572147b83f32b10f6f48541 100644 --- a/app/code/Magento/Sales/Model/ConfigInterface.php +++ b/app/code/Magento/Sales/Model/ConfigInterface.php @@ -34,10 +34,9 @@ interface ConfigInterface * @param string $section * @param string $group * @param string $code - * @param string $area * @return array */ - public function getTotalsRenderer($section, $group, $code, $area); + public function getTotalsRenderer($section, $group, $code); /** * Retrieve totals for group diff --git a/app/code/Magento/Sales/Model/Observer.php b/app/code/Magento/Sales/Model/Observer.php index ce1f6fa184b5eb3b07d77ea63f3f9e51fa050fd3..884563bf248eaba38cc65acc2dd00feef0679eb7 100644 --- a/app/code/Magento/Sales/Model/Observer.php +++ b/app/code/Magento/Sales/Model/Observer.php @@ -50,33 +50,26 @@ class Observer * * @var \Magento\Customer\Helper\Address */ - protected $_customerAddress = null; + protected $_customerAddress; /** * Customer data * * @var \Magento\Customer\Helper\Data */ - protected $_customerData = null; - - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; + protected $_customerData; /** * Core event manager proxy * * @var \Magento\Event\ManagerInterface */ - protected $_eventManager = null; + protected $_eventManager; /** - * @var \Magento\Core\Model\Config + * @var \Magento\Core\Model\Store\Config */ - protected $_coreConfig; + protected $_storeConfig; /** * @var \Magento\Sales\Model\Resource\Quote\CollectionFactory @@ -95,32 +88,29 @@ class Observer /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Customer\Helper\Data $customerData * @param \Magento\Customer\Helper\Address $customerAddress * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Core\Model\Config $coreConfig + * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\Sales\Model\Resource\Quote\CollectionFactory $quoteFactory * @param \Magento\Core\Model\LocaleInterface $coreLocale * @param \Magento\Sales\Model\ResourceFactory $resourceFactory */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Data $coreData, \Magento\Customer\Helper\Data $customerData, \Magento\Customer\Helper\Address $customerAddress, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\Config $coreConfig, + \Magento\Core\Model\Store\Config $storeConfig, \Magento\Sales\Model\Resource\Quote\CollectionFactory $quoteFactory, \Magento\Core\Model\LocaleInterface $coreLocale, \Magento\Sales\Model\ResourceFactory $resourceFactory ) { $this->_eventManager = $eventManager; - $this->_coreData = $coreData; $this->_customerData = $customerData; $this->_customerAddress = $customerAddress; $this->_catalogData = $catalogData; - $this->_coreConfig = $coreConfig; + $this->_storeConfig = $storeConfig; $this->_quoteCollectionFactory = $quoteFactory; $this->_coreLocale = $coreLocale; $this->_resourceFactory = $resourceFactory; @@ -136,7 +126,7 @@ class Observer { $this->_eventManager->dispatch('clear_expired_quotes_before', array('sales_observer' => $this)); - $lifetimes = $this->_coreConfig->getStoresConfigByPath('checkout/cart/delete_quote_after'); + $lifetimes = $this->_storeConfig->getStoresConfigByPath('checkout/cart/delete_quote_after'); foreach ($lifetimes as $storeId=>$lifetime) { $lifetime *= 86400; @@ -379,14 +369,11 @@ class Observer return; } - /** @var $customerHelper \Magento\Customer\Helper\Data */ - $customerHelper = $this->_customerData; - $customerCountryCode = $quoteAddress->getCountryId(); $customerVatNumber = $quoteAddress->getVatId(); - if (empty($customerVatNumber) || !$this->_coreData->isCountryInEU($customerCountryCode)) { - $groupId = ($customerInstance->getId()) ? $customerHelper->getDefaultCustomerGroupId($storeId) + if (empty($customerVatNumber) || !$this->_customerData->isCountryInEU($customerCountryCode)) { + $groupId = ($customerInstance->getId()) ? $this->_customerData->getDefaultCustomerGroupId($storeId) : \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID; $quoteAddress->setPrevQuoteCustomerGroupId($quoteInstance->getCustomerGroupId()); @@ -396,10 +383,8 @@ class Observer return; } - /** @var $coreHelper \Magento\Core\Helper\Data */ - $coreHelper = $this->_coreData; - $merchantCountryCode = $coreHelper->getMerchantCountryCode(); - $merchantVatNumber = $coreHelper->getMerchantVatNumber(); + $merchantCountryCode = $this->_customerData->getMerchantCountryCode(); + $merchantVatNumber = $this->_customerData->getMerchantVatNumber(); $gatewayResponse = null; if ($addressHelper->getValidateOnEachTransaction($storeId) @@ -407,7 +392,7 @@ class Observer || $customerVatNumber != $quoteAddress->getValidatedVatNumber() ) { // Send request to gateway - $gatewayResponse = $customerHelper->checkVatNumber( + $gatewayResponse = $this->_customerData->checkVatNumber( $customerCountryCode, $customerVatNumber, ($merchantVatNumber !== '') ? $merchantCountryCode : '', @@ -433,7 +418,7 @@ class Observer } // Magento always has to emulate group even if customer uses default billing/shipping address - $groupId = $customerHelper->getCustomerGroupIdBasedOnVatNumber( + $groupId = $this->_customerData->getCustomerGroupIdBasedOnVatNumber( $customerCountryCode, $gatewayResponse, $customerInstance->getStore() ); diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index b16cbce4bf079c6fffdd16ffb541b72949e2c725..cfa2c04f78b3091bd43ffa3f7de7c1d8c7be5752 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -521,6 +521,7 @@ class Order extends \Magento\Sales\Model\AbstractModel * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\LocaleInterface $coreLocale + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\ResourceFactory $resourceFactory * @param \Magento\Sales\Model\Order\Config $orderConfig @@ -551,6 +552,7 @@ class Order extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\Registry $registry, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\ResourceFactory $resourceFactory, \Magento\Sales\Model\Order\Config $orderConfig, @@ -590,7 +592,7 @@ class Order extends \Magento\Sales\Model\AbstractModel $this->_orderHistoryFactory = $orderHistoryFactory; $this->_orderTaxCollFactory = $orderTaxCollFactory; $this->_carrierFactory = $carrierFactory; - parent::__construct($context, $registry, $coreLocale, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index df67a3c6e52835802ff00bd24f7c45a74a69bfa0..91408d289e2630e1ac09f5719cffd594601c9607 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -269,6 +269,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\Registry $registry, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Sales\Model\Order\Creditmemo\Config $creditmemoConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollFactory, @@ -295,7 +296,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel $this->_commentCollFactory = $commentCollFactory; $this->_templateMailerFactory = $templateMailerFactory; $this->_emailInfoFactory = $emailInfoFactory; - parent::__construct($context, $registry, $coreLocale, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php index c5653c25d4c21d7424849b79665feb9cb767ac33..5d5d1c9635d470130f3ea12b4a6fd43bfdd3c345 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php @@ -58,6 +58,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $coreLocale + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -67,13 +68,14 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { parent::__construct( - $context, $registry, $coreLocale, $resource, $resourceCollection, $data + $context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data ); $this->_storeManager = $storeManager; } diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php index f2ec9791457adf458860a3682a942a38d4c454fb..25e21dccd3f95873a784441f53d3ddad99f1855d 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Invoice.php @@ -275,6 +275,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\Registry $registry, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Sales\Model\Order\Invoice\Config $invoiceConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\OrderFactory $orderResourceFactory, @@ -301,7 +302,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel $this->_commentCollFactory = $commentCollFactory; $this->_templateMailerFactory = $templateMailerFactory; $this->_emailInfoFactory = $emailInfoFactory; - parent::__construct($context, $registry, $coreLocale, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php index 28ed7dd53a489b9130028cc3f562c4660e312cec..8d0a9f431b5dbddd5402fdb356169653c322d5f1 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php @@ -58,6 +58,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $coreLocale + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -67,13 +68,14 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { parent::__construct( - $context, $registry, $coreLocale, $resource, $resourceCollection, $data + $context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data ); $this->_storeManager = $storeManager; } diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index e18714a3471dfcffb19bf5ad811a1d17ff83079f..3fc93e3b8fadc374506bf2f4899af2336bdc59d8 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -218,11 +218,11 @@ class Payment extends \Magento\Payment\Model\Info /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Sales\Model\Service\Order $serviceOrderFactory + * @param \Magento\Encryption\EncryptorInterface $encryptor + * @param \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory * @param \Magento\Sales\Model\Order\Payment\TransactionFactory $transactionFactory * @param \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollFactory * @param \Magento\Sales\Model\Billing\AgreementFactory $agreementFactory @@ -233,11 +233,11 @@ class Payment extends \Magento\Payment\Model\Info */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Data $coreData, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\Sales\Model\Service\Order $serviceOrderFactory, + \Magento\Encryption\EncryptorInterface $encryptor, + \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory, \Magento\Sales\Model\Order\Payment\TransactionFactory $transactionFactory, \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollFactory, \Magento\Sales\Model\Billing\AgreementFactory $agreementFactory, @@ -252,7 +252,7 @@ class Payment extends \Magento\Payment\Model\Info $this->_transactionCollFactory = $transactionCollFactory; $this->_agreementFactory = $agreementFactory; $this->_storeManager = $storeManager; - parent::__construct($coreData, $paymentData, $context, $registry, $resource, $resourceCollection, $data); + parent::__construct($paymentData, $context, $registry, $encryptor, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php index 7d458f828dd18f829e0f3fed1d1e3e128fbb55e7..ce738275119a5458b24ad29ecf7dec57aecf062f 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php @@ -77,11 +77,9 @@ abstract class AbstractPdf extends \Magento\Object protected $_paymentData; /** - * Core string - * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString; + protected $string; /** * Core data @@ -130,7 +128,7 @@ abstract class AbstractPdf extends \Magento\Object /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\Translate $translate * @param \Magento\App\Dir $coreDir @@ -145,7 +143,7 @@ abstract class AbstractPdf extends \Magento\Object public function __construct( \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, \Magento\App\Dir $coreDir, @@ -157,7 +155,7 @@ abstract class AbstractPdf extends \Magento\Object ) { $this->_paymentData = $paymentData; $this->_coreData = $coreData; - $this->_coreString = $coreString; + $this->string = $string; $this->_coreStoreConfig = $coreStoreConfig; $this->_translate = $translate; $this->_coreDir = $coreDir; @@ -294,7 +292,7 @@ abstract class AbstractPdf extends \Magento\Object foreach (explode("\n", $this->_coreStoreConfig->getConfig('sales/identity/address', $store)) as $value) { if ($value !== '') { $value = preg_replace('/<br[^>]*>/i', "\n", $value); - foreach ($this->_coreString->strSplit($value, 45, true, true) as $_value) { + foreach ($this->string->split($value, 45, true, true) as $_value) { $page->drawText(trim(strip_tags($_value)), $this->getAlignRight($_value, 130, 440, $font, 10), $top, @@ -316,7 +314,7 @@ abstract class AbstractPdf extends \Magento\Object { $return = array(); foreach (explode('|', $address) as $str) { - foreach ($this->_coreString->strSplit($str, 45, true, true) as $part) { + foreach ($this->string->split($str, 45, true, true) as $part) { if (empty($part)) { continue; } @@ -338,7 +336,7 @@ abstract class AbstractPdf extends \Magento\Object foreach ($address as $value) { if ($value !== '') { $text = array(); - foreach ($this->_coreString->strSplit($value, 55, true, true) as $_value) { + foreach ($this->string->split($value, 55, true, true) as $_value) { $text[] = $_value; } foreach ($text as $part) { @@ -447,7 +445,7 @@ abstract class AbstractPdf extends \Magento\Object foreach ($billingAddress as $value) { if ($value !== '') { $text = array(); - foreach ($this->_coreString->strSplit($value, 45, true, true) as $_value) { + foreach ($this->string->split($value, 45, true, true) as $_value) { $text[] = $_value; } foreach ($text as $part) { @@ -464,7 +462,7 @@ abstract class AbstractPdf extends \Magento\Object foreach ($shippingAddress as $value) { if ($value!=='') { $text = array(); - foreach ($this->_coreString->strSplit($value, 45, true, true) as $_value) { + foreach ($this->string->split($value, 45, true, true) as $_value) { $text[] = $_value; } foreach ($text as $part) { @@ -505,7 +503,7 @@ abstract class AbstractPdf extends \Magento\Object if (trim($value) != '') { //Printing "Payment Method" lines $value = preg_replace('/<br[^>]*>/i', "\n", $value); - foreach ($this->_coreString->strSplit($value, 45, true, true) as $_value) { + foreach ($this->string->split($value, 45, true, true) as $_value) { $page->drawText(strip_tags(trim($_value)), $paymentLeft, $yPayments, 'UTF-8'); $yPayments -= 15; } @@ -525,7 +523,7 @@ abstract class AbstractPdf extends \Magento\Object $methodStartY = $this->y; $this->y -= 15; - foreach ($this->_coreString->strSplit($shippingMethod, 45, true, true) as $_value) { + foreach ($this->string->split($shippingMethod, 45, true, true) as $_value) { $page->drawText(strip_tags(trim($_value)), 285, $this->y, 'UTF-8'); $this->y -= 15; } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Config/SchemaLocator.php b/app/code/Magento/Sales/Model/Order/Pdf/Config/SchemaLocator.php index a4886a8350f2b6b3ecf382f785d25c603c2c6b1b..e9d9b5fe0a94f2a2eae25890a8b1a9f7cb569dd0 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Config/SchemaLocator.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface private $_schemaFile; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $dir = $moduleReader->getModuleDir('etc', 'Magento_Sales'); $this->_schema = $dir . '/pdf.xsd'; diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php index 75544a3f8ba547802f64957dda6afa361a9161c0..e135af8641e0e3a6d7bdfb0cb07e5f403d70f0b0 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php @@ -44,7 +44,7 @@ class Creditmemo extends \Magento\Sales\Model\Order\Pdf\AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\Translate $translate * @param \Magento\App\Dir $coreDir @@ -61,7 +61,7 @@ class Creditmemo extends \Magento\Sales\Model\Order\Pdf\AbstractPdf public function __construct( \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, \Magento\App\Dir $coreDir, @@ -78,7 +78,7 @@ class Creditmemo extends \Magento\Sales\Model\Order\Pdf\AbstractPdf parent::__construct( $paymentData, $coreData, - $coreString, + $string, $coreStoreConfig, $translate, $coreDir, @@ -113,41 +113,41 @@ class Creditmemo extends \Magento\Sales\Model\Order\Pdf\AbstractPdf ); $lines[0][] = array( - 'text' => $this->_coreString->strSplit(__('SKU'), 12, true, true), + 'text' => $this->string->split(__('SKU'), 12, true, true), 'feed' => 255, 'align' => 'right' ); $lines[0][] = array( - 'text' => $this->_coreString->strSplit(__('Total (ex)'), 12, true, true), + 'text' => $this->string->split(__('Total (ex)'), 12, true, true), 'feed' => 330, 'align' => 'right', //'width' => 50, ); $lines[0][] = array( - 'text' => $this->_coreString->strSplit(__('Discount'), 12, true, true), + 'text' => $this->string->split(__('Discount'), 12, true, true), 'feed' => 380, 'align' => 'right', //'width' => 50, ); $lines[0][] = array( - 'text' => $this->_coreString->strSplit(__('Qty'), 12, true, true), + 'text' => $this->string->split(__('Qty'), 12, true, true), 'feed' => 445, 'align' => 'right', //'width' => 30, ); $lines[0][] = array( - 'text' => $this->_coreString->strSplit(__('Tax'), 12, true, true), + 'text' => $this->string->split(__('Tax'), 12, true, true), 'feed' => 495, 'align' => 'right', //'width' => 45, ); $lines[0][] = array( - 'text' => $this->_coreString->strSplit(__('Total (inc)'), 12, true, true), + 'text' => $this->string->split(__('Total (inc)'), 12, true, true), 'feed' => 565, 'align' => 'right' ); diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php index da2b956eeb3c2efc424385b22f76e129ac615ada..79774eb30875dcdefdfd44df6dd5fca530d2dd9b 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php @@ -44,7 +44,7 @@ class Invoice extends \Magento\Sales\Model\Order\Pdf\AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\Translate $translate * @param \Magento\App\Dir $coreDir @@ -61,7 +61,7 @@ class Invoice extends \Magento\Sales\Model\Order\Pdf\AbstractPdf public function __construct( \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, \Magento\App\Dir $coreDir, @@ -78,7 +78,7 @@ class Invoice extends \Magento\Sales\Model\Order\Pdf\AbstractPdf parent::__construct( $paymentData, $coreData, - $coreString, + $string, $coreStoreConfig, $translate, $coreDir, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php index c5d1f7bd8315b6fa20f5dff4a269f8f862fbe675..de69a8580a1877d5c938b2ead0d99dfe90252c48 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php @@ -38,12 +38,12 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte /** * Core string * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -53,7 +53,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, @@ -62,7 +62,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($taxData, $context, $registry, $coreDir, $resource, $resourceCollection, $data); } @@ -79,13 +79,13 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte // draw Product name $lines[0] = array(array( - 'text' => $this->_coreString->strSplit($item->getName(), 35, true, true), + 'text' => $this->string->split($item->getName(), 35, true, true), 'feed' => 35, )); // draw SKU $lines[0][] = array( - 'text' => $this->_coreString->strSplit($this->getSku($item), 17), + 'text' => $this->string->split($this->getSku($item), 17), 'feed' => 255, 'align' => 'right' ); @@ -138,7 +138,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte foreach ($options as $option) { // draw options label $lines[][] = array( - 'text' => $this->_coreString->strSplit(strip_tags($option['label']), 40, true, true), + 'text' => $this->string->split(strip_tags($option['label']), 40, true, true), 'font' => 'italic', 'feed' => 35 ); @@ -146,7 +146,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte // draw options value $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']); $lines[][] = array( - 'text' => $this->_coreString->strSplit($_printValue, 30, true, true), + 'text' => $this->string->split($_printValue, 30, true, true), 'feed' => 40 ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php index 2c24cbce0f500c809c19093b95e38e010280c0aa..b4f36c5d9ae1dd1ca50293d8b6df5a0e62e7c850 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php @@ -36,10 +36,10 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * * @var \Magento\Core\Helper\String */ - protected $_coreString = null; + protected $string; /** - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -49,7 +49,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, @@ -58,7 +58,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($taxData, $context, $registry, $coreDir, $resource, $resourceCollection, $data); } @@ -75,13 +75,13 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems // draw Product name $lines[0] = array(array( - 'text' => $this->_coreString->strSplit($item->getName(), 35, true, true), + 'text' => $this->string->split($item->getName(), 35, true, true), 'feed' => 35, )); // draw SKU $lines[0][] = array( - 'text' => $this->_coreString->strSplit($this->getSku($item), 17), + 'text' => $this->string->split($this->getSku($item), 17), 'feed' => 290, 'align' => 'right' ); @@ -145,7 +145,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems foreach ($options as $option) { // draw options label $lines[][] = array( - 'text' => $this->_coreString->strSplit(strip_tags($option['label']), 40, true, true), + 'text' => $this->string->split(strip_tags($option['label']), 40, true, true), 'font' => 'italic', 'feed' => 35 ); @@ -159,7 +159,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems $values = explode(', ', $_printValue); foreach ($values as $value) { $lines[][] = array( - 'text' => $this->_coreString->strSplit($value, 30, true, true), + 'text' => $this->string->split($value, 30, true, true), 'feed' => 40 ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php index cdd0c19b5f0a4396b20e2508edfa431b664e0ea1..c2d8acc6ab6511973e885a74e1cf0fceb73cfceb 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php @@ -34,12 +34,12 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems /** * Core string * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -49,7 +49,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * @param array $data */ public function __construct( - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, @@ -58,7 +58,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreString = $coreString; + $this->string = $string; parent::__construct($taxData, $context, $registry, $coreDir, $resource, $resourceCollection, $data); } @@ -73,9 +73,9 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems $lines = array(); // draw Product name - $stringHelper = $this->_coreString; + $stringHelper = $this->string; $lines[0] = array(array( - 'text' => $this->_coreString->strSplit($item->getName(), 60, true, true), + 'text' => $this->string->split($item->getName(), 60, true, true), 'feed' => 100, )); @@ -87,7 +87,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems // draw SKU $lines[0][] = array( - 'text' => $this->_coreString->strSplit($this->getSku($item), 25), + 'text' => $this->string->split($this->getSku($item), 25), 'feed' => 565, 'align' => 'right' ); @@ -98,7 +98,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems foreach ($options as $option) { // draw options label $lines[][] = array( - 'text' => $stringHelper->strSplit(strip_tags($option['label']), 70, true, true), + 'text' => $stringHelper->split(strip_tags($option['label']), 70, true, true), 'font' => 'italic', 'feed' => 110 ); @@ -111,7 +111,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems $values = explode(', ', $_printValue); foreach ($values as $value) { $lines[][] = array( - 'text' => $this->_coreString->strSplit($value, 50, true, true), + 'text' => $this->string->split($value, 50, true, true), 'feed' => 115 ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php index 7c2ca422ac64cd7ec6b285de7c6226a9ac9f4631..9096e98fddcdf3ef4cbcc38dc1691eda7f22884e 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php @@ -44,7 +44,7 @@ class Shipment extends \Magento\Sales\Model\Order\Pdf\AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\Translate $translate * @param \Magento\App\Dir $coreDir @@ -61,7 +61,7 @@ class Shipment extends \Magento\Sales\Model\Order\Pdf\AbstractPdf public function __construct( \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, \Magento\App\Dir $coreDir, @@ -78,7 +78,7 @@ class Shipment extends \Magento\Sales\Model\Order\Pdf\AbstractPdf parent::__construct( $paymentData, $coreData, - $coreString, + $string, $coreStoreConfig, $translate, $coreDir, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php index ea890cc263510deca87598ce99259262e99769d3..d82a1daebe57c9dcf68524bbbe3741f3f82a754c 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php @@ -56,7 +56,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\Translate $translate * @param \Magento\App\Dir $coreDir @@ -75,7 +75,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf public function __construct( \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, \Magento\App\Dir $coreDir, @@ -93,7 +93,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $this->_locale = $locale; $this->_storeManager = $storeManager; $this->_layout = $layout; - parent::__construct($paymentData, $coreData, $coreString, $coreStoreConfig, $translate, $coreDir, + parent::__construct($paymentData, $coreData, $string, $coreStoreConfig, $translate, $coreDir, $shippingConfig, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $data); } diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php index 36ef462406c6d4a9d1946fb87c555ab7c1f4d4a1..4f3c69a50f6520c9d20a19af9fdc5175e7c9772f 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment.php @@ -153,6 +153,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\LocaleInterface $coreLocale + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollFactory @@ -173,6 +174,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\Registry $registry, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollFactory, \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollFactory, @@ -194,7 +196,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel $this->_commentCollFactory = $commentCollFactory; $this->_templateMailerFactory = $templateMailerFactory; $this->_emailInfoFactory = $emailInfoFactory; - parent::__construct($context, $registry, $coreLocale, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php index acfaf040d21f04ab2d19a569589a7b69f6245096..625a8efb88b7447c7481b45acbdf5b91304da4ce 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php @@ -58,6 +58,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $coreLocale + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -67,6 +68,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, @@ -76,6 +78,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel $context, $registry, $coreLocale, + $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Order/Shipment/Track.php index cc75016efc24ffb1fbaaedee26f14f97d4a37cf9..dd272384554120ea96df6dbfb7b512ed355292cb 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Track.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Track.php @@ -83,6 +83,7 @@ class Track extends \Magento\Sales\Model\AbstractModel * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $coreLocale + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory @@ -94,6 +95,7 @@ class Track extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, @@ -105,6 +107,7 @@ class Track extends \Magento\Sales\Model\AbstractModel $context, $registry, $coreLocale, + $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Order/Status/History.php b/app/code/Magento/Sales/Model/Order/Status/History.php index b87727c9c7280ae6c09f04decd6437333fc1c3e0..a901dfff45225c2f0f5cb0aede32d256ca20ee5e 100644 --- a/app/code/Magento/Sales/Model/Order/Status/History.php +++ b/app/code/Magento/Sales/Model/Order/Status/History.php @@ -66,6 +66,7 @@ class History extends \Magento\Sales\Model\AbstractModel * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $coreLocale + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -75,6 +76,7 @@ class History extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, @@ -84,6 +86,7 @@ class History extends \Magento\Sales\Model\AbstractModel $context, $registry, $coreLocale, + $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php index a47177b1160aa7372fb1468e19a24d3538f2bc2d..0edca3ce0b9fe8706ae815d89647888e70d9648c 100644 --- a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php +++ b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php @@ -59,14 +59,14 @@ class Base extends \Magento\Sales\Model\Config\Ordered /** * @param \Magento\Core\Model\Cache\Type\Config $configCacheType - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Sales\Model\Order\TotalFactory $orderTotalFactory * @param \Magento\Sales\Model\Config $salesConfig, * @param null $sourceData */ public function __construct( \Magento\Core\Model\Cache\Type\Config $configCacheType, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Sales\Model\Order\TotalFactory $orderTotalFactory, \Magento\Sales\Model\Config $salesConfig, $sourceData = null diff --git a/app/code/Magento/Sales/Model/Payment/Method/Converter.php b/app/code/Magento/Sales/Model/Payment/Method/Converter.php index 580a57385659f6f2cc70cffbf71a9e766d8b5ad3..cc437fe2fa4aa7ed2e4e657c917acd571bda74b2 100644 --- a/app/code/Magento/Sales/Model/Payment/Method/Converter.php +++ b/app/code/Magento/Sales/Model/Payment/Method/Converter.php @@ -51,14 +51,17 @@ class Converter ); /** - * @var \Magento\Core\Helper\Data + * @var \Magento\Encryption\EncryptorInterface */ protected $_encryptor; + /** + * @param \Magento\Encryption\EncryptorInterface $encryptor + */ public function __construct( - \Magento\Core\Helper\Data $coreData + \Magento\Encryption\EncryptorInterface $encryptor ) { - $this->_encryptor = $coreData; + $this->_encryptor = $encryptor; } /** @@ -75,7 +78,6 @@ class Converter $this->_encryptFields[$method][$filedName]; } - /** * Decode data * diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php b/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php index f5664da02abd24259976fe16f6499288148cdf4f..168c4ddb79516e048a717febe548520cef790733 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php @@ -85,7 +85,7 @@ class Collector extends \Magento\Sales\Model\Config\Ordered * Init corresponding total models * * @param \Magento\Core\Model\Cache\Type\Config $configCacheType - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -95,7 +95,7 @@ class Collector extends \Magento\Sales\Model\Config\Ordered */ public function __construct( \Magento\Core\Model\Cache\Type\Config $configCacheType, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Sales\Model\Config $salesConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Sales/Model/Quote/Payment.php b/app/code/Magento/Sales/Model/Quote/Payment.php index 7c0b16344303ae0a2c457b9f334e7fec42bd60cb..296a061d4907f385cc62927790f81c805e010507 100644 --- a/app/code/Magento/Sales/Model/Quote/Payment.php +++ b/app/code/Magento/Sales/Model/Quote/Payment.php @@ -86,26 +86,26 @@ class Payment extends \Magento\Payment\Model\Info /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Data $coreData, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_eventManager = $eventManager; - parent::__construct($coreData, $paymentData, $context, $registry, $resource, $resourceCollection, $data); + parent::__construct($paymentData, $context, $registry, $encryptor, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Sales/Model/Recurring/Profile.php b/app/code/Magento/Sales/Model/Recurring/Profile.php index b3245922a49a3debf2012ccbc09d295884779997..40c28f1bc47f2c2793b118b255955b6d59ab8fc0 100644 --- a/app/code/Magento/Sales/Model/Recurring/Profile.php +++ b/app/code/Magento/Sales/Model/Recurring/Profile.php @@ -131,13 +131,6 @@ class Profile extends \Magento\Payment\Model\Recurring\Profile */ protected $_workflow = null; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * @var \Magento\Sales\Model\OrderFactory */ @@ -159,7 +152,11 @@ class Profile extends \Magento\Payment\Model\Recurring\Profile protected $_orderItemFactory; /** - * @param \Magento\Core\Helper\Data $coreData + * @var \Magento\Math\Random + */ + protected $mathRandom; + + /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -167,6 +164,7 @@ class Profile extends \Magento\Payment\Model\Recurring\Profile * @param \Magento\Sales\Model\Order\AddressFactory $addressFactory * @param \Magento\Sales\Model\Order\PaymentFactory $paymentFactory * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory + * @param \Magento\Math\Random $mathRandom * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -174,7 +172,6 @@ class Profile extends \Magento\Payment\Model\Recurring\Profile * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, @@ -182,15 +179,16 @@ class Profile extends \Magento\Payment\Model\Recurring\Profile \Magento\Sales\Model\Order\AddressFactory $addressFactory, \Magento\Sales\Model\Order\PaymentFactory $paymentFactory, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, + \Magento\Math\Random $mathRandom, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreData = $coreData; $this->_orderFactory = $orderFactory; $this->_addressFactory = $addressFactory; $this->_paymentFactory = $paymentFactory; $this->_orderItemFactory = $orderItemFactory; + $this->mathRandom = $mathRandom; parent::__construct($paymentData, $context, $registry, $resource, $resourceCollection, $data); } @@ -213,9 +211,9 @@ class Profile extends \Magento\Payment\Model\Recurring\Profile { $this->_getResource()->beginTransaction(); try { - $this->setInternalReferenceId($this->_coreData->uniqHash('temporary-')); + $this->setInternalReferenceId($this->mathRandom->getUniqueHash('temporary-')); $this->save(); - $this->setInternalReferenceId($this->_coreData->uniqHash($this->getId() . '-')); + $this->setInternalReferenceId($this->mathRandom->getUniqueHash($this->getId() . '-')); $this->getMethodInstance()->submitRecurringProfile($this, $this->getQuote()->getPayment()); $this->save(); $this->_getResource()->commit(); diff --git a/app/code/Magento/Sales/Model/Resource/AbstractResource.php b/app/code/Magento/Sales/Model/Resource/AbstractResource.php index a09f8ac40c0549bc4010bdc503be085ff9d5a1fa..eb9dddaa4816c86c533a8a2b670562b3c6830873 100644 --- a/app/code/Magento/Sales/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Sales/Model/Resource/AbstractResource.php @@ -43,6 +43,23 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract */ protected $_converter = null; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\App\Resource $resource + * @param \Magento\Stdlib\DateTime $dateTime + */ + public function __construct( + \Magento\App\Resource $resource, + \Magento\Stdlib\DateTime $dateTime + ) { + $this->dateTime = $dateTime; + parent::__construct($resource); + } + /** * Prepare data for save * @@ -51,7 +68,7 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract */ protected function _prepareDataForSave(\Magento\Core\Model\AbstractModel $object) { - $currentTime = \Magento\Date::now(); + $currentTime = $this->dateTime->now(); if ((!$object->getId() || $object->isObjectNew()) && !$object->getCreatedAt()) { $object->setCreatedAt($currentTime); } diff --git a/app/code/Magento/Sales/Model/Resource/Billing/Agreement/Collection.php b/app/code/Magento/Sales/Model/Resource/Billing/Agreement/Collection.php index a35bdbd104daae2ab37bbe150a9a94f0252c1f85..81695dcb94b1cd856de89cbc081795381cdf1330 100644 --- a/app/code/Magento/Sales/Model/Resource/Billing/Agreement/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Billing/Agreement/Collection.php @@ -52,7 +52,7 @@ class Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Customer\Model\Resource\Customer $customerResource @@ -60,7 +60,7 @@ class Collection */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Customer\Model\Resource\Customer $customerResource, diff --git a/app/code/Magento/Sales/Model/Resource/Helper.php b/app/code/Magento/Sales/Model/Resource/Helper.php index 3dac870f5dda031643dff9a95097879d0d9f2c33..41c75a214cf882cbc97ef63b85d000e577faf08c 100644 --- a/app/code/Magento/Sales/Model/Resource/Helper.php +++ b/app/code/Magento/Sales/Model/Resource/Helper.php @@ -38,12 +38,12 @@ class Helper extends \Magento\Core\Model\Resource\Helper protected $_reportsResourceHelper; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Reports\Model\Resource\Helper $reportsResourceHelper * @param string $modulePrefix */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Reports\Model\Resource\Helper $reportsResourceHelper, $modulePrefix = 'sales' ) { diff --git a/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php b/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php index 4dc27d23f9e0ac5c19ef9beaf0643e866b6aa13c..21c549330d10900bbe61c1fe400c18b3fc64ade2 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php +++ b/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php @@ -24,11 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Sales\Model\Resource\Order; + /** * Flat sales resource abstract */ -namespace Magento\Sales\Model\Resource\Order; - abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResource { /** @@ -101,17 +101,19 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Eav\Model\Entity\TypeFactory $eavEntityTypeFactory */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, + \Magento\Stdlib\DateTime $dateTime, \Magento\Eav\Model\Entity\TypeFactory $eavEntityTypeFactory ) { $this->_eventManager = $eventManager; $this->_eavEntityTypeFactory = $eavEntityTypeFactory; - parent::__construct($resource); + parent::__construct($resource, $dateTime); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Address.php b/app/code/Magento/Sales/Model/Resource/Order/Address.php index 2b83f8ddc4b580fb8acabd99cf99685af53f8c2b..cedb9e98ea27c4bd258fd724a56c4129e1b07984 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Address.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Address.php @@ -45,17 +45,19 @@ class Address extends \Magento\Sales\Model\Resource\Order\AbstractOrder /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Eav\Model\Entity\TypeFactory $eavEntityTypeFactory * @param \Magento\Sales\Model\Resource\Factory $salesResourceFactory */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, + \Magento\Stdlib\DateTime $dateTime, \Magento\Eav\Model\Entity\TypeFactory $eavEntityTypeFactory, \Magento\Sales\Model\Resource\Factory $salesResourceFactory ) { - parent::__construct($eventManager, $resource, $eavEntityTypeFactory); + parent::__construct($eventManager, $resource, $dateTime, $eavEntityTypeFactory); $this->_salesResourceFactory = $salesResourceFactory; } diff --git a/app/code/Magento/Sales/Model/Resource/Order/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Collection.php index e80a83337da1c2637f857ca11dd08c99677dc454..d69c0878d71b43309b8672facf961fbdfc4fbff4 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Collection.php @@ -57,7 +57,7 @@ class Collection extends \Magento\Sales\Model\Resource\Collection\AbstractCollec /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Helper $coreResourceHelper @@ -65,7 +65,7 @@ class Collection extends \Magento\Sales\Model\Resource\Collection\AbstractCollec */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Helper $coreResourceHelper, diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment.php b/app/code/Magento/Sales/Model/Resource/Order/Payment.php index b8a4ec6c56f5445959cfb767b687ff0ea343c565..75fb12c3b55c3a8ebb913061f7e988b871be0df6 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment.php @@ -24,11 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Sales\Model\Resource\Order; + /** * Flat sales order payment resource */ -namespace Magento\Sales\Model\Resource\Order; - class Payment extends \Magento\Sales\Model\Resource\Order\AbstractOrder { /** @@ -54,23 +54,24 @@ class Payment extends \Magento\Sales\Model\Resource\Order\AbstractOrder /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Eav\Model\Entity\TypeFactory $eavEntityTypeFactory * @param \Magento\Sales\Model\Payment\Method\Converter $paymentConverter */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, + \Magento\Stdlib\DateTime $dateTime, \Magento\Eav\Model\Entity\TypeFactory $eavEntityTypeFactory, \Magento\Sales\Model\Payment\Method\Converter $paymentConverter ) { $this->_paymentConverter = $paymentConverter; - parent::__construct($eventManager, $resource, $eavEntityTypeFactory); + parent::__construct($eventManager, $resource, $dateTime, $eavEntityTypeFactory); } /** * Model initialization - * */ protected function _construct() { diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php index 5af83d740b754908580fb25e14e0588d9d577f8e..6b2985b98da3bd100e5c7f5deb4c614ecc446f9e 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php @@ -52,7 +52,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection\Abstract /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Payment\Method\Converter $converter @@ -60,7 +60,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection\Abstract */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Payment\Method\Converter $converter, diff --git a/app/code/Magento/Sales/Model/Resource/Quote.php b/app/code/Magento/Sales/Model/Resource/Quote.php index bafe56dbd9853e4b59c0ef63c5716b865e15d16c..22f95944d032170b8cd60e6d40c27a14f88cea38 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote.php +++ b/app/code/Magento/Sales/Model/Resource/Quote.php @@ -24,11 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Sales\Model\Resource; + /** * Quote resource model */ -namespace Magento\Sales\Model\Resource; - class Quote extends \Magento\Sales\Model\Resource\AbstractResource { /** @@ -37,14 +37,16 @@ class Quote extends \Magento\Sales\Model\Resource\AbstractResource protected $_config; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Eav\Model\Config $config */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, + \Magento\Stdlib\DateTime $dateTime, \Magento\Eav\Model\Config $config ) { - parent::__construct($resource); + parent::__construct($resource, $dateTime); $this->_config = $config; } diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php index 8859541a16a0ebd05647a7f0cfcb3852821dc399..437747b3ac50deae3fa838ec4c04ddfd94e5365e 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php @@ -38,11 +38,11 @@ class Region protected $_regionFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Directory\Model\RegionFactory $regionFactory */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Directory\Model\RegionFactory $regionFactory ) { $this->_regionFactory = $regionFactory; diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php index fe6db92703668642e4c8f2dd8c7dd552459031db..7b4de1b1ad7964735e383aecd7b4b19f247661e0 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php @@ -62,7 +62,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Quote\Item\Option\CollectionFactory $itemOptionCollFactory @@ -72,7 +72,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Quote\Item\Option\CollectionFactory $itemOptionCollFactory, diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Payment.php b/app/code/Magento/Sales/Model/Resource/Quote/Payment.php index 2cf823a7115942816d89453a6fc0f80cdc7a6347..03635de2e449692bda4475f0cf4c727eb3891a21 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Payment.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Payment.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Sales\Model\Resource\Quote; /** * Quote payment resource model - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Model\Resource\Quote; - class Payment extends \Magento\Sales\Model\Resource\AbstractResource { /** @@ -51,15 +46,17 @@ class Payment extends \Magento\Sales\Model\Resource\AbstractResource protected $_paymentConverter; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Sales\Model\Payment\Method\Converter $paymentConverter */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, + \Magento\Stdlib\DateTime $dateTime, \Magento\Sales\Model\Payment\Method\Converter $paymentConverter ) { $this->_paymentConverter = $paymentConverter; - parent::__construct($resource); + parent::__construct($resource, $dateTime); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php index a278e255c46eb9d9e9ad3664ea7acb03fa8f7498..0bf37626e08b48c4ddb5cf0ebc4dba27982fb491 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php @@ -38,7 +38,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Payment\Method\Converter $converter @@ -46,7 +46,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Payment\Method\Converter $converter, diff --git a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php index f6934a27156403b079b3a6d1fe2be6d81ca28f87..b7ec10b886ad74481dbee9c455ab0bff985c6b7f 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php @@ -46,22 +46,24 @@ class Bestsellers extends \Magento\Sales\Model\Resource\Report\AbstractReport protected $_salesResourceHelper; /** - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Logger $logger + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Reports\Model\FlagFactory $reportsFlagFactory + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Catalog\Model\Resource\Product $productResource * @param \Magento\Sales\Model\Resource\Helper $salesResourceHelper */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\Resource $resource, + \Magento\Logger $logger, + \Magento\App\Resource $resource, \Magento\Core\Model\LocaleInterface $locale, \Magento\Reports\Model\FlagFactory $reportsFlagFactory, + \Magento\Stdlib\DateTime $dateTime, \Magento\Catalog\Model\Resource\Product $productResource, \Magento\Sales\Model\Resource\Helper $salesResourceHelper ) { - parent::__construct($logger, $resource, $locale, $reportsFlagFactory); + parent::__construct($logger, $resource, $locale, $reportsFlagFactory, $dateTime); $this->_productResource = $productResource; $this->_salesResourceHelper = $salesResourceHelper; } diff --git a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers/Collection.php b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers/Collection.php index 7a3bede3d88d60ff6dbc7c29915ffb5f7acb55a2..d6ce3bf58bbf10b8aaf25926ff71171d77aa883b 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers/Collection.php @@ -53,14 +53,14 @@ class Collection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource @@ -230,7 +230,7 @@ class Collection $selectUnions = array(); // apply date boundaries (before calling $this->_applyDateRangeFilter()) - $dtFormat = \Magento\Date::DATE_INTERNAL_FORMAT; + $dtFormat = \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT; $periodFrom = (!is_null($this->_from) ? new \Zend_Date($this->_from, $dtFormat) : null); $periodTo = (!is_null($this->_to) ? new \Zend_Date($this->_to, $dtFormat) : null); if ('year' == $this->_period) { diff --git a/app/code/Magento/Sales/Model/Resource/Report/Collection/AbstractCollection.php b/app/code/Magento/Sales/Model/Resource/Report/Collection/AbstractCollection.php index 129d3cd399e2b48f10c85ed63b7bc10300e23ebc..54016b5e96e491c9b855c6c098730c73f6be6998 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Collection/AbstractCollection.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Collection/AbstractCollection.php @@ -46,14 +46,14 @@ class AbstractCollection /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource diff --git a/app/code/Magento/Sales/Model/Resource/Report/Invoiced/Collection/Invoiced.php b/app/code/Magento/Sales/Model/Resource/Report/Invoiced/Collection/Invoiced.php index 4e36236bfd479d5ce85e0d341604d6b0782d8092..84f420d7b9ed8b62ceadc4b0899dee093f237a27 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Invoiced/Collection/Invoiced.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Invoiced/Collection/Invoiced.php @@ -39,14 +39,14 @@ class Invoiced { /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource diff --git a/app/code/Magento/Sales/Model/Resource/Report/Invoiced/Collection/Order.php b/app/code/Magento/Sales/Model/Resource/Report/Invoiced/Collection/Order.php index 2d36eaf0ed3ab0f7c2a6055f0aba968a49c3c56e..c5c4ef2824db0ee2298c1b5514714ffffa98c4cd 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Invoiced/Collection/Order.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Invoiced/Collection/Order.php @@ -53,14 +53,14 @@ class Order /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource diff --git a/app/code/Magento/Sales/Model/Resource/Report/Order.php b/app/code/Magento/Sales/Model/Resource/Report/Order.php index 92922270a1d2a00c1a2da928108524cb4ebf034d..44ef6292d2ce1e2f22441f18fb58d0670c8f7657 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Order.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Order.php @@ -42,22 +42,24 @@ class Order extends \Magento\Sales\Model\Resource\Report\AbstractReport protected $_updateDatFactory; /** - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Logger $logger + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Reports\Model\FlagFactory $reportsFlagFactory - * @param \Magento\Sales\Model\Resource\Report\Order\CreatedatFactory $createDatFactory - * @param \Magento\Sales\Model\Resource\Report\Order\UpdatedatFactory $updateDatFactory + * @param \Magento\Stdlib\DateTime $dateTime + * @param Order\CreatedatFactory $createDatFactory + * @param Order\UpdatedatFactory $updateDatFactory */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\Resource $resource, + \Magento\Logger $logger, + \Magento\App\Resource $resource, \Magento\Core\Model\LocaleInterface $locale, \Magento\Reports\Model\FlagFactory $reportsFlagFactory, + \Magento\Stdlib\DateTime $dateTime, \Magento\Sales\Model\Resource\Report\Order\CreatedatFactory $createDatFactory, \Magento\Sales\Model\Resource\Report\Order\UpdatedatFactory $updateDatFactory ) { - parent::__construct($logger, $resource, $locale, $reportsFlagFactory); + parent::__construct($logger, $resource, $locale, $reportsFlagFactory, $dateTime); $this->_createDatFactory = $createDatFactory; $this->_updateDatFactory = $updateDatFactory; } diff --git a/app/code/Magento/Sales/Model/Resource/Report/Order/Collection.php b/app/code/Magento/Sales/Model/Resource/Report/Order/Collection.php index 792d5fba8eddddbbcfc37311fe4ee03899565508..56d4e5f062c7ddc796ee7fef597814ed1fc26cee 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Order/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Order/Collection.php @@ -59,14 +59,14 @@ class Collection extends \Magento\Sales\Model\Resource\Report\Collection\Abstrac /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource diff --git a/app/code/Magento/Sales/Model/Resource/Report/Refunded/Collection/Order.php b/app/code/Magento/Sales/Model/Resource/Report/Refunded/Collection/Order.php index 0c83014557652981baca2b502ff6c30199baf16d..4f9375aa708eb7cf7be20aa712b5d879236aee57 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Refunded/Collection/Order.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Refunded/Collection/Order.php @@ -53,14 +53,14 @@ class Order /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource diff --git a/app/code/Magento/Sales/Model/Resource/Report/Refunded/Collection/Refunded.php b/app/code/Magento/Sales/Model/Resource/Report/Refunded/Collection/Refunded.php index 04bdf59eefc69b56c02cfec97cfdc2bcaef8e164..123c79040c90b1b702f26d7e29a903749f6c25e0 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Refunded/Collection/Refunded.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Refunded/Collection/Refunded.php @@ -39,14 +39,14 @@ class Refunded { /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource diff --git a/app/code/Magento/Sales/Model/Resource/Report/Shipping/Collection/Order.php b/app/code/Magento/Sales/Model/Resource/Report/Shipping/Collection/Order.php index 4b9ec8cae717289a021db4327c8f29890c7efaac..9022ed9d8dda23aa6196dc74ff3ccf77fa932e98 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Shipping/Collection/Order.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Shipping/Collection/Order.php @@ -53,14 +53,14 @@ class Order /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource diff --git a/app/code/Magento/Sales/Model/Resource/Report/Shipping/Collection/Shipment.php b/app/code/Magento/Sales/Model/Resource/Report/Shipping/Collection/Shipment.php index 06b973e480a3ec6b800952180fd98e8f3603eff6..f335ab4b22e29e1998e0a6465f70f3d606e22dda 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Shipping/Collection/Shipment.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Shipping/Collection/Shipment.php @@ -39,14 +39,14 @@ class Shipment { /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource diff --git a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php index a8a6dbc34aea7ec2a19d84ca7af05deda2203db5..334220fcec5a60563e732a80185ce3d8db0cc0f6 100644 --- a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php @@ -90,7 +90,7 @@ class Collection extends \Magento\Data\Collection\Db * Set sales order entity and establish read connection * * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Order $resource @@ -99,7 +99,7 @@ class Collection extends \Magento\Data\Collection\Db */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Order $resource, diff --git a/app/code/Magento/Sales/Model/Resource/Setup.php b/app/code/Magento/Sales/Model/Resource/Setup.php index 21164e58fdcd4e0e660987dbef9c791f1835fbca..3bcc41506e1aa4f1a6b64483ef45e28ac9191b8e 100644 --- a/app/code/Magento/Sales/Model/Resource/Setup.php +++ b/app/code/Magento/Sales/Model/Resource/Setup.php @@ -32,20 +32,19 @@ namespace Magento\Sales\Model\Resource; class Setup extends \Magento\Eav\Model\Entity\Setup { /** - * @var \Magento\Core\Helper\Data + * @var \Magento\Core\Model\Config */ - protected $_coreData; + protected $_config; /** - * @var \Magento\Core\Model\Config + * @var \Magento\Encryption\EncryptorInterface */ - protected $_config; + protected $_encryptor; /** * @param \Magento\Core\Model\Resource\Setup\Context $context - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory - * @param \Magento\Core\Helper\Data $coreHelper * @param \Magento\Core\Model\Config $config * @param string $resourceName * @param string $moduleName @@ -53,16 +52,15 @@ class Setup extends \Magento\Eav\Model\Entity\Setup */ public function __construct( \Magento\Core\Model\Resource\Setup\Context $context, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, - \Magento\Core\Helper\Data $coreHelper, \Magento\Core\Model\Config $config, $resourceName, $moduleName = 'Magento_Sales', $connectionName = '' ) { $this->_config = $config; - $this->_coreData = $coreHelper; + $this->_encryptor = $context->getEncryptor(); parent::__construct($context, $cache, $attrGrCollFactory, $resourceName, $moduleName, $connectionName); } @@ -260,22 +258,20 @@ class Setup extends \Magento\Eav\Model\Entity\Setup } /** - * Get Core Helper + * Get config model * - * @return \Magento\Core\Helper\Data + * @return \Magento\Core\Model\Config */ - public function getCoreData() + public function getConfigModel() { - return $this->_coreData; + return $this->_config; } /** - * Get config model - * - * @return \Magento\Core\Model\Config + * @return \Magento\Encryption\EncryptorInterface */ - public function getConfigModel() + public function getEncryptor() { - return $this->_config; + return $this->_encryptor; } } diff --git a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.8-1.6.0.9.php b/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.8-1.6.0.9.php index d9960aefe61573ba5e1e48eedab65cf1dcdd0d1a..09c3db4ecd284d715a88c74f87fcd564dc05c9b0 100644 --- a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.8-1.6.0.9.php +++ b/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.8-1.6.0.9.php @@ -50,9 +50,9 @@ do { ->update( $installer->getTable('sales_flat_order_payment'), array( - 'cc_exp_month' => $installer->getCoreData()->encrypt($order['cc_exp_month']), - 'cc_exp_year' => $installer->getCoreData()->encrypt($order['cc_exp_year']), - 'cc_owner' => $installer->getCoreData()->encrypt($order['cc_owner']), + 'cc_exp_month' => $installer->getEncryptor()->encrypt($order['cc_exp_month']), + 'cc_exp_year' => $installer->getEncryptor()->encrypt($order['cc_exp_year']), + 'cc_owner' => $installer->getEncryptor()->encrypt($order['cc_owner']), ), array('entity_id = ?' => $order['entity_id']) ); @@ -80,9 +80,9 @@ do { ->update( $installer->getTable('sales_flat_quote_payment'), array( - 'cc_exp_month' => $installer->getCoreData()->encrypt($quote['cc_exp_month']), - 'cc_exp_year' => $installer->getCoreData()->encrypt($quote['cc_exp_year']), - 'cc_owner' => $installer->getCoreData()->encrypt($quote['cc_owner']), + 'cc_exp_month' => $installer->getEncryptor()->encrypt($quote['cc_exp_month']), + 'cc_exp_year' => $installer->getEncryptor()->encrypt($quote['cc_exp_year']), + 'cc_owner' => $installer->getEncryptor()->encrypt($quote['cc_owner']), ), array('payment_id = ?' => $quote['payment_id']) ); diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index 713cbb774896172e3cb9d4c9ca7267626bd6aec1..177ef2c69cc9fe0eb9210a289e00b95b96e4311c 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -56,7 +56,7 @@ </value> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <sales_setup>Magento\Sales\Model\Resource\Setup</sales_setup> diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/items/grid.phtml b/app/code/Magento/Sales/view/adminhtml/order/create/items/grid.phtml index 14e119ba8f6177e533ffe9c9e15a1deb6aae420e..1a62e3028641d2c6612e7983dd8cd1efac172592 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/items/grid.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/create/items/grid.phtml @@ -26,7 +26,7 @@ ?> <?php /** - * @see \Magento\Sales\Block\Adminhtml\Order\Create\Items\Grid + * @var $this \Magento\Sales\Block\Adminhtml\Order\Create\Items\Grid */ ?> @@ -115,7 +115,7 @@ <?php if($_item->getMessage(false)): ?> <?php foreach ($_item->getMessage(false) as $message): ?> <div class="<?php if($_item->getHasError()): ?>error<?php else: ?>notice<?php endif; ?>"> - <div style="font-size:95%"><?php echo $this->helper('Magento\Core\Helper\Data')->escapeHtml($message); ?></div> + <div style="font-size:95%"><?php echo $this->escapeHtml($message); ?></div> </div> <?php endforeach; ?> <?php endif; ?> diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/sidebar.phtml b/app/code/Magento/Sales/view/adminhtml/order/create/sidebar.phtml index 1a37deec88a37d2c900e249333d0d171834b8d3c..f58874f8c87ce823576940b9f1c12182b026c245 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/sidebar.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/create/sidebar.phtml @@ -49,7 +49,7 @@ function addSidebarCompositeListType() { urlConfirm: '<?php echo $this->getUrl('sales/order_create/addConfigured') ?>' }); productConfigure.addListType('sidebar_wishlist', { - urlFetch: '<?php echo $this->getUrl('*/customer_wishlist_product_composite_wishlist/configure') ?>', + urlFetch: '<?php echo $this->getUrl('customer/wishlist_product_composite_wishlist/configure') ?>', urlConfirm: '<?php echo $this->getUrl('sales/order_create/addConfigured') ?>' }); } diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_printorder.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_print.xml similarity index 100% rename from app/code/Magento/Sales/view/frontend/layout/sales_order_printorder.xml rename to app/code/Magento/Sales/view/frontend/layout/sales_order_print.xml diff --git a/app/code/Magento/Sales/view/frontend/order/creditmemo/items/renderer/default.phtml b/app/code/Magento/Sales/view/frontend/order/creditmemo/items/renderer/default.phtml index 176a8772f7c325fb0c470e56139ea8a01cb83217..255e77327ec0c190bb3d0e58b4465b2274634a75 100644 --- a/app/code/Magento/Sales/view/frontend/order/creditmemo/items/renderer/default.phtml +++ b/app/code/Magento/Sales/view/frontend/order/creditmemo/items/renderer/default.phtml @@ -74,7 +74,7 @@ data-item-id="<?php echo $_item->getId() ?>"><?php echo __('Gift Message') ?></a> <?php endif; ?> </td> - <td class="col sku"><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td class="col sku"><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="col price"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/code/Magento/Sales/view/frontend/order/invoice/items/renderer/default.phtml b/app/code/Magento/Sales/view/frontend/order/invoice/items/renderer/default.phtml index 435ebe03f6b4adb23e1858ec4ea04988026de8ab..c4245425b820e63e022a85e4be732cfee709d14d 100644 --- a/app/code/Magento/Sales/view/frontend/order/invoice/items/renderer/default.phtml +++ b/app/code/Magento/Sales/view/frontend/order/invoice/items/renderer/default.phtml @@ -65,7 +65,7 @@ </a> <?php endif; ?> </td> - <td class="col sku"><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td class="col sku"><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="col price"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/code/Magento/Sales/view/frontend/order/items/renderer/default.phtml b/app/code/Magento/Sales/view/frontend/order/items/renderer/default.phtml index 70a7964512e50c1ad2dd6eb37cf6019ba198bc5c..721f0d8d013e0dc51a029ceecdaea010dfd50d5a 100644 --- a/app/code/Magento/Sales/view/frontend/order/items/renderer/default.phtml +++ b/app/code/Magento/Sales/view/frontend/order/items/renderer/default.phtml @@ -67,7 +67,7 @@ </a> <?php endif; ?> </td> - <td class="col sku"><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td class="col sku"><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="col price"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/code/Magento/Sales/view/frontend/order/shipment/items/renderer/default.phtml b/app/code/Magento/Sales/view/frontend/order/shipment/items/renderer/default.phtml index 1cca16162d470ca2b09c887414bc0d5770b7844a..83f4061098386042ab0fe98c86950351b81ead69 100644 --- a/app/code/Magento/Sales/view/frontend/order/shipment/items/renderer/default.phtml +++ b/app/code/Magento/Sales/view/frontend/order/shipment/items/renderer/default.phtml @@ -66,6 +66,6 @@ </a> <?php endif; ?> </td> - <td class="col sku"><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td class="col sku"><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="col qty"><?php echo $_item->getQty()*1 ?></td> </tr> diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Promo/Quote.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote.php index 6290260e80a2a2fc9622057cdf7f6b291c29558e..e4466f646f4bea3ccc07a26ca0aa168359a8ee88 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote.php @@ -33,7 +33,7 @@ * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo; +namespace Magento\SalesRule\Block\Adminhtml\Promo; class Quote extends \Magento\Adminhtml\Block\Widget\Grid\Container { diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php similarity index 94% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php index 46fafcaffbcc21a3ce32542720906e3c062e27ac..ad87f52d5b099beeca6ecaea086b7155440eb4ff 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit.php @@ -28,7 +28,7 @@ * Shopping cart rule edit form block */ -namespace Magento\Adminhtml\Block\Promo\Quote; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote; class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { @@ -63,7 +63,8 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container protected function _construct() { $this->_objectId = 'id'; - $this->_controller = 'promo_quote'; + $this->_controller = 'adminhtml_promo_quote'; + $this->_blockGroup = 'Magento_SalesRule'; parent::_construct(); diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Form.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Form.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Form.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Form.php index 75c70032e24a1248c78178019247c9aa37472ce7..c0e6d88504e7571a114e30cce1aceec616802e29 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Form.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Form.php @@ -32,7 +32,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { @@ -49,7 +49,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $form = $this->_formFactory->create(array( 'attributes' => array( 'id' => 'edit_form', - 'action' => $this->getData('action'), + 'action' => $this->getUrl('sales_rule/promo_quote/save'), 'method' => 'post', )) ); diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php index c28d674c100f9a740060208d6575976378e37ca0..514c8ce38b03346e8df88db55562f99f66302063 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab; class Actions extends \Magento\Backend\Block\Widget\Form\Generic @@ -52,7 +52,7 @@ class Actions * @param \Magento\Rule\Block\Actions $ruleActions * @param \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -62,7 +62,7 @@ class Actions \Magento\Rule\Block\Actions $ruleActions, \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -183,8 +183,8 @@ class Actions )); $renderer = $this->_rendererFieldset - ->setTemplate('Magento_Adminhtml::promo/fieldset.phtml') - ->setNewChildUrl($this->getUrl('adminhtml/promo_quote/newActionHtml/form/rule_actions_fieldset')); + ->setTemplate('Magento_CatalogRule::promo/fieldset.phtml') + ->setNewChildUrl($this->getUrl('sales_rule/promo_quote/newActionHtml/form/rule_actions_fieldset')); $fieldset = $form->addFieldset('actions_fieldset', array( 'legend'=>__('Apply the rule only to cart items matching the following conditions ' diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php similarity index 91% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php index bc7214111297ff54f1807d83cdb289a8722140fa..0cf0c968e6369bdf5d01873c1e0dc67a9b5d2d99 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Conditions.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab; class Conditions extends \Magento\Backend\Block\Widget\Form\Generic @@ -46,7 +46,7 @@ class Conditions * @param \Magento\Rule\Block\Conditions $conditions * @param \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -55,7 +55,7 @@ class Conditions \Magento\Rule\Block\Conditions $conditions, \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -114,8 +114,8 @@ class Conditions $form->setHtmlIdPrefix('rule_'); $renderer = $this->_rendererFieldset - ->setTemplate('Magento_Adminhtml::promo/fieldset.phtml') - ->setNewChildUrl($this->getUrl('adminhtml/promo_quote/newConditionHtml/form/rule_conditions_fieldset')); + ->setTemplate('Magento_CatalogRule::promo/fieldset.phtml') + ->setNewChildUrl($this->getUrl('sales_rule/promo_quote/newConditionHtml/form/rule_conditions_fieldset')); $fieldset = $form->addFieldset('conditions_fieldset', array( 'legend'=>__('Apply the rule only if the following conditions are met (leave blank for all products).') diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php index f3d3535f21af6f617935853f0cac3dfc3a912053..db45eaec6f7c4e0e81b6ea99604b7759d4f3058d 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons.php @@ -31,7 +31,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab; class Coupons extends \Magento\Adminhtml\Block\Text\ListText diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Form.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Form.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php index 83f3e2d316244ade0346641841c20e06c5166921..651cf4d5d5c90c9c3b1bf5b7e0fbf54c479a1541 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Form.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Form.php @@ -32,7 +32,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons; class Form extends \Magento\Backend\Block\Widget\Form\Generic @@ -45,7 +45,7 @@ class Form protected $_salesRuleCoupon = null; /** - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\SalesRule\Helper\Coupon $salesRuleCoupon * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context @@ -53,7 +53,7 @@ class Form * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\SalesRule\Helper\Coupon $salesRuleCoupon, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, @@ -174,6 +174,6 @@ class Form */ public function getGenerateUrl() { - return $this->getUrl('adminhtml/*/generate'); + return $this->getUrl('sales_rule/*/generate'); } } diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php similarity index 92% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php index 0afc803e579e417fcc07eb9ceeed9c8e9a46a447..e6946a597ee6f2d35a614f491b33de46096e1cf9 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid.php @@ -32,7 +32,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons; class Grid extends \Magento\Adminhtml\Block\Widget\Grid { @@ -131,7 +131,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid __('No'), __('Yes') ), - 'renderer' => 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Grid\Column\Renderer\Used', + 'renderer' => 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid\Column\Renderer\Used', 'filter_condition_callback' => array( $this->_salesRuleCoupon->create(), 'addIsUsedFilterCallback' ) @@ -152,7 +152,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid /** * Configure grid mass actions * - * @return \Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Grid + * @return \Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid */ protected function _prepareMassaction() { @@ -163,7 +163,7 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid $this->getMassactionBlock()->addItem('delete', array( 'label'=> __('Delete'), - 'url' => $this->getUrl('adminhtml/*/couponsMassDelete', array('_current' => true)), + 'url' => $this->getUrl('sales_rule/*/couponsMassDelete', array('_current' => true)), 'confirm' => __('Are you sure you want to delete the selected coupon(s)?'), 'complete' => 'refreshCouponCodesGrid' )); @@ -178,6 +178,6 @@ class Grid extends \Magento\Adminhtml\Block\Widget\Grid */ public function getGridUrl() { - return $this->getUrl('adminhtml/*/couponsGrid', array('_current'=> true)); + return $this->getUrl('sales_rule/*/couponsGrid', array('_current'=> true)); } } diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php similarity index 93% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php index 1509334ccf56621acbca084c1c59596c068faa97..e4e60d31ae61c68126e14622ee30be4d3672fe27 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Coupons/Grid/Column/Renderer/Used.php @@ -31,7 +31,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Grid\Column\Renderer; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid\Column\Renderer; class Used extends \Magento\Adminhtml\Block\Widget\Grid\Column\Renderer\Text diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Labels.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Labels.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Labels.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Labels.php index d1f3b062e49048a1e562087b74eb7df72ef57bf0..ddfca9b85f33f562a7b0e806ae1fda7383d8b823 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Labels.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Labels.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab; class Labels extends \Magento\Backend\Block\Widget\Form\Generic @@ -38,7 +38,7 @@ class Labels protected $_storeManager; /** - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -46,7 +46,7 @@ class Labels * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php similarity index 96% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php index 8f8a0011ae3bc633361ba05ed3eb09952a93a8f3..349b0a53de96f6199b7f8d5e76a9252bd2034fdc 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php @@ -31,7 +31,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab; class Main extends \Magento\Backend\Block\Widget\Form\Generic @@ -64,7 +64,7 @@ class Main * @param \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup * @param \Magento\Core\Model\System\Store $systemStore * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -74,7 +74,7 @@ class Main \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup, \Magento\Core\Model\System\Store $systemStore, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() @@ -241,7 +241,7 @@ class Main )); $autoGenerationCheckbox->setRenderer( - $this->getLayout()->createBlock('Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Main\Renderer\Checkbox') + $this->getLayout()->createBlock('Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Main\Renderer\Checkbox') ); $usesPerCouponFiled = $fieldset->addField('uses_per_coupon', 'text', array( @@ -260,7 +260,7 @@ class Main 'label' => __('From Date'), 'title' => __('From Date'), 'image' => $this->getViewFileUrl('images/grid-cal.gif'), - 'input_format' => \Magento\Date::DATE_INTERNAL_FORMAT, + 'input_format' => \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT, 'date_format' => $dateFormat )); $fieldset->addField('to_date', 'date', array( @@ -268,7 +268,7 @@ class Main 'label' => __('To Date'), 'title' => __('To Date'), 'image' => $this->getViewFileUrl('images/grid-cal.gif'), - 'input_format' => \Magento\Date::DATE_INTERNAL_FORMAT, + 'input_format' => \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT, 'date_format' => $dateFormat )); diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php similarity index 97% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php index ac3a3b15bf8a3087dcda822707985211ffe96971..9f6aee1ea6606f6123c03b76b4df3721419c4de2 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php @@ -31,7 +31,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Main\Renderer; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Main\Renderer; class Checkbox extends \Magento\Backend\Block\AbstractBlock diff --git a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tabs.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tabs.php similarity index 95% rename from app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tabs.php rename to app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tabs.php index 733423dbb88d2529e08336dbd0e3dcccb374fc7e..3edb6cb149e4d5b3121f481c6f2bb63efbea9c53 100644 --- a/app/code/Magento/Adminhtml/Block/Promo/Quote/Edit/Tabs.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tabs.php @@ -32,7 +32,7 @@ * @package Magento_Adminhtml * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit; class Tabs extends \Magento\Adminhtml\Block\Widget\Tabs { diff --git a/app/code/Magento/Adminhtml/Controller/Promo/Quote.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php similarity index 89% rename from app/code/Magento/Adminhtml/Controller/Promo/Quote.php rename to app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php index 339055368711844359003bb2f61f846a303807f3..887d8847b79034a9d110f0665a9e007d4d60334e 100644 --- a/app/code/Magento/Adminhtml/Controller/Promo/Quote.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller\Promo; +namespace Magento\SalesRule\Controller\Adminhtml\Promo; class Quote extends \Magento\Backend\Controller\Adminhtml\Action { @@ -96,7 +96,7 @@ class Quote extends \Magento\Backend\Controller\Adminhtml\Action if (! $model->getRuleId()) { $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( __('This rule no longer exists.')); - $this->_redirect('adminhtml/*'); + $this->_redirect('sales_rule/*'); return; } } @@ -115,7 +115,7 @@ class Quote extends \Magento\Backend\Controller\Adminhtml\Action $this->_coreRegistry->register('current_promo_quote_rule', $model); $this->_initAction()->getLayout()->getBlock('promo_quote_edit') - ->setData('action', $this->getUrl('adminhtml/*/save')); + ->setData('action', $this->getUrl('sales_rule/*/save')); $this ->_addBreadcrumb( @@ -158,7 +158,7 @@ class Quote extends \Magento\Backend\Controller\Adminhtml\Action $session->addError($errorMessage); } $session->setPageData($data); - $this->_redirect('adminhtml/*/edit', array('id'=>$model->getId())); + $this->_redirect('sales_rule/*/edit', array('id'=>$model->getId())); return; } @@ -185,31 +185,31 @@ class Quote extends \Magento\Backend\Controller\Adminhtml\Action $session->addSuccess(__('The rule has been saved.')); $session->setPageData(false); if ($this->getRequest()->getParam('back')) { - $this->_redirect('adminhtml/*/edit', array('id' => $model->getId())); + $this->_redirect('sales_rule/*/edit', array('id' => $model->getId())); return; } - $this->_redirect('adminhtml/*/'); + $this->_redirect('sales_rule/*/'); return; } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); $id = (int)$this->getRequest()->getParam('rule_id'); if (!empty($id)) { - $this->_redirect('adminhtml/*/edit', array('id' => $id)); + $this->_redirect('sales_rule/*/edit', array('id' => $id)); } else { - $this->_redirect('adminhtml/*/new'); + $this->_redirect('sales_rule/*/new'); } return; } catch (\Exception $e) { $this->_getSession()->addError( __('An error occurred while saving the rule data. Please review the log and try again.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->setPageData($data); - $this->_redirect('adminhtml/*/edit', array('id' => $this->getRequest()->getParam('rule_id'))); + $this->_redirect('sales_rule/*/edit', array('id' => $this->getRequest()->getParam('rule_id'))); return; } } - $this->_redirect('adminhtml/*/'); + $this->_redirect('sales_rule/*/'); } public function deleteAction() @@ -222,21 +222,21 @@ class Quote extends \Magento\Backend\Controller\Adminhtml\Action $model->delete(); $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addSuccess( __('The rule has been deleted.')); - $this->_redirect('adminhtml/*/'); + $this->_redirect('sales_rule/*/'); return; } catch (\Magento\Core\Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addError( __('An error occurred while deleting the rule. Please review the log and try again.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); - $this->_redirect('adminhtml/*/edit', array('id' => $this->getRequest()->getParam('id'))); + $this->_objectManager->get('Magento\Logger')->logException($e); + $this->_redirect('sales_rule/*/edit', array('id' => $this->getRequest()->getParam('id'))); return; } } $this->_objectManager->get('Magento\Adminhtml\Model\Session')->addError( __('We can\'t find a rule to delete.')); - $this->_redirect('adminhtml/*/'); + $this->_redirect('sales_rule/*/'); } public function newConditionHtmlAction() @@ -314,11 +314,11 @@ class Quote extends \Magento\Backend\Controller\Adminhtml\Action if ($rule->getId()) { $fileName = 'coupon_codes.xml'; $content = $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Grid') + ->createBlock('Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid') ->getExcelFile($fileName); $this->_prepareDownloadResponse($fileName, $content); } else { - $this->_redirect('adminhtml/*/detail', array('_current' => true)); + $this->_redirect('sales_rule/*/detail', array('_current' => true)); return; } } @@ -335,11 +335,11 @@ class Quote extends \Magento\Backend\Controller\Adminhtml\Action if ($rule->getId()) { $fileName = 'coupon_codes.csv'; $content = $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Grid') + ->createBlock('Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid') ->getCsvFile(); $this->_prepareDownloadResponse($fileName, $content); } else { - $this->_redirect('adminhtml/*/detail', array('_current' => true)); + $this->_redirect('sales_rule/*/detail', array('_current' => true)); return; } } @@ -409,7 +409,7 @@ class Quote extends \Magento\Backend\Controller\Adminhtml\Action $result['error'] = $e->getMessage(); } catch (\Exception $e) { $result['error'] = __('Something went wrong while generating coupons. Please review the log and try again.'); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); @@ -422,7 +422,7 @@ class Quote extends \Magento\Backend\Controller\Adminhtml\Action { $uniqId = $this->getRequest()->getParam('uniq_id'); $chooserBlock = $this->getLayout() - ->createBlock('Magento\Adminhtml\Block\Promo\Widget\Chooser', '', array('data' => array('id' => $uniqId))); + ->createBlock('Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser', '', array('data' => array('id' => $uniqId))); $this->getResponse()->setBody($chooserBlock->toHtml()); } diff --git a/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php b/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php index 5b33ea8bfc6a6509d23aed77dade7af31a6689d8..62b1e861aea1941c26b792027d7d6a300f8c18b9 100644 --- a/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php +++ b/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php @@ -68,12 +68,18 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel */ protected $_couponFactory; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\SalesRule\Helper\Coupon $salesRuleCoupon * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\SalesRule\Model\CouponFactory $couponFactory * @param \Magento\Core\Model\Date $date + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -84,6 +90,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Registry $registry, \Magento\SalesRule\Model\CouponFactory $couponFactory, \Magento\Core\Model\Date $date, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -91,6 +98,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel $this->_salesRuleCoupon = $salesRuleCoupon; $this->_date = $date; $this->_couponFactory = $couponFactory; + $this->dateTime = $dateTime; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -180,7 +188,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel $this->setLength($length); } - $now = $this->getResource()->formatDate($this->_date->gmtTimestamp()); + $now = $this->dateTime->formatDate($this->_date->gmtTimestamp()); for ($i = 0; $i < $size; $i++) { $attempt = 0; @@ -194,7 +202,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel $expirationDate = $this->getToDate(); if ($expirationDate instanceof \Zend_Date) { - $expirationDate = $expirationDate->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT); + $expirationDate = $expirationDate->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); } $coupon->setId(null) diff --git a/app/code/Magento/SalesRule/Model/Resource/Coupon.php b/app/code/Magento/SalesRule/Model/Resource/Coupon.php index 622a66ed04804ae636e46e6f106579501ef91b87..5f4aa6ddcc59861b80fcac421060f3614e6c78db 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Coupon.php +++ b/app/code/Magento/SalesRule/Model/Resource/Coupon.php @@ -59,7 +59,7 @@ class Coupon extends \Magento\Core\Model\Resource\Db\AbstractDb if (!$object->getExpirationDate()) { $object->setExpirationDate(null); } else if ($object->getExpirationDate() instanceof \Zend_Date) { - $object->setExpirationDate($object->getExpirationDate()->toString(\Magento\Date::DATETIME_INTERNAL_FORMAT)); + $object->setExpirationDate($object->getExpirationDate()->toString(\Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)); } // maintain single primary coupon per rule diff --git a/app/code/Magento/SalesRule/Model/Resource/Report/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Report/Collection.php index ddc9cd413f31e0c9cb9600d9ef0caf1cbaa3e1dc..95e51f2d5f7037b373c04153111f815810afe0c1 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Report/Collection.php +++ b/app/code/Magento/SalesRule/Model/Resource/Report/Collection.php @@ -67,7 +67,7 @@ class Collection extends \Magento\Sales\Model\Resource\Report\Collection\Abstrac /** * @param \Magento\SalesRule\Model\Resource\Report\RuleFactory $ruleFactory * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource @@ -75,7 +75,7 @@ class Collection extends \Magento\Sales\Model\Resource\Report\Collection\Abstrac public function __construct( \Magento\SalesRule\Model\Resource\Report\RuleFactory $ruleFactory, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource diff --git a/app/code/Magento/SalesRule/Model/Resource/Report/Rule.php b/app/code/Magento/SalesRule/Model/Resource/Report/Rule.php index 2e7f00eafc30fa27a1f90eba28e1c8d4d49dbf90..446ac6af551b6c49be6f06a80d75d035701414e7 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Report/Rule.php +++ b/app/code/Magento/SalesRule/Model/Resource/Report/Rule.php @@ -47,22 +47,24 @@ class Rule extends \Magento\Reports\Model\Resource\Report\AbstractReport protected $_updatedatFactory; /** - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Logger $logger + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Reports\Model\FlagFactory $reportsFlagFactory - * @param \Magento\SalesRule\Model\Resource\Report\Rule\CreatedatFactory $createdatFactory - * @param \Magento\SalesRule\Model\Resource\Report\Rule\UpdatedatFactory $updatedatFactory + * @param \Magento\Stdlib\DateTime $dateTime + * @param Rule\CreatedatFactory $createdatFactory + * @param Rule\UpdatedatFactory $updatedatFactory */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\Resource $resource, + \Magento\Logger $logger, + \Magento\App\Resource $resource, \Magento\Core\Model\LocaleInterface $locale, \Magento\Reports\Model\FlagFactory $reportsFlagFactory, + \Magento\Stdlib\DateTime $dateTime, \Magento\SalesRule\Model\Resource\Report\Rule\CreatedatFactory $createdatFactory, \Magento\SalesRule\Model\Resource\Report\Rule\UpdatedatFactory $updatedatFactory ) { - parent::__construct($logger, $resource, $locale, $reportsFlagFactory); + parent::__construct($logger, $resource, $locale, $reportsFlagFactory, $dateTime); $this->_createdatFactory = $createdatFactory; $this->_updatedatFactory = $updatedatFactory; } diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule.php b/app/code/Magento/SalesRule/Model/Resource/Rule.php index b3343cae3a3389ac19f4625e84afccee3be66a7c..6867c439781b4810596fcf5f46e57536c97eaa1b 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\SalesRule\Model\Resource; /** * Sales Rule resource model - * - * @category Magento - * @package Magento_SalesRule - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\SalesRule\Model\Resource; - class Rule extends \Magento\Rule\Model\Resource\AbstractResource { /** @@ -55,11 +50,11 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource ); /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * @var \Magento\SalesRule\Model\Resource\Coupon @@ -67,16 +62,16 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource protected $_resourceCoupon; /** - * @param \Magento\Core\Helper\String $coreString - * @param \Magento\Core\Model\Resource $resource - * @param \Magento\SalesRule\Model\Resource\Coupon $resourceCoupon + * @param \Magento\App\Resource $resource + * @param \Magento\Stdlib\String $string + * @param Coupon $resourceCoupon */ public function __construct( - \Magento\Core\Helper\String $coreString, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, + \Magento\Stdlib\String $string, \Magento\SalesRule\Model\Resource\Coupon $resourceCoupon ) { - $this->_coreString = $coreString; + $this->string = $string; $this->_resourceCoupon = $resourceCoupon; parent::__construct($resource); } @@ -202,7 +197,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource $data = array(); foreach ($labels as $storeId => $label) { - if ($this->_coreString->strlen($label)) { + if ($this->string->strlen($label)) { $data[] = array('rule_id' => $ruleId, 'store_id' => $storeId, 'label' => $label); } else { $deleteByStoreIds[] = $storeId; @@ -336,7 +331,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource $result = array(); if (preg_match_all('~s:32:"salesrule/rule_condition_product";s:9:"attribute";s:\d+:"(.*?)"~s', $serializedString, $matches)){ - foreach ($matches[1] as $offset => $attributeCode) { + foreach ($matches[1] as $attributeCode) { $result[] = $attributeCode; } } diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php index 7abb61b1d406c2322843ba03d6dc07caa11aa575..9349188efe893e83b5d773b59b6ab616e5c53be0 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php @@ -61,7 +61,7 @@ class Collection extends \Magento\Rule\Model\Resource\Rule\Collection\AbstractCo /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Date $date @@ -69,7 +69,7 @@ class Collection extends \Magento\Rule\Model\Resource\Rule\Collection\AbstractCo */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Date $date, diff --git a/app/code/Magento/SalesRule/Model/Rule.php b/app/code/Magento/SalesRule/Model/Rule.php index 856b6198ee33ad0c0d4abf81010cf90aac599001..a75c144cb949542eec0ed126d516b5393aeaa6ec 100644 --- a/app/code/Magento/SalesRule/Model/Rule.php +++ b/app/code/Magento/SalesRule/Model/Rule.php @@ -216,7 +216,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\SalesRule\Model\CouponFactory $couponFactory @@ -232,7 +232,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\SalesRule\Model\CouponFactory $couponFactory, diff --git a/app/code/Magento/SalesRule/etc/adminhtml/menu.xml b/app/code/Magento/SalesRule/etc/adminhtml/menu.xml index 4b807151afefff818d50df7885d87864238add70..64edb34a567e441062be829292a95ab331acb58c 100644 --- a/app/code/Magento/SalesRule/etc/adminhtml/menu.xml +++ b/app/code/Magento/SalesRule/etc/adminhtml/menu.xml @@ -27,6 +27,6 @@ --> <config> <menu> - <add id="Magento_SalesRule::promo_quote" title="Cart Price Rules" module="Magento_SalesRule" parent="Magento_CatalogRule::promo" sortOrder="30" action="adminhtml/promo_quote/" dependsOnModule="Magento_Sales" resource="Magento_SalesRule::quote"/> + <add id="Magento_SalesRule::promo_quote" title="Cart Price Rules" module="Magento_SalesRule" parent="Magento_CatalogRule::promo" sortOrder="30" action="sales_rule/promo_quote/" dependsOnModule="Magento_Sales" resource="Magento_SalesRule::quote"/> </menu> </config> diff --git a/app/code/Magento/SalesRule/etc/adminhtml/routes.xml b/app/code/Magento/SalesRule/etc/adminhtml/routes.xml new file mode 100644 index 0000000000000000000000000000000000000000..3c89225e3cc2423bddfe082b03cc1f61c7c3f3ce --- /dev/null +++ b/app/code/Magento/SalesRule/etc/adminhtml/routes.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <router id="admin"> + <route id="sales_rule" frontName="sales_rule"> + <module name="Magento_SalesRule_Adminhtml" before="Magento_Adminhtml" /> + </route> + </router> +</config> diff --git a/app/code/Magento/SalesRule/etc/di.xml b/app/code/Magento/SalesRule/etc/di.xml index 5b7b9e81705b5a8d8aa6c98eff13e9a64eca5c86..5faa35ed43a96cc928c0e65e66ab389853ce7a7e 100644 --- a/app/code/Magento/SalesRule/etc/di.xml +++ b/app/code/Magento/SalesRule/etc/di.xml @@ -33,7 +33,7 @@ <instance type="Magento\Backend\Model\Session\Proxy" /> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <salesrule_setup>Magento\SalesRule\Model\Resource\Setup</salesrule_setup> diff --git a/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_couponsgrid.xml b/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_couponsgrid.xml new file mode 100644 index 0000000000000000000000000000000000000000..545538d2a87a655a604be007e7e1255a647934cf --- /dev/null +++ b/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_couponsgrid.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <container name="root" label="Root" output="1"> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid" name="sales_rule_quote_edit_tab_coupons_grid"/> + </container> +</layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_quote_edit.xml b/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_edit.xml similarity index 69% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_quote_edit.xml rename to app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_edit.xml index d8592195547c11e5404febf3c36d0b5fae7b9c45..18d9e36951a4dcdeff40b4fc340635a4e7423b3d 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_quote_edit.xml +++ b/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_edit.xml @@ -33,14 +33,14 @@ </action> </referenceBlock> <referenceContainer name="left"> - <block class="Magento\Adminhtml\Block\Promo\Quote\Edit\Tabs" name="promo_quote_edit_tabs"> - <block class="Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Main" name="promo_quote_edit_tab_main"/> - <block class="Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Conditions" name="promo_quote_edit_tab_conditions"/> - <block class="Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Actions" name="promo_quote_edit_tab_actions"/> - <block class="Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Labels" name="promo_quote_edit_tab_labels"/> - <block class="Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons" name="promo_quote_edit_tab_coupons"> - <block class="Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Form" name="promo_quote_edit_tab_coupons_form"/> - <block class="Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Grid" name="promo_quote_edit_tab_coupons_grid"/> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tabs" name="promo_quote_edit_tabs"> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Main" name="promo_quote_edit_tab_main"/> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Conditions" name="promo_quote_edit_tab_conditions"/> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Actions" name="promo_quote_edit_tab_actions"/> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Labels" name="promo_quote_edit_tab_labels"/> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons" name="promo_quote_edit_tab_coupons"> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Form" name="promo_quote_edit_tab_coupons_form"/> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid" name="promo_quote_edit_tab_coupons_grid"/> </block> <action method="addTab"> <argument name="name" xsi:type="string">main_section</argument> @@ -63,9 +63,9 @@ <argument name="block" xsi:type="string">promo_quote_edit_tab_coupons</argument> </action> </block> - <block class="Magento\Adminhtml\Block\Template" template="promo/salesrulejs.phtml" name="promo_quote_edit_jsinit"/> + <block class="Magento\Adminhtml\Block\Template" template="Magento_SalesRule::promo/salesrulejs.phtml" name="promo_quote_edit_jsinit"/> </referenceContainer> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Promo\Quote\Edit" name="promo_quote_edit"/> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit" name="promo_quote_edit"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_quote_index.xml b/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_index.xml similarity index 98% rename from app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_quote_index.xml rename to app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_index.xml index e4d417cb8e4fb50fe2c3bfeee15907d0723f6532..a9df29eddce4a883685afc782f3e93d194e51112 100644 --- a/app/code/Magento/Adminhtml/view/adminhtml/layout/adminhtml_promo_quote_index.xml +++ b/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_index.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceContainer name="content"> - <block class="Magento\Adminhtml\Block\Promo\Quote" name="adminhtml.block.promo.quote.grid.container"> + <block class="Magento\SalesRule\Block\Adminhtml\Promo\Quote" name="adminhtml.block.promo.quote.grid.container"> <block class="Magento\Backend\Block\Widget\Grid" name="adminhtml.block.promo.quote.grid" as="grid"> <arguments> <argument name="id" xsi:type="string">promo_quote_grid</argument> @@ -37,7 +37,7 @@ <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="adminhtml.promo.quote.grid.columnSet"> <arguments> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">adminhtml/*/edit</item> + <item name="path" xsi:type="string">sales_rule/*/edit</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="id" xsi:type="string">getRuleId</item> </item> diff --git a/app/code/Magento/Adminhtml/view/adminhtml/promo/salesrulejs.phtml b/app/code/Magento/SalesRule/view/adminhtml/promo/salesrulejs.phtml similarity index 100% rename from app/code/Magento/Adminhtml/view/adminhtml/promo/salesrulejs.phtml rename to app/code/Magento/SalesRule/view/adminhtml/promo/salesrulejs.phtml diff --git a/app/code/Magento/Sendfriend/Controller/Product.php b/app/code/Magento/Sendfriend/Controller/Product.php index 67a3b73b9154fb19a1883beb33a18537b60ec912..3c70dc469fc42bc52e5d8354ec2f1ac7b947897b 100644 --- a/app/code/Magento/Sendfriend/Controller/Product.php +++ b/app/code/Magento/Sendfriend/Controller/Product.php @@ -118,15 +118,20 @@ class Product extends \Magento\Core\Controller\Front\Action */ protected function _initSendToFriendModel() { + /** @var \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress */ + $remoteAddress = $this->_objectManager->get('Magento\HTTP\PhpEnvironment\RemoteAddress'); + + /** @var \Magento\Core\Model\Cookie $cookie */ + $cookie = $this->_objectManager->get('Magento\Core\Model\Cookie'); + + /** @var \Magento\Core\Model\StoreManagerInterface $store */ + $store = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface'); + + /** @var \Magento\Sendfriend\Model\Sendfriend $model */ $model = $this->_objectManager->create('Magento\Sendfriend\Model\Sendfriend'); - $model->setRemoteAddr($this->_objectManager->get('Magento\Core\Helper\Http')->getRemoteAddr(true)); - $model->setCookie($this->_objectManager->get('Magento\Core\Model\Cookie')); - $model->setWebsiteId( - $this->_objectManager - ->get('Magento\Core\Model\StoreManagerInterface') - ->getStore() - ->getWebsiteId() - ); + $model->setRemoteAddr($remoteAddress->getRemoteAddress(true)); + $model->setCookie($cookie); + $model->setWebsiteId($store->getStore()->getWebsiteId()); $this->_coreRegistry->register('send_to_friend_model', $model); diff --git a/app/code/Magento/Sendfriend/Model/Sendfriend.php b/app/code/Magento/Sendfriend/Model/Sendfriend.php index 58fb509322ccb876aaee83a1a5bb6ea1bb03c986..d38fd027750914caebb631c40b1d6bd2399ca627 100644 --- a/app/code/Magento/Sendfriend/Model/Sendfriend.php +++ b/app/code/Magento/Sendfriend/Model/Sendfriend.php @@ -108,6 +108,11 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel */ protected $_storeManager; + /** + * @var \Magento\Escaper + */ + protected $_escaper; + /** * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Email\TemplateFactory $templateFactory @@ -116,6 +121,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel * @param \Magento\Sendfriend\Helper\Data $sendfriendData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Escaper $escaper * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -128,6 +134,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel \Magento\Sendfriend\Helper\Data $sendfriendData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, + \Magento\Escaper $escaper, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -137,6 +144,7 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel $this->_translate = $translate; $this->_catalogImage = $catalogImage; $this->_sendfriendData = $sendfriendData; + $this->_escaper = $escaper; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -176,8 +184,8 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel $message = nl2br(htmlspecialchars($this->getSender()->getMessage())); $sender = array( - 'name' => $this->_getHelper()->escapeHtml($this->getSender()->getName()), - 'email' => $this->_getHelper()->escapeHtml($this->getSender()->getEmail()) + 'name' => $this->_escaper->escapeHtml($this->getSender()->getName()), + 'email' => $this->_escaper->escapeHtml($this->getSender()->getEmail()) ); $mailTemplate->setDesignConfig(array( diff --git a/app/code/Magento/Sendfriend/view/frontend/send.phtml b/app/code/Magento/Sendfriend/view/frontend/send.phtml index 3a8f01f23146c458d4a77883c6ff5da98bd3e963..e429a397b44c7b4efab36d85fe6253001534312b 100644 --- a/app/code/Magento/Sendfriend/view/frontend/send.phtml +++ b/app/code/Magento/Sendfriend/view/frontend/send.phtml @@ -32,7 +32,7 @@ ?> <script id="add-recipient-tmpl" type="text/x-jQuery-tmpl"> <p id="btn-remove${_index_}"> - <a href="delete_email" class="btn-remove" title="<?php echo $this->jsQuoteEscape(__('Remove Email')) ?>"><?php echo $this->jsQuoteEscape(__('Remove Email')) ?>"</a> + <a href="delete_email" class="btn-remove" title="<?php echo $this->escapeJsQuote(__('Remove Email')) ?>"><?php echo $this->escapeJsQuote(__('Remove Email')) ?>"</a> </p> <div class="field"> <label for="recipients-name${_index_}" class="required"><em>*</em> <?php echo __('Name:')?></label> diff --git a/app/code/Magento/Service/AuthorizationException.php b/app/code/Magento/Service/AuthorizationException.php index 353f92dff84ca23a2420065a80bfc0ae154cf9bf..72b3d5a95a8c7453f40b786e2920134ad40a5329 100644 --- a/app/code/Magento/Service/AuthorizationException.php +++ b/app/code/Magento/Service/AuthorizationException.php @@ -34,6 +34,7 @@ class AuthorizationException extends \Magento\Service\Exception * @param int $code * @param \Exception $previous * @param array $parameters + * @param string $name * @param string|int|null $userId * @param string|int|null $resourceId */ @@ -42,7 +43,8 @@ class AuthorizationException extends \Magento\Service\Exception // TODO Specify default exception code when Service \Exception Handling policy is defined $code = 0, \Exception $previous = null, - $parameters = array(), + array $parameters = array(), + $name = 'authorization', $userId = null, $resourceId = null ) { @@ -52,6 +54,6 @@ class AuthorizationException extends \Magento\Service\Exception $message = "User with ID '{$userId}' is not authorized to access resource with ID '{$resourceId}'."; } } - parent::__construct($message, $code, $previous, $parameters); + parent::__construct($message, $code, $previous, $parameters, $name); } } diff --git a/app/code/Magento/Service/Exception.php b/app/code/Magento/Service/Exception.php index 2f8b59f089d54da67d033d3a89e1f2d28ff7dbb1..b24c8839722dd2337dd7410bf3e512bea0a8f025 100644 --- a/app/code/Magento/Service/Exception.php +++ b/app/code/Magento/Service/Exception.php @@ -30,14 +30,27 @@ class Exception extends \Magento\Core\Exception /** @var array */ protected $_parameters; + /** + * Exception name. + * + * @var string + */ + protected $_name; + /** * {@inheritdoc} * @param array $parameters - Array of optional exception parameters. */ - public function __construct($message = "", $code = 0, Exception $previous = null, $parameters = array()) - { + public function __construct( + $message = "", + $code = 0, + \Exception $previous = null, + array $parameters = array(), + $name = '' + ) { parent::__construct($message, $code, $previous); $this->_parameters = $parameters; + $this->_name = $name; } /** @@ -49,4 +62,12 @@ class Exception extends \Magento\Core\Exception { return $this->_parameters; } + + /** + * Retrieve exception name. + */ + public function getName() + { + return $this->_name; + } } diff --git a/app/code/Magento/Service/ResourceNotFoundException.php b/app/code/Magento/Service/ResourceNotFoundException.php index 9ae5ff77f4a18581fc2292307022c43d8c11775b..d10fe8f8189ff8a1328ae98b44595757f62be491 100644 --- a/app/code/Magento/Service/ResourceNotFoundException.php +++ b/app/code/Magento/Service/ResourceNotFoundException.php @@ -34,6 +34,7 @@ class ResourceNotFoundException extends \Magento\Service\Exception * @param int $code * @param \Exception $previous * @param array $parameters + * @param string $name * @param string|int|null $resourceId */ public function __construct( @@ -41,7 +42,8 @@ class ResourceNotFoundException extends \Magento\Service\Exception // TODO Specify default exception code when Service \Exception Handling policy is defined $code = 0, \Exception $previous = null, - $parameters = array(), + array $parameters = array(), + $name = 'resourceNotFound', $resourceId = null ) { if ($resourceId) { @@ -50,6 +52,6 @@ class ResourceNotFoundException extends \Magento\Service\Exception $message = "Resource with ID '{$resourceId}' not found."; } } - parent::__construct($message, $code, $previous, $parameters); + parent::__construct($message, $code, $previous, $parameters, $name); } } diff --git a/app/code/Magento/Shipping/Model/Carrier/Factory.php b/app/code/Magento/Shipping/Model/Carrier/Factory.php index e3fcb024822623f589a8ff0fe87bf5a649c66061..961c01f09fa2109babb67e18f725813984791e5d 100644 --- a/app/code/Magento/Shipping/Model/Carrier/Factory.php +++ b/app/code/Magento/Shipping/Model/Carrier/Factory.php @@ -36,7 +36,7 @@ class Factory protected $_coreStoreConfig; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -47,12 +47,12 @@ class Factory /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\ObjectManager $objectManager */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\ObjectManager $objectManager ) { $this->_coreStoreConfig = $coreStoreConfig; diff --git a/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php b/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php index 9064ae06b184c9165142a97f6de0ff701428383b..e7da13e0cb740aae1ed810849095fc35027e37a6 100644 --- a/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php +++ b/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php @@ -105,7 +105,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_coreConfig; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -131,10 +131,8 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb /** - * Class constructor - * - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Logger $logger + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Shipping\Model\Carrier\Tablerate $carrierTablerate @@ -142,8 +140,8 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\Resource $resource, + \Magento\Logger $logger, + \Magento\App\Resource $resource, \Magento\Core\Model\Config $coreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Shipping\Model\Carrier\Tablerate $carrierTablerate, diff --git a/app/code/Magento/Shipping/Model/Shipping.php b/app/code/Magento/Shipping/Model/Shipping.php index 17a292f11951f7f3f8ae12ba7f79f45504f9f497..4fec3925601079f0f8f89c714b0272d39f57924a 100644 --- a/app/code/Magento/Shipping/Model/Shipping.php +++ b/app/code/Magento/Shipping/Model/Shipping.php @@ -60,13 +60,6 @@ class Shipping */ protected $_availabilityConfigField = 'active'; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * Core store config * @@ -110,7 +103,11 @@ class Shipping protected $_regionFactory; /** - * @param \Magento\Core\Helper\Data $coreData + * @var \Magento\Math\Division + */ + protected $mathDivision; + + /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -119,9 +116,9 @@ class Shipping * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory * @param \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory * @param \Magento\Directory\Model\RegionFactory $regionFactory + * @param \Magento\Math\Division $mathDivision */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -129,9 +126,9 @@ class Shipping \Magento\Shipping\Model\Carrier\Factory $carrierFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory, - \Magento\Directory\Model\RegionFactory $regionFactory + \Magento\Directory\Model\RegionFactory $regionFactory, + \Magento\Math\Division $mathDivision ) { - $this->_coreData = $coreData; $this->_coreStoreConfig = $coreStoreConfig; $this->_shippingConfig = $shippingConfig; $this->_storeManager = $storeManager; @@ -140,6 +137,7 @@ class Shipping $this->_rateResultFactory = $rateResultFactory; $this->_rateRequestFactory = $rateRequestFactory; $this->_regionFactory = $regionFactory; + $this->mathDivision = $mathDivision; } /** @@ -355,7 +353,7 @@ class Shipping if ($itemWeight > $maxWeight) { $qtyItem = floor($itemWeight / $maxWeight); $decimalItems[] = array('weight' => $maxWeight, 'qty' => $qtyItem); - $weightItem = $this->_coreData->getExactDivision($itemWeight, $maxWeight); + $weightItem = $this->mathDivision->getExactDivision($itemWeight, $maxWeight); if ($weightItem) { $decimalItems[] = array('weight' => $weightItem, 'qty' => 1); } diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php index c8f79fca874d46d3b1c2e0285217fd0dd73202bb..753e4250246377f456cf769cc3109be86d02b79d 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php @@ -61,12 +61,12 @@ class Category extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_categoryResource; /** - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Resource\Category $categoryResource */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Resource\Category $categoryResource ) { diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php index 8535f5a72c5ee7315863862c7165d7b8f7b0f81c..184f77343be96d6a608e3987aca8cbc293f0ef92 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php @@ -105,7 +105,7 @@ class Product extends \Magento\Core\Model\Resource\Db\AbstractDb public function __construct( \Magento\Sitemap\Helper\Data $sitemapData, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Catalog\Model\Resource\Product $productResource, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\Visibility $productVisibility, diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index a039fe8e276a3e00e04dd7bbdea2673f66214834..26108921026c19863b3734ada5da7b4dbf780df6 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -24,6 +24,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Sitemap\Model; + /** * Sitemap model * @@ -39,13 +41,7 @@ * @method \Magento\Sitemap\Model\Sitemap setSitemapTime(string $value) * @method int getStoreId() * @method \Magento\Sitemap\Model\Sitemap setStoreId(int $value) - * - * @category Magento - * @package Magento_Sitemap - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sitemap\Model; - class Sitemap extends \Magento\Core\Model\AbstractModel { const OPEN_TAG_KEY = 'start'; @@ -123,11 +119,9 @@ class Sitemap extends \Magento\Core\Model\AbstractModel protected $_sitemapData; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Escaper */ - protected $_coreData; + protected $_escaper; /** * @var \Magento\Sitemap\Model\Resource\Catalog\CategoryFactory @@ -165,7 +159,12 @@ class Sitemap extends \Magento\Core\Model\AbstractModel protected $_request; /** - * @param \Magento\Core\Helper\Data $coreData + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\Escaper $escaper * @param \Magento\Sitemap\Helper\Data $sitemapData * @param \Magento\Core\Model\Context $context * @param \Magento\Filesystem $filesystem @@ -177,12 +176,13 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * @param \Magento\App\Dir $dirModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\RequestInterface $request + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Sitemap\Helper\Data $sitemapData, \Magento\Core\Model\Context $context, \Magento\Filesystem $filesystem, @@ -194,11 +194,12 @@ class Sitemap extends \Magento\Core\Model\AbstractModel \Magento\App\Dir $dirModel, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\RequestInterface $request, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreData = $coreData; + $this->_escaper = $escaper; $this->_sitemapData = $sitemapData; $this->_filesystem = $filesystem; $this->_categoryFactory = $categoryFactory; @@ -208,6 +209,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel $this->_dirModel = $dirModel; $this->_storeManager = $storeManager; $this->_request = $request; + $this->dateTime = $dateTime; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -301,7 +303,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel */ if (!$file->fileExists($realPath, false)) { throw new \Magento\Core\Exception(__('Please create the specified folder "%1" before saving the sitemap.', - $this->_coreData->escapeHtml($this->getSitemapPath()))); + $this->_escaper->escapeHtml($this->getSitemapPath()))); } if (!$file->isWriteable($realPath)) { @@ -400,8 +402,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel */ protected function _getCurrentDateTime() { - $date = new \Magento\Date(); - return $date->now(); + return $this->dateTime->now(); } /** @@ -500,7 +501,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * * @param string $fileName * @param string $type - * @return void + * @throws \Magento\Core\Exception */ protected function _createSitemap($fileName = null, $type = self::TYPE_URL) { diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php index c1a878029c938de2498e3ccfe1469932a8400ec1..5316acc056b9004be7c28abd9e256a769a3ad605 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php @@ -82,7 +82,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Tax\Model\Calculation\Rate $rate * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -95,7 +95,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Tax\Model\Calculation\Rate $rate, \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Title/Fieldset.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Title/Fieldset.php index aadfa9144b39fb735bbc7df41f4c4cd7a737d3bd..e567043788844da6175c32f7d8695cd268bda397 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Title/Fieldset.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Title/Fieldset.php @@ -41,20 +41,20 @@ class Fieldset extends \Magento\Data\Form\Element\Fieldset /** * @param \Magento\Tax\Block\Adminhtml\Rate\Title $title - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( \Magento\Tax\Block\Adminhtml\Rate\Title $title, - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { $this->_title = $title; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); } public function getBasicChildrenHtml() diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php index 7a1e8e439a67cd55ab7a701b10399288fdc292a8..4902c5520df40cebefd3bd039099cd4ca19ac384 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php @@ -39,7 +39,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Tax\Model\Calculation\RateFactory $rateFactory * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -47,7 +47,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic public function __construct( \Magento\Tax\Model\Calculation\RateFactory $rateFactory, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Tax.php b/app/code/Magento/Tax/Controller/Adminhtml/Tax.php index acf972ee6b53eed32936e358c6e6af33900bfc83..ee63bfce948fb7590e07292439ed7fa05363a428 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Tax.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Tax.php @@ -131,7 +131,7 @@ class Tax extends \Magento\Backend\Controller\Adminhtml\Action */ protected function _processClassName($className) { - $className = trim($this->_objectManager->get('Magento\Tax\Helper\Data')->escapeHtml($className)); + $className = trim($this->_objectManager->get('Magento\Escaper')->escapeHtml($className)); if ($className == '') { throw new \Magento\Core\Exception(__('Invalid name of tax class specified.')); } diff --git a/app/code/Magento/Tax/Model/Calculation.php b/app/code/Magento/Tax/Model/Calculation.php index 140bd00ef61d82cf2ff921e7e4b5783c9a0db4b8..59748ea26dc67a291f069d52ecf6e2ab155916f4 100644 --- a/app/code/Magento/Tax/Model/Calculation.php +++ b/app/code/Magento/Tax/Model/Calculation.php @@ -352,8 +352,8 @@ class Calculation extends \Magento\Core\Model\AbstractModel $shippingAddress = null, $billingAddress = null, $customerTaxClass = null, - $store = null) - { + $store = null + ) { if ($shippingAddress === false && $billingAddress === false && $customerTaxClass === false) { return $this->getRateOriginRequest($store); } @@ -407,6 +407,8 @@ class Calculation extends \Magento\Core\Model\AbstractModel \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_POSTCODE, $store)); break; + default: + break; } if (is_null($customerTaxClass) && $customer) { @@ -492,9 +494,6 @@ class Calculation extends \Magento\Core\Model\AbstractModel /** @var $classes \Magento\Tax\Model\Resource\TaxClass\Collection */ $classes = $this->_classesFactory->create(); $classes->addFieldToFilter('class_type', $type)->load(); - /** @var $namespace Magento\Tax\Model; - -class ClassModel */ foreach ($classes as $class) { $request->setData($fieldName, $class->getId()); $result[$class->getId()] = $this->getRate($request); @@ -556,9 +555,9 @@ class ClassModel */ $taxRate = $taxRate/100; if ($priceIncludeTax) { - $amount = $price*(1-1/(1+$taxRate)); + $amount = $price * (1 - 1 / (1 + $taxRate)); } else { - $amount = $price*$taxRate; + $amount = $price * $taxRate; } if ($round) { @@ -575,10 +574,10 @@ class ClassModel */ * @param int $precision * @return float */ - public function truncate($price, $precision=4) + public function truncate($price, $precision = 4) { - $exp = pow(10,$precision); - $price = floor($price*$exp)/$exp; + $exp = pow(10, $precision); + $price = floor($price * $exp) / $exp; return $price; } @@ -601,6 +600,6 @@ class ClassModel */ */ public function roundUp($price) { - return ceil($price*100)/100; + return ceil($price * 100) / 100; } } diff --git a/app/code/Magento/Tax/Model/Resource/Calculation.php b/app/code/Magento/Tax/Model/Resource/Calculation.php index 9569ab79a6e638fb24046e189b9373db440b1a3f..1f5cd8bcd9b451b1689761509d29834e7b3ebd32 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation.php @@ -63,12 +63,12 @@ class Calculation extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Tax\Helper\Data $taxData, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_taxData = $taxData; $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php index 9bd5ec15ec5823b0a7cd54123f29415915354665..b027c1d22391e1a4e77984ed43892b29945b53b8 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php @@ -39,7 +39,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory @@ -47,7 +47,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, diff --git a/app/code/Magento/Tax/Model/Resource/Report/Collection.php b/app/code/Magento/Tax/Model/Resource/Report/Collection.php index 59befbb9f7680ccd2df6f4bdb3e3bdf35e4d85df..24953e6543b4ddd390f0d8b0c0388750d2f0d1b7 100644 --- a/app/code/Magento/Tax/Model/Resource/Report/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Report/Collection.php @@ -55,14 +55,14 @@ class Collection extends \Magento\Sales\Model\Resource\Report\Collection\Abstrac /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Sales\Model\Resource\Report $resource */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Sales\Model\Resource\Report $resource diff --git a/app/code/Magento/Tax/Model/Resource/Report/Tax.php b/app/code/Magento/Tax/Model/Resource/Report/Tax.php index 28616a75db7c2ad528b558dd26a478cc785b7477..80dbdc669f52301eba08707eb043081c483a399b 100644 --- a/app/code/Magento/Tax/Model/Resource/Report/Tax.php +++ b/app/code/Magento/Tax/Model/Resource/Report/Tax.php @@ -42,24 +42,26 @@ class Tax extends \Magento\Reports\Model\Resource\Report\AbstractReport protected $_updatedAtFactory; /** - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Logger $logger + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Reports\Model\FlagFactory $reportsFlagFactory - * @param \Magento\Tax\Model\Resource\Report\Tax\CreatedatFactory $createdAtFactory - * @param \Magento\Tax\Model\Resource\Report\Tax\UpdatedatFactory $updatedAtFactory + * @param \Magento\Stdlib\DateTime $dateTime + * @param Tax\CreatedatFactory $createdAtFactory + * @param Tax\UpdatedatFactory $updatedAtFactory */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\Resource $resource, + \Magento\Logger $logger, + \Magento\App\Resource $resource, \Magento\Core\Model\LocaleInterface $locale, \Magento\Reports\Model\FlagFactory $reportsFlagFactory, + \Magento\Stdlib\DateTime $dateTime, \Magento\Tax\Model\Resource\Report\Tax\CreatedatFactory $createdAtFactory, \Magento\Tax\Model\Resource\Report\Tax\UpdatedatFactory $updatedAtFactory ) { $this->_createdAtFactory = $createdAtFactory; $this->_updatedAtFactory = $updatedAtFactory; - parent::__construct($logger, $resource, $locale, $reportsFlagFactory); + parent::__construct($logger, $resource, $locale, $reportsFlagFactory, $dateTime); } /** diff --git a/app/code/Magento/Tax/Model/Resource/Setup.php b/app/code/Magento/Tax/Model/Resource/Setup.php index da4554f7713ebb3a07321d4a7842c5d4c9bbdbbf..32c0ca9fb2aa0ef08dcc6de75804402a6e1aa4a7 100644 --- a/app/code/Magento/Tax/Model/Resource/Setup.php +++ b/app/code/Magento/Tax/Model/Resource/Setup.php @@ -38,9 +38,8 @@ class Setup extends \Magento\Sales\Model\Resource\Setup /** * @param \Magento\Core\Model\Resource\Setup\Context $context - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory - * @param \Magento\Core\Helper\Data $coreHelper * @param \Magento\Core\Model\Config $config * @param \Magento\Catalog\Model\Resource\SetupFactory $setupFactory * @param string $resourceName @@ -49,9 +48,8 @@ class Setup extends \Magento\Sales\Model\Resource\Setup */ public function __construct( \Magento\Core\Model\Resource\Setup\Context $context, - \Magento\Core\Model\CacheInterface $cache, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, - \Magento\Core\Helper\Data $coreHelper, \Magento\Core\Model\Config $config, \Magento\Catalog\Model\Resource\SetupFactory $setupFactory, $resourceName, @@ -60,7 +58,7 @@ class Setup extends \Magento\Sales\Model\Resource\Setup ) { $this->_setupFactory = $setupFactory; parent::__construct( - $context, $cache, $attrGrCollFactory, $coreHelper, $config, $resourceName, $moduleName, $connectionName + $context, $cache, $attrGrCollFactory, $config, $resourceName, $moduleName, $connectionName ); } diff --git a/app/code/Magento/Tax/Model/Sales/Order/Tax.php b/app/code/Magento/Tax/Model/Sales/Order/Tax.php index 7f39510114ad111df1f0c9c30c9960b6fc342925..58ebb382b0d94572b30394263ddae9254209efdc 100644 --- a/app/code/Magento/Tax/Model/Sales/Order/Tax.php +++ b/app/code/Magento/Tax/Model/Sales/Order/Tax.php @@ -24,6 +24,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Tax\Model\Sales\Order; + /** * @method \Magento\Tax\Model\Resource\Sales\Order\Tax _getResource() * @method \Magento\Tax\Model\Resource\Sales\Order\Tax getResource() @@ -49,13 +51,7 @@ * @method \Magento\Tax\Model\Sales\Order\Tax setBaseRealAmount(float $value) * @method int getHidden() * @method \Magento\Tax\Model\Sales\Order\Tax setHidden(int $value) - * - * @category Magento - * @package Magento_Tax - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Tax\Model\Sales\Order; - class Tax extends \Magento\Core\Model\AbstractModel { protected function _construct() diff --git a/app/code/Magento/Tax/Model/System/Config/Source/Tax/Region.php b/app/code/Magento/Tax/Model/System/Config/Source/Tax/Region.php index dd5528c09987468e7d89643a5fecb7c6d6e91670..75320418876511270d7d398956f5ae747e8ed0b0 100644 --- a/app/code/Magento/Tax/Model/System/Config/Source/Tax/Region.php +++ b/app/code/Magento/Tax/Model/System/Config/Source/Tax/Region.php @@ -31,14 +31,14 @@ class Region implements \Magento\Core\Model\Option\ArrayInterface protected $_options; /** - * @var \Magento\Directory\Model\Resource\Region\Collection\Factory + * @var \Magento\Directory\Model\Resource\Region\CollectionFactory */ protected $_regionsFactory; /** - * @param \Magento\Directory\Model\Resource\Region\Collection\Factory $regionsFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionsFactory */ - public function __construct(\Magento\Directory\Model\Resource\Region\Collection\Factory $regionsFactory) + public function __construct(\Magento\Directory\Model\Resource\Region\CollectionFactory $regionsFactory) { $this->_regionsFactory = $regionsFactory; } diff --git a/app/code/Magento/Tax/etc/di.xml b/app/code/Magento/Tax/etc/di.xml index 1c1db1c00b2dbc0b4d9237162049fad6e1393d9c..d65374234b681805b207a8ea3a921fbc637211f2 100644 --- a/app/code/Magento/Tax/etc/di.xml +++ b/app/code/Magento/Tax/etc/di.xml @@ -26,10 +26,10 @@ <config> <type name="Magento\Tax\Helper\Data"> <param name="taxConfig"> - <instance type="Magento\Tax\Model\ConfigProxy" /> + <instance type="Magento\Tax\Model\Config\Proxy" /> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <tax_setup>Magento\Tax\Model\Resource\Setup</tax_setup> diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/AbstractTab.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/AbstractTab.php index 7eb0a5dc700cda03d4948ea016387a77cde9d2c0..ab2abbc144056d61a17eac03cebc60238cb48544 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/AbstractTab.php +++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/AbstractTab.php @@ -49,7 +49,7 @@ abstract class AbstractTab protected $_coreRegistry = null; /** - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry @@ -57,7 +57,7 @@ abstract class AbstractTab * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Image.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Image.php index 508abefa80f8a12440bfa9ce60eea52be119d2c6..61a16e2a6c02c0679db5ac999f42c67885d294e0 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Image.php +++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Image.php @@ -37,7 +37,7 @@ class Image extends \Magento\Data\Form\Element\Image protected $_imagePath; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\UrlInterface $urlBuilder @@ -45,7 +45,7 @@ class Image extends \Magento\Data\Form\Element\Image * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\UrlInterface $urlBuilder, @@ -54,7 +54,7 @@ class Image extends \Magento\Data\Form\Element\Image ) { $this->_imagePath = $imagePath; parent::__construct( - $coreData, + $escaper, $factoryElement, $factoryCollection, $urlBuilder, diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Links.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Links.php index a75c4134a8ff710d26cd42749c4a631d823c9ec6..713751ad80ef1fe80011bed0ac2a4964a8624392 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Links.php +++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Links.php @@ -35,18 +35,18 @@ class Links extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('links'); } diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php index 7451577aa517a22ea8ba67de91bb2ef7469af0a4..a05732f064f660f7e6d590da745ce02d208b81bb 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php +++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/Css.php @@ -53,7 +53,7 @@ class Css protected $_customCssFile; /** - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry @@ -62,7 +62,7 @@ class Css * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, @@ -204,7 +204,7 @@ class Css \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE )) . "', null, null,'" - . $this->quoteEscape( + . $this->escapeQuote( __('Upload Images'), true ) . "');" @@ -228,7 +228,7 @@ class Css \Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE => \Magento\Theme\Model\Wysiwyg\Storage::TYPE_FONT )) . "', null, null,'" - . $this->quoteEscape( + . $this->escapeQuote( __('Upload Fonts'), true ) . "');", diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/General.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/General.php index 7cf6e9486f7a0316bcf9d0ca472a93a7e3f3b039..cc6c7279f2d909dc1599bd54e0ba7f1f4830d492 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/General.php +++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Tab/General.php @@ -52,7 +52,7 @@ class General protected $_fileSize; /** - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry @@ -62,7 +62,7 @@ class General * @param array $data */ public function __construct( - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, diff --git a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php index 22aeb30ec457ae4f9e8a40f9d309e2d15e789361..6644a2b938a91b11038e338ded1fb9de34fc30f5 100644 --- a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php +++ b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php @@ -55,7 +55,6 @@ class Theme extends \Magento\Backend\Controller\Adminhtml\Action */ public function indexAction() { - $this->_eventManager->dispatch('theme_registration_from_filesystem'); $this->loadLayout(); $this->_setActiveMenu('Magento_Theme::system_design_theme'); $this->renderLayout(); @@ -109,7 +108,7 @@ class Theme extends \Magento\Backend\Controller\Adminhtml\Action $this->_redirect('adminhtml/*/'); } catch (\Exception $e) { $this->_getSession()->addError(__('We cannot find the theme.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_redirect('adminhtml/*/'); } } @@ -164,7 +163,7 @@ class Theme extends \Magento\Backend\Controller\Adminhtml\Action $redirectBack = true; } catch (\Exception $e) { $this->_getSession()->addError('The theme was not saved'); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $redirectBack ? $this->_redirect('adminhtml/*/edit', array('id' => $theme->getId())) @@ -197,7 +196,7 @@ class Theme extends \Magento\Backend\Controller\Adminhtml\Action $this->_getSession()->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addException($e, __('We cannot delete the theme.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } /** * @todo Temporary solution. Theme module should not know about the existence of editor module. @@ -219,7 +218,7 @@ class Theme extends \Magento\Backend\Controller\Adminhtml\Action $result = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('We cannot upload the CSS file.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); } @@ -259,7 +258,7 @@ class Theme extends \Magento\Backend\Controller\Adminhtml\Action $result = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('We cannot upload the JS file.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); } @@ -295,7 +294,7 @@ class Theme extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Exception $e) { $this->_getSession()->addException($e, __('We cannot find file')); $this->_redirectUrl($this->_getRefererUrl()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } @@ -331,7 +330,7 @@ class Theme extends \Magento\Backend\Controller\Adminhtml\Action } catch (\Exception $e) { $this->_getSession()->addException($e, __('We cannot find file "%1".', $fileName)); $this->_redirectUrl($this->_getRefererUrl()); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } } diff --git a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php index 9a96b37897c2bcb2d34f04b76b9d9d8f9752f03e..ccff57a2870f577ea4012f683b138dc9eaf38709 100644 --- a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php +++ b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php @@ -51,7 +51,7 @@ class Files extends \Magento\Backend\Controller\Adminhtml\Action ->getTreeJson($this->_getStorage()->getTreeArray()) ); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode(array())); } } @@ -69,7 +69,7 @@ class Files extends \Magento\Backend\Controller\Adminhtml\Action $result = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('Sorry, there was an unknown error.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); } @@ -135,7 +135,7 @@ class Files extends \Magento\Backend\Controller\Adminhtml\Action 'value' => $helper->getThumbnailPath($file) )); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_redirect('core/index/notfound'); } } diff --git a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php index 709dc0fb192c5766c633ecb03731683f1c690af2..7929bdb736c32b8bc5a1e5928aef5d459acbd28a 100644 --- a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php +++ b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php @@ -163,7 +163,7 @@ class Storage $image->resize(self::THUMBNAIL_WIDTH, self::THUMBNAIL_HEIGHT); $image->save($thumbnailPath); } catch (\Magento\Filesystem\FilesystemException $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); return false; } diff --git a/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_wysiwyg_files_index.xml b/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_wysiwyg_files_index.xml index fe1a7f0658c4b8458ffbb5e38b07536b5726db37..20268273479a4452d71bae55dc27a6a811517181 100644 --- a/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_wysiwyg_files_index.xml +++ b/app/code/Magento/Theme/view/adminhtml/layout/adminhtml_system_design_wysiwyg_files_index.xml @@ -27,7 +27,7 @@ <remove name="footer"/> <remove name="head"/> <referenceContainer name="left"> - <block class="Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Tree" name="wysiwyg_files.tree" template="Magento_Adminhtml::cms/browser/tree.phtml"/> + <block class="Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Tree" name="wysiwyg_files.tree" template="Magento_Cms::browser/tree.phtml"/> </referenceContainer> <referenceContainer name="content"> <block class="Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content" name="wysiwyg_files.content" template="browser/content.phtml"> diff --git a/app/code/Magento/Usa/Block/Adminhtml/Dhl/Unitofmeasure.php b/app/code/Magento/Usa/Block/Adminhtml/Dhl/Unitofmeasure.php index 2efb59c5ae12c2ba9e283adf9ebf001c6349037c..71676825d0b9254c96f38f01a9eabcec536d8f4c 100644 --- a/app/code/Magento/Usa/Block/Adminhtml/Dhl/Unitofmeasure.php +++ b/app/code/Magento/Usa/Block/Adminhtml/Dhl/Unitofmeasure.php @@ -80,17 +80,17 @@ class Unitofmeasure extends \Magento\Backend\Block\System\Config\Form\Field $carrierModel = $this->_shippingDhl; - $this->setInch($this->jsQuoteEscape($carrierModel->getCode('unit_of_dimension_cut', 'I'))); - $this->setCm($this->jsQuoteEscape($carrierModel->getCode('unit_of_dimension_cut', 'C'))); + $this->setInch($this->escapeJsQuote($carrierModel->getCode('unit_of_dimension_cut', 'I'))); + $this->setCm($this->escapeJsQuote($carrierModel->getCode('unit_of_dimension_cut', 'C'))); - $this->setHeight($this->jsQuoteEscape($carrierModel->getCode('dimensions', 'height'))); - $this->setDepth($this->jsQuoteEscape($carrierModel->getCode('dimensions', 'depth'))); - $this->setWidth($this->jsQuoteEscape($carrierModel->getCode('dimensions', 'width'))); + $this->setHeight($this->escapeJsQuote($carrierModel->getCode('dimensions', 'height'))); + $this->setDepth($this->escapeJsQuote($carrierModel->getCode('dimensions', 'depth'))); + $this->setWidth($this->escapeJsQuote($carrierModel->getCode('dimensions', 'width'))); $kgWeight = 70; $this->setDivideOrderWeightNoteKg( - $this->jsQuoteEscape(__('This allows breaking total order weight into smaller pieces if it exceeds %1 %2 to ensure accurate calculation of shipping charges.', $kgWeight, 'kg')) + $this->escapeJsQuote(__('This allows breaking total order weight into smaller pieces if it exceeds %1 %2 to ensure accurate calculation of shipping charges.', $kgWeight, 'kg')) ); $weight = round( @@ -98,7 +98,7 @@ class Unitofmeasure extends \Magento\Backend\Block\System\Config\Form\Field $kgWeight, \Zend_Measure_Weight::KILOGRAM, \Zend_Measure_Weight::POUND), 3); $this->setDivideOrderWeightNoteLbp( - $this->jsQuoteEscape(__('This allows breaking total order weight into smaller pieces if it exceeds %1 %2 to ensure accurate calculation of shipping charges.', $weight, 'pounds')) + $this->escapeJsQuote(__('This allows breaking total order weight into smaller pieces if it exceeds %1 %2 to ensure accurate calculation of shipping charges.', $weight, 'pounds')) ); $this->setTemplate('dhl/unitofmeasure.phtml'); diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php index be0ce2b8ee4e284af167c5479487967ce1989a18..192ef5a1199030bcf6417e0d5a19a4fef993db5d 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Usa\Model\Shipping\Carrier; /** * DHL shipping implementation - * - * @category Magento - * @package Magento_Usa - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Usa\Model\Shipping\Carrier; - class Dhl extends \Magento\Usa\Model\Shipping\Carrier\AbstractCarrier implements \Magento\Shipping\Model\Carrier\CarrierInterface @@ -121,19 +116,18 @@ class Dhl * * @var \Magento\Usa\Helper\Data */ - protected $_usaData = null; + protected $_usaData; /** - * Core string + * Magento string lib * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * Dhl constructor * - * @param \Magento\Core\Helper\String $coreString * @param \Magento\Usa\Helper\Data $usaData * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory @@ -148,11 +142,12 @@ class Dhl * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Stdlib\String $string * @param array $data + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Helper\String $coreString, \Magento\Usa\Helper\Data $usaData, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, @@ -167,9 +162,10 @@ class Dhl \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Stdlib\String $string, array $data = array() ) { - $this->_coreString = $coreString; + $this->string = $string; $this->_usaData = $usaData; parent::__construct( $xmlElFactory, $rateFactory, $rateMethodFactory, $trackFactory, $trackErrorFactory, $trackStatusFactory, @@ -394,9 +390,7 @@ class Dhl $r->setValue(round($request->getPackageValue(), 2)); $r->setValueWithDiscount($request->getPackageValueWithDiscount()); $r->setCustomsValue($request->getPackageCustomsValue()); - $r->setDestStreet( - $this->_coreString->substr(str_replace("\n", '', $request->getDestStreet()), 0, 35) - ); + $r->setDestStreet($this->string->substr(str_replace("\n", '', $request->getDestStreet()), 0, 35)); $r->setDestStreetLine2($request->getDestStreetLine2()); $r->setDestCity($request->getDestCity()); $r->setOrigCompanyName($request->getOrigCompanyName()); @@ -406,8 +400,10 @@ class Dhl $r->setOrigEmail($this->_coreStoreConfig->getConfig('trans_email/ident_general/email', $r->getStoreId())); $r->setOrigCity($request->getOrigCity()); $r->setOrigPostal($request->getOrigPostal()); - $originStreet1 = $this->_coreStoreConfig->getConfig(\Magento\Shipping\Model\Shipping::XML_PATH_STORE_ADDRESS1,$r->getStoreId()); - $originStreet2 = $this->_coreStoreConfig->getConfig(\Magento\Shipping\Model\Shipping::XML_PATH_STORE_ADDRESS2, $r->getStoreId()); + $originStreet1 = $this->_coreStoreConfig + ->getConfig(\Magento\Shipping\Model\Shipping::XML_PATH_STORE_ADDRESS1, $r->getStoreId()); + $originStreet2 = $this->_coreStoreConfig + ->getConfig(\Magento\Shipping\Model\Shipping::XML_PATH_STORE_ADDRESS2, $r->getStoreId()); $r->setOrigStreet($request->getOrigStreet() ? $request->getOrigStreet() : $originStreet2); $r->setOrigStreetLine2($request->getOrigStreetLine2()); $r->setDestPhoneNumber($request->getDestPhoneNumber()); @@ -430,7 +426,7 @@ class Dhl //for DHL, puero rico state for US will assume as puerto rico country //for puerto rico, dhl will ship as international if ($destCountry == self::USA_COUNTRY_ID && ($request->getDestPostcode() == '00912' - || $request->getDestRegionCode() == self::PUERTORICO_COUNTRY_ID) + || $request->getDestRegionCode() == self::PUERTORICO_COUNTRY_ID) ) { $destCountry = self::PUERTORICO_COUNTRY_ID; } diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php index 2b3e4bbeb9f32680c54b1c8aa01aba75a17e59e9..8dc452b343fb43bf938fad21ca74025b4bc916d1 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Usa\Model\Shipping\Carrier\Dhl; + /** * DHL International (API v1.4) - * - * @category Magento - * @package Magento_Usa - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Usa\Model\Shipping\Carrier\Dhl; - class International extends \Magento\Usa\Model\Shipping\Carrier\AbstractCarrier implements \Magento\Shipping\Model\Carrier\CarrierInterface @@ -158,23 +154,16 @@ class International /** * Core string * - * @var \Magento\Core\Helper\String + * @var \Magento\Stdlib\String */ - protected $_coreString = null; + protected $string; /** * Usa data * * @var \Magento\Usa\Helper\Data */ - protected $_usaData = null; - - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; + protected $_usaData; /** * @var \Magento\Core\Model\Date @@ -192,21 +181,29 @@ class International protected $_storeManager; /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_configReader; + /** + * @var \Magento\Math\Division + */ + protected $mathDivision; + + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * Dhl International Class constructor * * Sets necessary data * - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Usa\Helper\Data $usaData - * @param \Magento\Core\Helper\String $coreString * @param \Magento\Core\Model\Date $coreDate * @param \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\PdfFactory $pdfFactory - * @param \Magento\Core\Model\Config\Modules\Reader $configReader + * @param \Magento\Module\Dir\Reader $configReader * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory @@ -221,16 +218,17 @@ class International * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Stdlib\String $string + * @param \Magento\Math\Division $mathDivision + * @param \Magento\Stdlib\DateTime $dateTime * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Usa\Helper\Data $usaData, - \Magento\Core\Helper\String $coreString, \Magento\Core\Model\Date $coreDate, \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\PdfFactory $pdfFactory, - \Magento\Core\Model\Config\Modules\Reader $configReader, + \Magento\Module\Dir\Reader $configReader, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, @@ -245,15 +243,19 @@ class International \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Stdlib\String $string, + \Magento\Math\Division $mathDivision, + \Magento\Stdlib\DateTime $dateTime, array $data = array() ) { - $this->_coreData = $coreData; $this->_usaData = $usaData; - $this->_coreString = $coreString; $this->_coreDate = $coreDate; $this->_pdfFactory = $pdfFactory; $this->_storeManager = $storeManager; $this->_configReader = $configReader; + $this->string = $string; + $this->mathDivision = $mathDivision; + $this->dateTime = $dateTime; parent::__construct( $xmlElFactory, $rateFactory, $rateMethodFactory, $trackFactory, $trackErrorFactory, $trackStatusFactory, $regionFactory, $countryFactory, $currencyFactory, $directoryData, $coreStoreConfig, $rateErrorFactory, @@ -414,8 +416,7 @@ class International $requestObject->setValue(round($request->getPackageValue(), 2)) ->setValueWithDiscount($request->getPackageValueWithDiscount()) ->setCustomsValue($request->getPackageCustomsValue()) - ->setDestStreet( - $this->_coreString->substr(str_replace("\n", '', $request->getDestStreet()), 0, 35)) + ->setDestStreet($this->string->substr(str_replace("\n", '', $request->getDestStreet()), 0, 35)) ->setDestStreetLine2($request->getDestStreetLine2()) ->setDestCity($request->getDestCity()) ->setOrigCompanyName($request->getOrigCompanyName()) @@ -713,7 +714,7 @@ class International if ($itemWeight > $maxWeight) { $qtyItem = floor($itemWeight / $maxWeight); $decimalItems[] = array('weight' => $maxWeight, 'qty' => $qtyItem); - $weightItem = $this->_coreData->getExactDivision($itemWeight, $maxWeight); + $weightItem = $this->mathDivision->getExactDivision($itemWeight, $maxWeight); if ($weightItem) { $decimalItems[] = array('weight' => $weightItem, 'qty' => 1); } @@ -904,7 +905,7 @@ class International $nodeBkgDetails = $nodeGetQuote->addChild('BkgDetails'); $nodeBkgDetails->addChild('PaymentCountryCode', $rawRequest->getOrigCountryId()); - $nodeBkgDetails->addChild('Date', \Magento\Date::now(true)); + $nodeBkgDetails->addChild('Date', $this->dateTime->now(true)); $nodeBkgDetails->addChild('ReadyTime', 'PT' . (int)(string)$this->getConfigData('ready_time') . 'H00M'); $nodeBkgDetails->addChild('DimensionUnit', $this->_getDimensionUnit()); @@ -1374,7 +1375,7 @@ class International $nodeConsignee->addChild('CompanyName', substr($companyName, 0, 35)); $address = $rawRequest->getRecipientAddressStreet1(). ' ' . $rawRequest->getRecipientAddressStreet2(); - $address = $this->_coreString->strSplit($address, 35, false, true); + $address = $this->string->split($address, 35, false, true); if (is_array($address)) { foreach ($address as $addressLine) { $nodeConsignee->addChild('AddressLine', $addressLine); @@ -1433,7 +1434,7 @@ class International $nodeShipper->addChild('RegisteredAccount', (string)$this->getConfigData('account')); $address = $rawRequest->getShipperAddressStreet1(). ' ' . $rawRequest->getShipperAddressStreet2(); - $address = $this->_coreString->strSplit($address, 35, false, true); + $address = $this->string->split($address, 35, false, true); if (is_array($address)) { foreach ($address as $addressLine) { $nodeShipper->addChild('AddressLine', $addressLine); diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php index c813d6a761eaebe9a1c0253ba17cdadf91dfc83c..b1a6ee177fcd87abe158a6ab6f0fd3d6b3932cab 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php @@ -43,37 +43,27 @@ class Page extends \Zend_Pdf_Page const ALIGN_CENTER = 'center'; /** - * Dhl International Label Creation Class Pdf Page constructor - * Create/Make a copy of pdf page - * - * @param \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\Page|string $param1 - * @param null $param2 - * @param null $param3 + * @var \Magento\Stdlib\String */ + protected $string; + /** * Dhl International Label Creation Class Pdf Page constructor * * Create/Make a copy of pdf page * - * @param \Magento\Core\Helper\String $coreString + * @param \Magento\Stdlib\String $string * @param \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\Page|string $param1 * @param null $param2 * @param null $param3 */ - /** - * Core string - * - * @var \Magento\Core\Helper\String - */ - protected $_coreString = null; - public function __construct( - \Magento\Core\Helper\String $coreString, + \Magento\Stdlib\String $string, $param1, $param2 = null, $param3 = null ) { - $this->_coreString = $coreString; + $this->string = $string; if ($param1 instanceof \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\Pdf\Page && $param2 === null && $param3 === null ) { @@ -162,7 +152,7 @@ class Page extends \Zend_Pdf_Page { foreach ($lines as $line) { if (strlen($line) > $maxWidth) { - $subLines = $this->_coreString->strSplit($line, $maxWidth, true, true); + $subLines = $this->string->split($line, $maxWidth, true, true); $y = $this->drawLines(array_filter($subLines), $x, $y, $maxWidth, $align); continue; } diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php index 18a8665a6fdb5f6d14bb8839330f1752a0b4bbad..29135f27d94e511a3adf8c5e34802b94e03b595e 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php @@ -121,7 +121,7 @@ class Fedex protected $_storeManager; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -131,9 +131,9 @@ class Fedex protected $_productCollFactory; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Config\Modules\Reader $configReader + * @param \Magento\Module\Dir\Reader $configReader * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory @@ -152,9 +152,9 @@ class Fedex * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Config\Modules\Reader $configReader, + \Magento\Module\Dir\Reader $configReader, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php index d2d6c912936d8b7bd15331cf2132634d460dc479..8e1da4093041a8c6cca4178855c6258332036d65 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php @@ -130,12 +130,12 @@ class Ups protected $_locale; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Usa\Model\Simplexml\ElementFactory $simpleXmlElementFactory * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory @@ -156,7 +156,7 @@ class Ups * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Usa\Model\Simplexml\ElementFactory $simpleXmlElementFactory, \Magento\Core\Model\LocaleInterface $locale, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, diff --git a/app/code/Magento/User/Block/User/Edit/Tab/Main.php b/app/code/Magento/User/Block/User/Edit/Tab/Main.php index f7f6410a4b0a1b722e73c6271e4d215448df0298..8d13d2014d9bcd3ff5fc396273649d9666c56015 100644 --- a/app/code/Magento/User/Block/User/Edit/Tab/Main.php +++ b/app/code/Magento/User/Block/User/Edit/Tab/Main.php @@ -48,7 +48,7 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic * * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\LocaleInterface $locale @@ -56,7 +56,7 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Model\Auth\Session $authSession, diff --git a/app/code/Magento/User/Controller/Adminhtml/Auth.php b/app/code/Magento/User/Controller/Adminhtml/Auth.php index d01a33e2fdf72c69a426b722f837d897064e9c57..428ac09fa8612fae64ad73b2a4aa6ad4cfecf9f3 100644 --- a/app/code/Magento/User/Controller/Adminhtml/Auth.php +++ b/app/code/Magento/User/Controller/Adminhtml/Auth.php @@ -82,7 +82,7 @@ class Auth extends \Magento\Backend\Controller\AbstractAction } // @codingStandardsIgnoreStart $this->_getSession() - ->addSuccess(__('If there is an account associated with %1 you will receive an email with a link to reset your password.', $this->_objectManager->get('Magento\User\Helper\Data')->escapeHtml($email))); + ->addSuccess(__('If there is an account associated with %1 you will receive an email with a link to reset your password.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($email))); // @codingStandardsIgnoreEnd $this->getResponse()->setRedirect( $this->_objectManager->get('Magento\Backend\Helper\Data')->getHomePageUrl() diff --git a/app/code/Magento/User/Helper/Data.php b/app/code/Magento/User/Helper/Data.php index d21a961faff58702bd9bfca0fbcf6147cf2b8226..b5df4417d5b7bf9fad1a172a7a97d098cbd2c94e 100644 --- a/app/code/Magento/User/Helper/Data.php +++ b/app/code/Magento/User/Helper/Data.php @@ -42,29 +42,27 @@ class Data extends \Magento\Core\Helper\AbstractHelper = 'admin/emails/password_reset_link_expiration_period'; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Core\Model\Config */ - protected $_coreData = null; + protected $_coreConfig; /** - * @var \Magento\Core\Model\Config + * @var \Magento\Math\Random */ - protected $_coreConfig; + protected $mathRandom; /** - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Helper\Context $context * @param \Magento\Core\Model\Config $coreConfig + * @param \Magento\Math\Random $mathRandom */ public function __construct( - \Magento\Core\Helper\Data $coreData, \Magento\Core\Helper\Context $context, - \Magento\Core\Model\Config $coreConfig + \Magento\Core\Model\Config $coreConfig, + \Magento\Math\Random $mathRandom ) { - $this->_coreData = $coreData; $this->_coreConfig = $coreConfig; + $this->mathRandom = $mathRandom; parent::__construct($context); } @@ -75,7 +73,7 @@ class Data extends \Magento\Core\Helper\AbstractHelper */ public function generateResetPasswordLinkToken() { - return $this->_coreData->uniqHash(); + return $this->mathRandom->getUniqueHash(); } /** diff --git a/app/code/Magento/User/Model/Acl/Loader/Role.php b/app/code/Magento/User/Model/Acl/Loader/Role.php index e07b95396cbc94e4d0b6f50f0ad3cc176729fc9d..2c41a9960bc4427a8055c38cf2d6c93ebf91f88d 100644 --- a/app/code/Magento/User/Model/Acl/Loader/Role.php +++ b/app/code/Magento/User/Model/Acl/Loader/Role.php @@ -28,7 +28,7 @@ namespace Magento\User\Model\Acl\Loader; class Role implements \Magento\Acl\LoaderInterface { /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; @@ -45,12 +45,12 @@ class Role implements \Magento\Acl\LoaderInterface /** * @param \Magento\User\Model\Acl\Role\GroupFactory $groupFactory * @param \Magento\User\Model\Acl\Role\UserFactory $roleFactory - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\User\Model\Acl\Role\GroupFactory $groupFactory, \Magento\User\Model\Acl\Role\UserFactory $roleFactory, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_resource = $resource; $this->_groupFactory = $groupFactory; diff --git a/app/code/Magento/User/Model/Acl/Loader/Rule.php b/app/code/Magento/User/Model/Acl/Loader/Rule.php index 6886a835a0c07cae938b302dbe568044dda8083a..7bcae6600169f37b541cc22c9bb1b678d1eec10c 100644 --- a/app/code/Magento/User/Model/Acl/Loader/Rule.php +++ b/app/code/Magento/User/Model/Acl/Loader/Rule.php @@ -29,19 +29,19 @@ namespace Magento\User\Model\Acl\Loader; class Rule implements \Magento\Acl\LoaderInterface { /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; /** * @param \Magento\Core\Model\Acl\RootResource $rootResource - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param array $data * @SuppressWarnings(PHPMD.UnusedFormalParameter): */ public function __construct( \Magento\Core\Model\Acl\RootResource $rootResource, - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, array $data = array() ) { $this->_resource = $resource; diff --git a/app/code/Magento/User/Model/Resource/Role.php b/app/code/Magento/User/Model/Resource/Role.php index 1d0f6bd887ef1a2e4e8e73d19ce5ba0ce5513666..67d4dd740ab487ee557b3f5a8b4b594db13c2a05 100644 --- a/app/code/Magento/User/Model/Resource/Role.php +++ b/app/code/Magento/User/Model/Resource/Role.php @@ -51,15 +51,21 @@ class Role extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_cache; /** - * Construct - * - * @param \Magento\Core\Model\Resource $resource - * @param \Magento\Core\Model\CacheInterface $cache + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\App\Resource $resource + * @param \Magento\App\CacheInterface $cache + * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( - \Magento\Core\Model\Resource $resource, - \Magento\Core\Model\CacheInterface $cache + \Magento\App\Resource $resource, + \Magento\App\CacheInterface $cache, + \Magento\Stdlib\DateTime $dateTime ) { + $this->dateTime = $dateTime; parent::__construct($resource); $this->_cache = $cache->getFrontend(); } @@ -85,9 +91,9 @@ class Role extends \Magento\Core\Model\Resource\Db\AbstractDb protected function _beforeSave(\Magento\Core\Model\AbstractModel $role) { if (!$role->getId()) { - $role->setCreated($this->formatDate(true)); + $role->setCreated($this->dateTime->formatDate(true)); } - $role->setModified($this->formatDate(true)); + $role->setModified($this->dateTime->formatDate(true)); if ($role->getId() == '') { if ($role->getIdFieldName()) { diff --git a/app/code/Magento/User/Model/Resource/Rules.php b/app/code/Magento/User/Model/Resource/Rules.php index 41cc22425865ba2639a6853d93c94e817952e70c..2169c87f0f7eac7d029d2e18a345f5c81c10e6e2 100644 --- a/app/code/Magento/User/Model/Resource/Rules.php +++ b/app/code/Magento/User/Model/Resource/Rules.php @@ -56,21 +56,21 @@ class Rules extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_aclBuilder; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; /** * @param \Magento\Acl\Builder $aclBuilder - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\Logger $logger + * @param \Magento\App\Resource $resource * @param \Magento\Core\Model\Acl\RootResource $rootResource * @param \Magento\Acl\CacheInterface $aclCache */ public function __construct( \Magento\Acl\Builder $aclBuilder, - \Magento\Core\Model\Logger $logger, - \Magento\Core\Model\Resource $resource, + \Magento\Logger $logger, + \Magento\App\Resource $resource, \Magento\Core\Model\Acl\RootResource $rootResource, \Magento\Acl\CacheInterface $aclCache ) { diff --git a/app/code/Magento/User/Model/Resource/User.php b/app/code/Magento/User/Model/Resource/User.php index 0392936f7fbda44a4b611c2254ea10b5125231c4..3c7b8bf1d2514e7a8a58737c6df54961e97f5a76 100644 --- a/app/code/Magento/User/Model/Resource/User.php +++ b/app/code/Magento/User/Model/Resource/User.php @@ -22,11 +22,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\User\Model\Resource; + /** * ACL user resource */ -namespace Magento\User\Model\Resource; - class User extends \Magento\Core\Model\Resource\Db\AbstractDb { /** @@ -41,21 +41,29 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected $_roleFactory; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * Construct * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource * @param \Magento\Acl\CacheInterface $aclCache * @param \Magento\User\Model\RoleFactory $roleFactory + * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( - \Magento\Core\Model\Resource $resource, + \Magento\App\Resource $resource, \Magento\Acl\CacheInterface $aclCache, - \Magento\User\Model\RoleFactory $roleFactory + \Magento\User\Model\RoleFactory $roleFactory, + \Magento\Stdlib\DateTime $dateTime ) { parent::__construct($resource); $this->_aclCache = $aclCache; $this->_roleFactory = $roleFactory; + $this->dateTime = $dateTime; } /** @@ -98,7 +106,7 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter = $this->_getWriteAdapter(); $data = array( - 'logdate' => now(), + 'logdate' => $this->dateTime->now(), 'lognum' => $user->getLognum() + 1 ); @@ -142,7 +150,7 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb { if (is_numeric($user)) { $userId = $user; - } else if ($user instanceof \Magento\Core\Model\AbstractModel) { + } elseif ($user instanceof \Magento\Core\Model\AbstractModel) { $userId = $user->getUserId(); } else { return null; @@ -176,9 +184,9 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb protected function _beforeSave(\Magento\Core\Model\AbstractModel $user) { if ($user->isObjectNew()) { - $user->setCreated($this->formatDate(true)); + $user->setCreated($this->dateTime->formatDate(true)); } - $user->setModified($this->formatDate(true)); + $user->setModified($this->dateTime->formatDate(true)); return parent::_beforeSave($user); } diff --git a/app/code/Magento/User/Model/Role.php b/app/code/Magento/User/Model/Role.php index ef2c96fe78f2d3c65ed7fdf9ba7964d34272a2a4..e85b6503e40e57884cfeea44adfeac46e8c6b776 100644 --- a/app/code/Magento/User/Model/Role.php +++ b/app/code/Magento/User/Model/Role.php @@ -91,7 +91,7 @@ class Role extends \Magento\Core\Model\AbstractModel public function __wakeup() { parent::__wakeup(); - $objectManager = \Magento\Core\Model\ObjectManager::getInstance(); + $objectManager = \Magento\App\ObjectManager::getInstance(); $this->_userRolesFactory = $objectManager->get('Magento\User\Model\Resource\Role\User\CollectionFactory'); $this->_resource = $objectManager->get('Magento\User\Model\Resource\Role'); $this->_resourceCollection = $objectManager->get('Magento\User\Model\Resource\Role\Collection'); diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php index 2d2f3b918b1543b27946ce4499751b08367782ec..67afa0368fc51a8f4b34e97b9697c6ebe1d6280b 100644 --- a/app/code/Magento/User/Model/User.php +++ b/app/code/Magento/User/Model/User.php @@ -22,6 +22,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\User\Model; + /** * Admin user model * @@ -51,11 +53,7 @@ * @method \Magento\User\Model\User setIsActive(int $value) * @method string getExtra() * @method \Magento\User\Model\User setExtra(string $value) - */ - -namespace Magento\User\Model; - -/** + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.LongVariable) */ @@ -107,13 +105,6 @@ class User /** @var \Magento\Core\Model\Sender */ protected $_sender; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * User data * @@ -134,7 +125,7 @@ class User * @var \Magento\Core\Model\Store\Config */ protected $_coreStoreConfig; - + /** * Factory for validator composite object * @@ -157,19 +148,28 @@ class User protected $_emailInfoFactory; /** - * Construct - * + * @var \Magento\Encryption\EncryptorInterface + */ + protected $_encryptor; + + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\User\Helper\Data $userData - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\Sender $sender * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Validator\Composite\VarienObjectFactory $validatorCompositeFactory * @param \Magento\User\Model\RoleFactory $roleFactory * @param \Magento\Core\Model\Email\InfoFactory $emailInfoFactory * @param \Magento\Core\Model\Email\Template\MailerFactory $mailerFactory + * @param \Magento\Encryption\EncryptorInterface $encryptor + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -181,21 +181,23 @@ class User \Magento\Core\Model\Registry $registry, \Magento\Event\ManagerInterface $eventManager, \Magento\User\Helper\Data $userData, - \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\Sender $sender, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Validator\Composite\VarienObjectFactory $validatorCompositeFactory, \Magento\User\Model\RoleFactory $roleFactory, \Magento\Core\Model\Email\InfoFactory $emailInfoFactory, \Magento\Core\Model\Email\Template\MailerFactory $mailerFactory, + \Magento\Encryption\EncryptorInterface $encryptor, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { + $this->_encryptor = $encryptor; + $this->dateTime = $dateTime; parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_eventManager = $eventManager; $this->_userData = $userData; - $this->_coreData = $coreData; $this->_sender = $sender; $this->_coreStoreConfig = $coreStoreConfig; $this->_validatorComposite = $validatorCompositeFactory; @@ -218,23 +220,22 @@ class User return array_diff($properties, array( '_eventManager', '_sender', - '_coreData', '_userData', '_coreStoreConfig', '_validatorComposite', '_roleFactory', '_emailInfoFactory', '_mailer', + '_encryptor' )); } public function __wakeup() { parent::__wakeup(); - $objectManager = \Magento\Core\Model\ObjectManager::getInstance(); + $objectManager = \Magento\App\ObjectManager::getInstance(); $this->_eventManager = $objectManager->get('Magento\Event\ManagerInterface'); $this->_sender = $objectManager->get('Magento\Core\Model\Sender'); - $this->_coreData = $objectManager->get('Magento\Core\Helper\Data'); $this->_userData = $objectManager->get('Magento\User\Helper\Data'); $this->_coreStoreConfig = $objectManager->get('Magento\Core\Model\Store\Config'); $this->_coreRegistry = $objectManager->get('Magento\Core\Model\Registry'); @@ -242,6 +243,7 @@ class User $this->_roleFactory = $objectManager->get('Magento\User\Model\RoleFactory'); $this->_emailInfoFactory = $objectManager->get('Magento\Core\Model\Email\InfoFactory'); $this->_mailer = $objectManager->get('Magento\Core\Model\Email\Template\MailerFactory'); + $this->_encryptor = $objectManager->get('Magento\Encryption\EncryptorInterface'); } /** @@ -255,7 +257,7 @@ class User 'firstname' => $this->getFirstname(), 'lastname' => $this->getLastname(), 'email' => $this->getEmail(), - 'modified' => now(), + 'modified' => $this->dateTime->now(), 'extra' => serialize($this->getExtra()) ); @@ -554,7 +556,7 @@ class User if ($sensitive && $this->getId() - && $this->_coreData->validateHash($password, $this->getPassword()) + && $this->_encryptor->validateHash($password, $this->getPassword()) ) { if ($this->getIsActive() != '1') { throw new \Magento\Backend\Model\Auth\Exception( @@ -648,7 +650,7 @@ class User */ protected function _getEncodedPassword($password) { - return $this->_coreData->getHash($password, 2); + return $this->_encryptor->getHash($password, 2); } /** @@ -666,8 +668,7 @@ class User throw new \Magento\Core\Exception(__('Please correct the password reset token.')); } $this->setRpToken($newToken); - $currentDate = \Magento\Date::now(); - $this->setRpTokenCreatedAt($currentDate); + $this->setRpTokenCreatedAt($this->dateTime->now()); return $this; } @@ -688,9 +689,8 @@ class User $expirationPeriod = $this->_userData->getResetPasswordLinkExpirationPeriod(); - $currentDate = \Magento\Date::now(); - $currentTimestamp = \Magento\Date::toTimestamp($currentDate); - $tokenTimestamp = \Magento\Date::toTimestamp($linkTokenCreatedAt); + $currentTimestamp = $this->dateTime->toTimestamp($this->dateTime->now()); + $tokenTimestamp = $this->dateTime->toTimestamp($linkTokenCreatedAt); if ($tokenTimestamp > $currentTimestamp) { return true; } diff --git a/app/code/Magento/User/etc/di.xml b/app/code/Magento/User/etc/di.xml index 624736d04c89b86b8cfafb2ae56a0ac881c92312..24e0ff001b426cea975c86f5d9a578ea6b121ec5 100644 --- a/app/code/Magento/User/etc/di.xml +++ b/app/code/Magento/User/etc/di.xml @@ -38,7 +38,7 @@ <instance type="Magento\Core\Model\Acl\Cache\Proxy" /> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <user_setup>Magento\User\Model\Resource\Setup</user_setup> diff --git a/app/code/Magento/Webapi/Controller/Adminhtml/Webapi/User.php b/app/code/Magento/Webapi/Controller/Adminhtml/Webapi/User.php index 360a542d7ec48045fae54dacfae2ed7d7ff2901c..b492bac3412bffe3eaa19293d29798a969bd1943 100644 --- a/app/code/Magento/Webapi/Controller/Adminhtml/Webapi/User.php +++ b/app/code/Magento/Webapi/Controller/Adminhtml/Webapi/User.php @@ -103,7 +103,7 @@ class User extends \Magento\Backend\Controller\AbstractAction // Update title and breadcrumb record. $actionTitle = $user->getId() - ? $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($user->getApiKey()) + ? $this->_objectManager->get('Magento\Escaper')->escapeHtml($user->getApiKey()) : __('New API User'); $this->_title($actionTitle); $this->_addBreadcrumb($actionTitle, $actionTitle); @@ -158,7 +158,7 @@ class User extends \Magento\Backend\Controller\AbstractAction ->addError($e->getMessage()); $redirectBack = true; } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_getSession() ->setWebapiUserData($data) ->addError($e->getMessage()); diff --git a/app/code/Magento/Webapi/Controller/ErrorProcessor.php b/app/code/Magento/Webapi/Controller/ErrorProcessor.php index b9cac601620f25d487cc03add0e107b29b60d439..5d6971b1ba4a45b54ce12c2a950790cda2b52ba0 100644 --- a/app/code/Magento/Webapi/Controller/ErrorProcessor.php +++ b/app/code/Magento/Webapi/Controller/ErrorProcessor.php @@ -45,7 +45,7 @@ class ErrorProcessor /** @var \Magento\Core\Model\App */ protected $_app; - /** @var \Magento\Core\Model\Logger */ + /** @var \Magento\Logger */ protected $_logger; /** @@ -53,12 +53,12 @@ class ErrorProcessor * * @param \Magento\Core\Helper\Data $helper * @param \Magento\Core\Model\App $app - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function __construct( \Magento\Core\Helper\Data $helper, \Magento\Core\Model\App $app, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { $this->_coreHelper = $helper; $this->_app = $app; @@ -90,7 +90,8 @@ class ErrorProcessor $exception->getMessage(), $exception->getCode(), $httpCode, - $exception->getParameters() + $exception->getParameters(), + $exception->getName() ); } else if ($exception instanceof \Magento\Webapi\Exception) { $maskedException = $exception; diff --git a/app/code/Magento/Webapi/Controller/Rest.php b/app/code/Magento/Webapi/Controller/Rest.php index c90f2a46d9b898ac1926e2c5aeaecdcf551a444e..6092263c4820ef175ad8a386e6d55086ba7c4c31 100644 --- a/app/code/Magento/Webapi/Controller/Rest.php +++ b/app/code/Magento/Webapi/Controller/Rest.php @@ -49,11 +49,9 @@ class Rest implements \Magento\App\FrontControllerInterface protected $_oauthHelper; /** - * Initialize dependencies. - * - * @param \Magento\Webapi\Controller\Rest\Request $request - * @param \Magento\Webapi\Controller\Rest\Response $response - * @param \Magento\Webapi\Controller\Rest\Router $router + * @param Rest\Request $request + * @param Rest\Response $response + * @param Rest\Router $router * @param \Magento\ObjectManager $objectManager * @param \Magento\App\State $appState * @param \Magento\Oauth\Service\OauthV1Interface $oauthService @@ -91,7 +89,7 @@ class Rest implements \Magento\App\FrontControllerInterface * Handle REST request * * @param \Magento\App\RequestInterface $request - * @return $this + * @return \Magento\App\ResponseInterface */ public function dispatch(\Magento\App\RequestInterface $request) { @@ -124,7 +122,6 @@ class Rest implements \Magento\App\FrontControllerInterface } catch (\Exception $e) { $this->_response->setException($e); } - $this->_response->sendResponse(); - return $this; + return $this->_response; } } diff --git a/app/code/Magento/Webapi/Controller/Soap.php b/app/code/Magento/Webapi/Controller/Soap.php index 174c12e804fa5374d2b519f2041e9fc2bf2e2908..2d689a2a65cf7cff5e3e7d35de9783451916b464 100644 --- a/app/code/Magento/Webapi/Controller/Soap.php +++ b/app/code/Magento/Webapi/Controller/Soap.php @@ -73,7 +73,7 @@ class Soap implements \Magento\App\FrontControllerInterface * @param \Magento\Webapi\Model\Soap\Server $soapServer * @param \Magento\Webapi\Controller\ErrorProcessor $errorProcessor * @param \Magento\App\State $appState - * @param \Magento\Core\Model\App $application + * @param \Magento\Core\Model\AppInterface $application * @param \Magento\Oauth\Service\OauthV1Interface $oauthService * @param \Magento\Oauth\Helper\Service $oauthHelper */ @@ -84,7 +84,7 @@ class Soap implements \Magento\App\FrontControllerInterface \Magento\Webapi\Model\Soap\Server $soapServer, \Magento\Webapi\Controller\ErrorProcessor $errorProcessor, \Magento\App\State $appState, - \Magento\Core\Model\App $application, + \Magento\Core\Model\AppInterface $application, \Magento\Oauth\Service\OauthV1Interface $oauthService, \Magento\Oauth\Helper\Service $oauthHelper ) { @@ -111,7 +111,7 @@ class Soap implements \Magento\App\FrontControllerInterface /** * @param \Magento\App\RequestInterface $request - * @return $this + * @return \Magento\App\ResponseInterface */ public function dispatch(\Magento\App\RequestInterface $request) { @@ -137,8 +137,7 @@ class Soap implements \Magento\App\FrontControllerInterface } catch (\Exception $e) { $this->_prepareErrorResponse($e); } - $this->_response->sendResponse(); - return $this; + return $this->_response; } /** @@ -171,7 +170,6 @@ class Soap implements \Magento\App\FrontControllerInterface protected function _prepareErrorResponse($exception) { $maskedException = $this->_errorProcessor->maskException($exception); - $soapFault = new \Magento\Webapi\Model\Soap\Fault($this->_application, $maskedException); if ($this->_isWsdlRequest()) { $httpCode = $maskedException->getHttpCode(); $contentType = self::CONTENT_TYPE_WSDL_REQUEST; @@ -181,6 +179,7 @@ class Soap implements \Magento\App\FrontControllerInterface } $this->_setResponseContentType($contentType); $this->_response->setHttpResponseCode($httpCode); + $soapFault = new \Magento\Webapi\Model\Soap\Fault($this->_application, $this->_soapServer, $maskedException); // TODO: Generate list of available URLs when invalid WSDL URL specified $this->_setResponseBody($soapFault->toXml()); } diff --git a/app/code/Magento/Webapi/Controller/Soap/Handler.php b/app/code/Magento/Webapi/Controller/Soap/Handler.php index 6b29872f75ada47b5e45aa50215dbb70405494b7..ec4a301ceed1358264b676cb50df86b48d9095aa 100644 --- a/app/code/Magento/Webapi/Controller/Soap/Handler.php +++ b/app/code/Magento/Webapi/Controller/Soap/Handler.php @@ -63,7 +63,7 @@ class Handler * @param string $operation * @param array $arguments * @return \stdClass|null - * @throws \Magento\Webapi\Exception|LogicException + * @throws \Magento\Webapi\Exception|\LogicException */ public function __call($operation, $arguments) { diff --git a/app/code/Magento/Webapi/Exception.php b/app/code/Magento/Webapi/Exception.php index d61a12f731b0df07d92ad762e9efa309cd225eb1..81dd1fb4f476f6ef2b75f5d41c06c553acfa8d61 100644 --- a/app/code/Magento/Webapi/Exception.php +++ b/app/code/Magento/Webapi/Exception.php @@ -53,6 +53,13 @@ class Exception extends \RuntimeException */ protected $_httpCode; + /** + * Exception name is used for SOAP faults generation. + * + * @var string + */ + protected $_name; + /** * Initialize exception with HTTP code. * @@ -60,10 +67,16 @@ class Exception extends \RuntimeException * @param int $httpCode * @param int $code Error code * @param array $details Additional exception details + * @param string $name Exception name * @throws \InvalidArgumentException */ - public function __construct($message, $code = 0, $httpCode = self::HTTP_BAD_REQUEST, array $details = array()) - { + public function __construct( + $message, + $code = 0, + $httpCode = self::HTTP_BAD_REQUEST, + array $details = array(), + $name = '' + ) { /** Only HTTP error codes are allowed. No success or redirect codes must be used. */ if ($httpCode < 400 || $httpCode > 599) { throw new \InvalidArgumentException(sprintf('The specified HTTP code "%d" is invalid.', $httpCode)); @@ -71,6 +84,7 @@ class Exception extends \RuntimeException parent::__construct($message, $code); $this->_httpCode = $httpCode; $this->_details = $details; + $this->_name = $name; } /** @@ -104,4 +118,14 @@ class Exception extends \RuntimeException { return $this->_details; } + + /** + * Retrieve exception name. + * + * @return string + */ + public function getName() + { + return $this->_name; + } } diff --git a/app/code/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocator.php b/app/code/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocator.php index 4c8308f109e21db87a634a620cc1fb87d7e25d37..80d46cc003b2289f38e391f25dd73d4253ac8e49 100644 --- a/app/code/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocator.php +++ b/app/code/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Webapi') . DIRECTORY_SEPARATOR . 'acl.xsd'; } diff --git a/app/code/Magento/Webapi/Model/Config.php b/app/code/Magento/Webapi/Model/Config.php index 083a4f6644a51d1cd2d0445795656813709ba6ac..f87023a891c784b951d7c1c0f9c4482d73e71b97 100644 --- a/app/code/Magento/Webapi/Model/Config.php +++ b/app/code/Magento/Webapi/Model/Config.php @@ -1,10 +1,6 @@ <?php /** - * Web API Config Model. - * - * This is a parent class for storing information about Web API. Most of it is needed by REST. - * * Magento * * NOTICE OF LICENSE @@ -28,21 +24,15 @@ */ namespace Magento\Webapi\Model; +/** + * Web API Config Model. + * + * This is a parent class for storing information about Web API. Most of it is needed by REST. + */ class Config { const CACHE_ID = 'webapi'; - /**#@+ - * Attributes and nodes used in webapi.xml config. - */ - const ATTR_SERVICE_CLASS = 'class'; - const ATTR_SERVICE_PATH = 'baseUrl'; - const ATTR_SERVICE_METHOD = 'method'; - const ATTR_HTTP_METHOD = 'httpMethod'; - const ATTR_IS_SECURE = 'isSecure'; - const REST_ROUTE = 'rest-route'; - /**#@-*/ - /** * Pattern for Web API interface name. */ @@ -56,64 +46,30 @@ class Config /** * @var \Magento\Webapi\Model\Config\Reader */ - protected $_reader; + protected $_configReader; /** * Module configuration reader * - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_moduleReader; - /** @var \Magento\ObjectManager */ - protected $_objectManager; - /** * @var array */ protected $_services; /** - * @param \Magento\Webapi\Model\Cache\Type $configCacheType - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader - * @param \Magento\ObjectManager $objectManager + * @param Cache\Type $configCacheType + * @param Config\Reader $configReader */ public function __construct( \Magento\Webapi\Model\Cache\Type $configCacheType, - \Magento\Core\Model\Config\Modules\Reader $moduleReader, - \Magento\ObjectManager $objectManager + \Magento\Webapi\Model\Config\Reader $configReader ) { $this->_configCacheType = $configCacheType; - $this->_moduleReader = $moduleReader; - $this->_objectManager = $objectManager; - } - - /** - * Retrieve list of service files from each module - * - * @return array - */ - protected function _getConfigFile() - { - $files = $this->_moduleReader->getConfigurationFiles('webapi.xml'); - return (array)$files; - } - - /** - * Reader object initialization - * - * @return \Magento\Webapi\Model\Config\Reader - */ - protected function _getReader() - { - if (null === $this->_reader) { - $configFiles = $this->_getConfigFile(); - $this->_reader = $this->_objectManager->create( - 'Magento\Webapi\Model\Config\Reader', - array('configFiles' => $configFiles) - ); - } - return $this->_reader; + $this->_configReader = $configReader; } /** @@ -126,13 +82,11 @@ class Config if (null === $this->_services) { $services = $this->_loadFromCache(); if ($services && is_string($services)) { - $data = unserialize($services); + $this->_services = unserialize($services); } else { - $services = $this->_getReader()->getServices(); - $data = $this->_toArray($services); - $this->_saveToCache(serialize($data)); + $this->_services = $this->_configReader->read(); + $this->_saveToCache(serialize($this->_services)); } - $this->_services = isset($data['config']) ? $data['config'] : array(); } return $this->_services; } @@ -156,128 +110,4 @@ class Config $this->_configCacheType->save($data, self::CACHE_ID, array(\Magento\Webapi\Model\Cache\Type::CACHE_TAG)); return $this; } - - /** - * Get node ID of \DOMNode class - * - * @param array $children - Child nodes of a \DOMNode - * @param \DOMNode $child - * @return string - */ - protected function _getNodeId($children, $child) - { - $nodeId = isset($children[self::ATTR_SERVICE_CLASS]) ? $children[self::ATTR_SERVICE_CLASS] : - (isset($children[self::ATTR_SERVICE_METHOD]) ? $children[self::ATTR_SERVICE_METHOD] : $child->nodeName); - - return $nodeId; - } - - /** - * Convert attributes of a \DOMNode into an associative array. - * - * @param \DOMNode $node - * @return array - */ - protected function _getAttributes($node) - { - $attributes = array(); - - if ($node->hasAttributes()) { - foreach ($node->attributes as $attribute) { - $attributes[$attribute->name] = $attribute->value; - } - } - - return $attributes; - } - - /** - * Check the first \DOMNode in a \DOMNodeList of size 1 to see if it's an XML_TEXT_NODE and store it's value. - * - * @param array $result - Associative array of attributes from a \DOMNode - * @param \DOMNodeList $children - Child nodes of a \DOMNode - * @return array|string|null - */ - protected function _checkForTextNode($result, $children) - { - if ($children->length == 1) { - $child = $children->item(0); - if ($child->nodeType == XML_TEXT_NODE) { - $result['value'] = $child->nodeValue; - return count($result) == 1 ? $result['value'] : $result; - } - } - - return null; - } - - /** - * Process all child nodes of a root \DOMNode, establishing all operations, routes, etc. - * - * @param array $result - * @param \DOMNodeList $children - * @return array - */ - protected function _processChildren($result, $children) - { - $group = array(); - - for ($i = 0; $i < $children->length; $i++) { - $child = $children->item($i); - $childAsArray = $this->_toArray($child); - - $nodeId = $this->_getNodeId($childAsArray, $child); - - if (self::REST_ROUTE === $child->nodeName) { - if (!isset($result['methods'])) { - $result['methods'] = array(); - } - - $result['methods'][$nodeId] = isset($result['methods'][$nodeId]) - ? array_merge($result['methods'][$nodeId], $childAsArray) - : $childAsArray; - - if (isset($result['methods'][$nodeId]['value'])) { - $result['methods'][$nodeId]['route'] = $result['methods'][$nodeId]['value']; - unset($result['methods'][$nodeId]['value']); - } - } else { - if (!isset($result[$nodeId])) { - $result[$nodeId] = $childAsArray; - } else { - if (!isset($group[$nodeId])) { - $tmp = $result[$nodeId]; - $result[$nodeId] = array($tmp); - $group[$nodeId] = 1; - } - $result[$nodeId][] = $childAsArray; - } - } - } - - return $result; - } - /** - * Convert elements to array - * - * @param \DOMNode $root - * @return array|string - */ - protected function _toArray($root) - { - $result = $this->_getAttributes($root); - - $children = $root->childNodes; - if ($children) { - $checkResult = $this->_checkForTextNode($result, $children); - if ($checkResult != null) { - return $checkResult; - } - - $result = $this->_processChildren($result, $children); - } - unset($result['#text']); - - return $result; - } } diff --git a/app/code/Magento/Webapi/Model/Config/Converter.php b/app/code/Magento/Webapi/Model/Config/Converter.php new file mode 100644 index 0000000000000000000000000000000000000000..9a513f74208774b420f4eaf1458be76623d39ef1 --- /dev/null +++ b/app/code/Magento/Webapi/Model/Config/Converter.php @@ -0,0 +1,91 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Webapi\Model\Config; + +/** + * Converter of webapi.xml content into array format. + */ +class Converter implements \Magento\Config\ConverterInterface +{ + /**#@+ + * Array keys for config internal representation. + */ + const KEY_SERVICE_CLASS = 'class'; + const KEY_BASE_URL = 'baseUrl'; + const KEY_SERVICE_METHOD = 'method'; + const KEY_IS_SECURE = 'isSecure'; + const KEY_HTTP_METHOD = 'httpMethod'; + const KEY_SERVICE_METHODS = 'methods'; + const KEY_METHOD_ROUTE = 'route'; + /**#@-*/ + + /** + * {@inheritdoc} + */ + public function convert($source) + { + $result = array(); + /** @var \DOMNodeList $services */ + $services = $source->getElementsByTagName('service'); + /** @var \DOMElement $service */ + foreach ($services as $service) { + if ($service->nodeType != XML_ELEMENT_NODE) { + continue; + } + $serviceClass = $service->attributes->getNamedItem('class')->nodeValue; + $result[$serviceClass] = array( + self::KEY_SERVICE_CLASS => $serviceClass, + self::KEY_SERVICE_METHODS => array() + ); + + /** @var \DOMAttr $baseUrlNode */ + $baseUrlNode = $service->attributes->getNamedItem('baseUrl'); + if ($baseUrlNode) { + $result[$serviceClass][self::KEY_BASE_URL] = $baseUrlNode->nodeValue; + } + + /** @var \DOMNodeList $restRoutes */ + $restRoutes = $service->getElementsByTagName('rest-route'); + /** @var \DOMElement $restRoute */ + foreach ($restRoutes as $restRoute) { + if ($restRoute->nodeType != XML_ELEMENT_NODE) { + continue; + } + $httpMethod = $restRoute->attributes->getNamedItem('httpMethod')->nodeValue; + $method = $restRoute->attributes->getNamedItem('method')->nodeValue; + $isSecureAttribute = $restRoute->attributes->getNamedItem('isSecure'); + $isSecure = $isSecureAttribute ? true : false; + $path = (string)$restRoute->nodeValue; + + $result[$serviceClass][self::KEY_SERVICE_METHODS][$method] = array( + self::KEY_HTTP_METHOD => $httpMethod, + self::KEY_SERVICE_METHOD => $method, + self::KEY_METHOD_ROUTE => $path, + self::KEY_IS_SECURE => $isSecure + ); + } + } + return $result; + } +} diff --git a/app/code/Magento/Webapi/Model/Config/Reader.php b/app/code/Magento/Webapi/Model/Config/Reader.php index c0ef43d2b7eba1d99c2fd2a66e603ac340f3f739..345ba22dc3b695e0e6e5259c7dfa278863bd8954 100644 --- a/app/code/Magento/Webapi/Model/Config/Reader.php +++ b/app/code/Magento/Webapi/Model/Config/Reader.php @@ -1,7 +1,5 @@ <?php /** - * Service config data reader. - * * Magento * * NOTICE OF LICENSE @@ -25,80 +23,35 @@ */ namespace Magento\Webapi\Model\Config; -class Reader extends \Magento\Config\AbstractXml +/** + * Service config data reader. + */ +class Reader extends \Magento\Config\Reader\Filesystem { /** - * Get absolute path to the XML-schema file - * - * @return string - */ - public function getSchemaFile() - { - return __DIR__ . '/../etc/webapi.xsd'; - } - - /** - * Extract configuration data from the DOM structure - * - * @param \DOMDocument $dom - * @return array - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _extractData(\DOMDocument $dom) - { - return array(); - } - - /** - * Get XML-contents, initial for merging + * List of id attributes for merge * - * @return string + * @var array */ - protected function _getInitialXml() - { - return '<?xml version="1.0" encoding="utf-8"?><config></config>'; - } - - /** - * Get list of paths to identifiable nodes - * - * @return array - */ - protected function _getIdAttributes() - { - return array(); - } - - /** - * Get Dom configuration model - * @return \Magento\Config\Dom - */ - protected function _getDomConfigModel() - { - if (is_null($this->_domConfig)) { - $this->_domConfig = new \Magento\Webapi\Model\Config\Dom( - $this->_getInitialXml(), - $this->_getIdAttributes() - ); - } - return $this->_domConfig; - } - - /** - * Get if xml files must be runtime validated - * @return boolean - */ - protected function _isRuntimeValidated() - { - return false; - } + protected $_idAttributes = array( + '/config/service' => 'class', + '/config/service/rest-route' => 'method', + ); /** - * Retrieve services - * @return \DOMDocument + * @param \Magento\Config\FileResolverInterface $fileResolver + * @param \Magento\Webapi\Model\Config\Converter $converter + * @param \Magento\Webapi\Model\Config\SchemaLocator $schemeLocator + * @param \Magento\Config\ValidationStateInterface $validationState + * @param string $fileName */ - public function getServices() - { - return $this->_getDomConfigModel()->getDom(); + public function __construct( + \Magento\Config\FileResolverInterface $fileResolver, + \Magento\Webapi\Model\Config\Converter $converter, + \Magento\Webapi\Model\Config\SchemaLocator $schemeLocator, + \Magento\Config\ValidationStateInterface $validationState, + $fileName = 'webapi.xml' + ) { + parent::__construct($fileResolver, $converter, $schemeLocator, $validationState, $fileName); } } diff --git a/app/code/Magento/Core/Model/Resource/Config/SchemaLocator.php b/app/code/Magento/Webapi/Model/Config/SchemaLocator.php similarity index 85% rename from app/code/Magento/Core/Model/Resource/Config/SchemaLocator.php rename to app/code/Magento/Webapi/Model/Config/SchemaLocator.php index a66b53ddaa77cbfe9d75c11daaed5fe791667eb8..7bab4e94acca93177f4a66c4bbdd1e4e80ffdda5 100644 --- a/app/code/Magento/Core/Model/Resource/Config/SchemaLocator.php +++ b/app/code/Magento/Webapi/Model/Config/SchemaLocator.php @@ -1,7 +1,5 @@ <?php /** - * Resource configuration schema locator - * * Magento * * NOTICE OF LICENSE @@ -23,8 +21,11 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Config; +namespace Magento\Webapi\Model\Config; +/** + * Web API config schema locator. + */ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface { /** @@ -42,30 +43,30 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . DIRECTORY_SEPARATOR . 'resources.xsd'; + $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Webapi') . DIRECTORY_SEPARATOR . 'webapi.xsd'; } /** - * Get path to per file validation schema + * Get path to merged config schema * * @return string|null */ - public function getPerFileSchema() + public function getSchema() { - return $this->_perFileSchema; + return $this->_schema; } /** - * Get path to merged config schema + * Get path to per file validation schema * * @return string|null */ - public function getSchema() + public function getPerFileSchema() { - return $this->_schema; + return $this->_perFileSchema; } } diff --git a/app/code/Magento/Webapi/Model/Resource/Acl/Role.php b/app/code/Magento/Webapi/Model/Resource/Acl/Role.php index 18659ae4207c2fe4f9877fa80b000aa2ea80789b..91191d8f165f6d285d5c688a9c6aa58c5fec1813 100644 --- a/app/code/Magento/Webapi/Model/Resource/Acl/Role.php +++ b/app/code/Magento/Webapi/Model/Resource/Acl/Role.php @@ -30,9 +30,9 @@ class Role extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Class constructor. * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ - public function __construct(\Magento\Core\Model\Resource $resource) + public function __construct(\Magento\App\Resource $resource) { parent::__construct($resource); } diff --git a/app/code/Magento/Webapi/Model/Resource/Acl/User.php b/app/code/Magento/Webapi/Model/Resource/Acl/User.php index 4380d41d3c374bc972a647343e5189a6d4f22bcc..19c31bbe61a9cc9320b523d6a0c74978bd55c8a1 100644 --- a/app/code/Magento/Webapi/Model/Resource/Acl/User.php +++ b/app/code/Magento/Webapi/Model/Resource/Acl/User.php @@ -30,9 +30,9 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Class constructor. * - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ - public function __construct(\Magento\Core\Model\Resource $resource) + public function __construct(\Magento\App\Resource $resource) { parent::__construct($resource); } diff --git a/app/code/Magento/Webapi/Model/Rest/Config.php b/app/code/Magento/Webapi/Model/Rest/Config.php index a353fff9714e8bb01a538cb3c15c653a47bef436..a9945dd7603de252d9653ed07e210e6ab7a28dc3 100644 --- a/app/code/Magento/Webapi/Model/Rest/Config.php +++ b/app/code/Magento/Webapi/Model/Rest/Config.php @@ -1,7 +1,5 @@ <?php /** - * Webapi Config Model for Rest. - * * Magento * * NOTICE OF LICENSE @@ -25,6 +23,11 @@ */ namespace Magento\Webapi\Model\Rest; +use \Magento\Webapi\Model\Config\Converter; + +/** + * Webapi Config Model for Rest. + */ class Config { /**#@+ @@ -117,27 +120,19 @@ class Config $routes = array(); foreach ($this->_config->getServices() as $serviceName => $serviceData) { // skip if baseurl is not null and does not match - if ( - !isset($serviceData[\Magento\Webapi\Model\Config::ATTR_SERVICE_PATH]) - || !$serviceBaseUrl - || strcasecmp( - trim($serviceBaseUrl, '/'), - trim($serviceData[\Magento\Webapi\Model\Config::ATTR_SERVICE_PATH], '/') - ) !== 0 + if (!isset($serviceData[Converter::KEY_BASE_URL]) || !$serviceBaseUrl + || strcasecmp(trim($serviceBaseUrl, '/'), trim($serviceData[Converter::KEY_BASE_URL], '/')) !== 0 ) { // baseurl does not match, just skip this service continue; } - foreach ($serviceData['methods'] as $methodName => $methodInfo) { - if (strtoupper($methodInfo[\Magento\Webapi\Model\Config::ATTR_HTTP_METHOD]) - == strtoupper($httpMethod)) { - $secure = isset($methodInfo[\Magento\Webapi\Model\Config::ATTR_IS_SECURE]) - ? $methodInfo[\Magento\Webapi\Model\Config::ATTR_IS_SECURE] : false; - $methodRoute = isset($methodInfo['route']) ? $methodInfo['route'] : ''; + foreach ($serviceData[Converter::KEY_SERVICE_METHODS] as $methodName => $methodInfo) { + if (strtoupper($methodInfo[Converter::KEY_HTTP_METHOD]) == strtoupper($httpMethod)) { + $secure = $methodInfo[Converter::KEY_IS_SECURE]; + $methodRoute = $methodInfo[Converter::KEY_METHOD_ROUTE]; $routes[] = $this->_createRoute( array( - self::KEY_ROUTE_PATH => - $serviceData[\Magento\Webapi\Model\Config::ATTR_SERVICE_PATH] . $methodRoute, + self::KEY_ROUTE_PATH => $serviceData[Converter::KEY_BASE_URL] . $methodRoute, self::KEY_CLASS => $serviceName, self::KEY_METHOD => $methodName, self::KEY_IS_SECURE => $secure diff --git a/app/code/Magento/Webapi/Model/Soap/Config.php b/app/code/Magento/Webapi/Model/Soap/Config.php index dc1053dbdcfc70bfbdae1374a1ee902d11414008..ba7e4285cfa6bdc4e2ce58f141904f8f48fea1f2 100644 --- a/app/code/Magento/Webapi/Model/Soap/Config.php +++ b/app/code/Magento/Webapi/Model/Soap/Config.php @@ -1,7 +1,5 @@ <?php /** - * Webapi Config Model for Soap. - * * Magento * * NOTICE OF LICENSE @@ -25,6 +23,11 @@ */ namespace Magento\Webapi\Model\Soap; +use \Magento\Webapi\Model\Config\Converter; + +/** + * Webapi Config Model for Soap. + */ class Config { /**#@+ @@ -45,7 +48,7 @@ class Config /** @var \Magento\Webapi\Model\Config */ protected $_config; - /** @var \Magento\Core\Model\ObjectManager */ + /** @var \Magento\ObjectManager */ protected $_objectManager; /** @@ -64,13 +67,13 @@ class Config protected $_soapOperations; /** - * @param \Magento\Core\Model\ObjectManager $objectManager + * @param \Magento\ObjectManager $objectManager * @param \Magento\Filesystem $filesystem * @param \Magento\App\Dir $dir * @param \Magento\Webapi\Model\Config $config */ public function __construct( - \Magento\Core\Model\ObjectManager $objectManager, + \Magento\ObjectManager $objectManager, \Magento\Filesystem $filesystem, \Magento\App\Dir $dir, \Magento\Webapi\Model\Config $config @@ -100,13 +103,14 @@ class Config if (null == $this->_soapOperations) { $this->_soapOperations = array(); foreach ($this->getRequestedSoapServices($requestedService) as $serviceData) { - foreach ($serviceData['methods'] as $method => $methodData) { - $class = $serviceData[\Magento\Webapi\Model\Config::ATTR_SERVICE_CLASS]; + foreach ($serviceData[Converter::KEY_SERVICE_METHODS] as $methodData) { + $method = $methodData[Converter::KEY_SERVICE_METHOD]; + $class = $serviceData[Converter::KEY_SERVICE_CLASS]; $operationName = $this->getSoapOperation($class, $method); $this->_soapOperations[$operationName] = array( self::KEY_CLASS => $class, self::KEY_METHOD => $method, - self::KEY_IS_SECURE => $methodData[\Magento\Webapi\Model\Config::ATTR_IS_SECURE] + self::KEY_IS_SECURE => $methodData[Converter::KEY_IS_SECURE] ); } } @@ -127,17 +131,12 @@ class Config if (is_null($this->_soapServices)) { $this->_soapServices = array(); foreach ($this->_config->getServices() as $serviceData) { - $serviceClass = $serviceData[\Magento\Webapi\Model\Config::ATTR_SERVICE_CLASS]; + $serviceClass = $serviceData[Converter::KEY_SERVICE_CLASS]; $reflection = new \ReflectionClass($serviceClass); foreach ($reflection->getMethods() as $method) { // find if method is secure, assume operation is not secure by default - $isSecure = false; $methodName = $method->getName(); - if (isset($serviceData['methods'][$methodName][\Magento\Webapi\Model\Config::ATTR_IS_SECURE])) { - $methodData = $serviceData['methods'][$methodName]; - $isSecure = strtolower($methodData[\Magento\Webapi\Model\Config::ATTR_IS_SECURE]) === 'true'; - } - + $isSecure = $serviceData[Converter::KEY_SERVICE_METHODS][$methodName][Converter::KEY_IS_SECURE]; // TODO: Simplify the structure in SOAP. Currently it is unified in SOAP and REST $this->_soapServices[$serviceClass]['methods'][$methodName] = array( self::KEY_METHOD => $methodName, @@ -179,14 +178,10 @@ class Config /** * Retrieve the list of services corresponding to specified services and their versions. * - * @param array $requestedServices <pre> - * array( - * 'catalogProduct' => 'V1' - * 'customer' => 'V2 - * )<pre/> + * @param array $requestedServices array('FooBarV1', 'OtherBazV2', ...) * @return array Filtered list of services */ - public function getRequestedSoapServices($requestedServices) + public function getRequestedSoapServices(array $requestedServices) { $services = array(); foreach ($requestedServices as $serviceName) { diff --git a/app/code/Magento/Webapi/Model/Soap/Fault.php b/app/code/Magento/Webapi/Model/Soap/Fault.php index 598c18e081ad954611cec2c1f1ad68ffff818f05..5e37f8130a69e269a063578741f35de4a2ea58da 100644 --- a/app/code/Magento/Webapi/Model/Soap/Fault.php +++ b/app/code/Magento/Webapi/Model/Soap/Fault.php @@ -38,10 +38,10 @@ class Fault extends \RuntimeException /**#@+ * Nodes that can appear in Detail node of SOAP fault. */ - const NODE_ERROR_DETAIL_CODE = 'Code'; - const NODE_ERROR_DETAIL_PARAMETERS = 'Parameters'; - const NODE_ERROR_DETAIL_TRACE = 'Trace'; - const NODE_ERROR_DETAILS = 'ErrorDetails'; + const NODE_DETAIL_CODE = 'Code'; + const NODE_DETAIL_PARAMETERS = 'Parameters'; + const NODE_DETAIL_TRACE = 'Trace'; + const NODE_DETAIL_WRAPPER = 'DefaultFault'; /**#@-*/ /** @var string */ @@ -55,7 +55,14 @@ class Fault extends \RuntimeException * * @var array */ - protected $_parameters; + protected $_parameters = array(); + + /** + * Fault name is used for details wrapper node name generation. + * + * @var string + */ + protected $_faultName = ''; /** * Details that are used to generate 'Detail' node of SoapFault. @@ -67,14 +74,19 @@ class Fault extends \RuntimeException /** @var \Magento\Core\Model\App */ protected $_application; + /** @var \Magento\Webapi\Model\Soap\Server */ + protected $_soapServer; + /** * Construct exception. * * @param \Magento\Core\Model\App $application * @param \Magento\Webapi\Exception $previousException + * @param \Magento\Webapi\Model\Soap\Server $soapServer */ public function __construct( \Magento\Core\Model\App $application, + \Magento\Webapi\Model\Soap\Server $soapServer, \Magento\Webapi\Exception $previousException ) { parent::__construct($previousException->getMessage(), $previousException->getCode(), $previousException); @@ -82,6 +94,8 @@ class Fault extends \RuntimeException $this->_parameters = $previousException->getDetails(); $this->_errorCode = $previousException->getCode(); $this->_application = $application; + $this->_soapServer = $soapServer; + $this->_setFaultName($previousException->getName()); } /** @@ -92,13 +106,13 @@ class Fault extends \RuntimeException public function toXml() { if ($this->_application->isDeveloperMode()) { - $this->addDetails(array(self::NODE_ERROR_DETAIL_TRACE => "<![CDATA[{$this->getTraceAsString()}]]>")); + $this->addDetails(array(self::NODE_DETAIL_TRACE => "<![CDATA[{$this->getTraceAsString()}]]>")); } if ($this->getParameters()) { - $this->addDetails(array(self::NODE_ERROR_DETAIL_PARAMETERS => $this->getParameters())); + $this->addDetails(array(self::NODE_DETAIL_PARAMETERS => $this->getParameters())); } if ($this->getErrorCode()) { - $this->addDetails(array(self::NODE_ERROR_DETAIL_CODE => $this->getErrorCode())); + $this->addDetails(array(self::NODE_DETAIL_CODE => $this->getErrorCode())); } return $this->getSoapFaultMessage($this->getMessage(), $this->getSoapCode(), $this->getDetails()); @@ -114,6 +128,33 @@ class Fault extends \RuntimeException return $this->_parameters; } + /** + * Receive SOAP fault name. + * + * @return string + */ + public function getFaultName() + { + return $this->_faultName; + } + + /** + * Define current SOAP fault name. It is used as a name of the wrapper node for SOAP fault details. + * + * @param $exceptionName + */ + protected function _setFaultName($exceptionName) + { + if ($exceptionName) { + $contentType = $this->_application->getRequest()->getHeader('Content-Type'); + /** SOAP action is specified in content type header if content type is application/soap+xml */ + if (preg_match('|application/soap\+xml.+action="(.+)".*|', $contentType, $matches)) { + $soapAction = $matches[1]; + $this->_faultName = ucfirst($soapAction) . ucfirst($exceptionName) . 'Fault'; + } + } + } + /** * Retrieve error code. * @@ -174,19 +215,13 @@ class Fault extends \RuntimeException * @param array|null $details Detailed reason message(s) * @return string */ - public function getSoapFaultMessage($reason, $code, $details) + public function getSoapFaultMessage($reason, $code, $details = null) { - if (is_array($details) && !empty($details)) { - $detailsXml = $this->_convertDetailsToXml($details); - $errorDetailsNode = self::NODE_ERROR_DETAILS; - $detailsXml = $detailsXml - ? "<env:Detail><m:{$errorDetailsNode}>" . $detailsXml . "</m:{$errorDetailsNode}></env:Detail>" - : ''; - } else { - $detailsXml = ''; - } + $detailXml = $this->_generateDetailXml($details); $language = $this->getLanguage(); - $detailsNamespace = !empty($detailsXml) ? 'xmlns:m="http://magento.com"': ''; + $detailsNamespace = !empty($detailXml) + ? 'xmlns:m="' . urlencode($this->_soapServer->generateUri(true)) . '"' + : ''; $reason = htmlentities($reason); $message = <<<FAULT_MESSAGE <?xml version="1.0" encoding="utf-8" ?> @@ -199,7 +234,7 @@ class Fault extends \RuntimeException <env:Reason> <env:Text xml:lang="$language">$reason</env:Text> </env:Reason> - $detailsXml + $detailXml </env:Fault> </env:Body> </env:Envelope> @@ -207,6 +242,30 @@ FAULT_MESSAGE; return $message; } + /** + * Generate 'Detail' node content. + * + * In case when fault name is undefined, no 'Detail' node is generated. + * + * @param array $details + * @return string + */ + protected function _generateDetailXml($details) + { + $detailsXml = ''; + if (is_array($details) && !empty($details)) { + $detailsXml = $this->_convertDetailsToXml($details); + if ($detailsXml) { + $errorDetailsNode = $this->getFaultName() ? $this->getFaultName() :self::NODE_DETAIL_WRAPPER; + $detailsXml = "<env:Detail><m:{$errorDetailsNode}>" + . $detailsXml . "</m:{$errorDetailsNode}></env:Detail>"; + } else { + $detailsXml = ''; + } + } + return $detailsXml; + } + /** * Recursively convert details array into XML structure. * diff --git a/app/code/Magento/Webapi/Model/Soap/Wsdl.php b/app/code/Magento/Webapi/Model/Soap/Wsdl.php index c6ba865570d6e5be156893fea3aa410b1fa9a3bb..3269b529a8b5a3255b8f822704ac39c1796b7559 100644 --- a/app/code/Magento/Webapi/Model/Soap/Wsdl.php +++ b/app/code/Magento/Webapi/Model/Soap/Wsdl.php @@ -1,7 +1,5 @@ <?php /** - * Magento-specific WSDL builder. - * * Magento * * NOTICE OF LICENSE @@ -25,6 +23,11 @@ */ namespace Magento\Webapi\Model\Soap; +use DOMElement; + +/** + * Magento-specific WSDL builder. + */ class Wsdl extends \Zend\Soap\Wsdl { /** @@ -58,4 +61,83 @@ class Wsdl extends \Zend\Soap\Wsdl // delegates the detection of a complex type to the current strategy return $strategy->addComplexType($complexTypeNode); } + + /** + * Add an operation to port type. + * + * Multiple faults generation is allowed, while it is not allowed in parent. + * + * @param DOMElement $portType + * @param string $name Operation name + * @param string|bool $input Input Message + * @param string|bool $output Output Message + * @param array|bool $fault array of Fault messages in the format: array(array('message' => ..., 'name' => ...)) + * @return object The new operation's XML_Tree_Node + */ + public function addPortOperation($portType, $name, $input = false, $output = false, $fault = false) + { + $operation = parent::addPortOperation($portType, $name, $input, $output, false); + if (is_array($fault)) { + foreach ($fault as $faultInfo) { + $isMessageValid = isset($faultInfo['message']) && is_string($faultInfo['message']) + && strlen(trim($faultInfo['message'])); + $isNameValid = isset($faultInfo['name']) && is_string($faultInfo['name']) + && strlen(trim($faultInfo['name'])); + + if ($isNameValid && $isMessageValid) { + $node = $this->toDomDocument()->createElement('fault'); + $node->setAttribute('name', $faultInfo['name']); + $node->setAttribute('message', $faultInfo['message']); + $operation->appendChild($node); + } + } + } + return $operation; + } + + /** + * Add an operation to a binding element. + * + * Multiple faults binding is allowed, while it is not allowed in parent. + * + * @param DOMElement $binding + * @param string $name Operation name + * @param bool|array $input An array of attributes for the input element, + * allowed keys are: 'use', 'namespace', 'encodingStyle'. + * @param bool|array $output An array of attributes for the output element, + * allowed keys are: 'use', 'namespace', 'encodingStyle'. + * @param bool|array $fault An array of arrays which contain fault names: array(array('name' => ...))). + * @param int $soapVersion SOAP version to be used in binding operation. 1.1 used by default. + * @return DOMElement The new Operation's XML_Tree_Node + */ + public function addBindingOperation( + $binding, + $name, + $input = false, + $output = false, + $fault = false, + $soapVersion = SOAP_1_1 + ) { + $operation = parent::addBindingOperation($binding, $name, $input, $output, false, $soapVersion); + if (is_array($fault)) { + foreach ($fault as $faultInfo) { + $isNameValid = isset($faultInfo['name']) && is_string($faultInfo['name']) + && strlen(trim($faultInfo['name'])); + + if ($isNameValid) { + $faultInfo['use'] = 'literal'; + $wsdlFault = $this->toDomDocument()->createElement('fault'); + $wsdlFault->setAttribute('name', $faultInfo['name']); + + $soapFault = $this->toDomDocument()->createElement('soap:fault'); + $soapFault->setAttribute('name', $faultInfo['name']); + $soapFault->setAttribute('use', 'literal'); + + $wsdlFault->appendChild($soapFault); + $operation->appendChild($wsdlFault); + } + } + } + return $operation; + } } diff --git a/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php b/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php index 57c5e80b257ac8442a988b2203b8eb9500fd00ab..85ef89fd7494a59b0662e4e5bb2dd4f4b449a3bb 100644 --- a/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php +++ b/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php @@ -26,7 +26,8 @@ */ namespace Magento\Webapi\Model\Soap\Wsdl; -use Zend\Soap\Wsdl; +use Magento\Webapi\Model\Soap\Wsdl; +use Magento\Webapi\Model\Soap\Fault; class Generator { @@ -50,9 +51,6 @@ class Generator */ protected $_apiConfig; - /** @var \Magento\DomDocument\Factory */ - protected $_domDocumentFactory; - /** * The list of registered complex types. * @@ -66,18 +64,15 @@ class Generator * @param \Magento\Webapi\Model\Soap\Config $apiConfig * @param \Magento\Webapi\Model\Soap\Wsdl\Factory $wsdlFactory * @param \Magento\Webapi\Model\Cache\Type $cache - * @param \Magento\DomDocument\Factory $domDocumentFactory */ public function __construct( \Magento\Webapi\Model\Soap\Config $apiConfig, \Magento\Webapi\Model\Soap\Wsdl\Factory $wsdlFactory, - \Magento\Webapi\Model\Cache\Type $cache, - \Magento\DomDocument\Factory $domDocumentFactory + \Magento\Webapi\Model\Cache\Type $cache ) { $this->_apiConfig = $apiConfig; $this->_wsdlFactory = $wsdlFactory; $this->_cache = $cache; - $this->_domDocumentFactory = $domDocumentFactory; } /** @@ -128,16 +123,16 @@ class Generator $wsdl = $this->_wsdlFactory->create(self::WSDL_NAME, $endPointUrl); $wsdl->addSchemaTypeSection(); - + $this->_addDefaultFaultComplexTypeNodes($wsdl); foreach ($services as $serviceClass => $serviceData) { $portTypeName = $this->getPortTypeName($serviceClass); $bindingName = $this->getBindingName($serviceClass); $portType = $wsdl->addPortType($portTypeName); - $binding = $wsdl->addBinding($bindingName, \Magento\Webapi\Model\Soap\Wsdl::TYPES_NS . ':' . $portTypeName); + $binding = $wsdl->addBinding($bindingName, Wsdl::TYPES_NS . ':' . $portTypeName); $wsdl->addSoapBinding($binding, 'document', 'http://schemas.xmlsoap.org/soap/http', SOAP_1_2); $portName = $this->getPortName($serviceClass); $serviceName = $this->getServiceName($serviceClass); - $wsdl->addService($serviceName, $portName, \Magento\Webapi\Model\Soap\Wsdl::TYPES_NS + $wsdl->addService($serviceName, $portName, Wsdl::TYPES_NS . ':' . $bindingName, $endPointUrl, SOAP_1_2); foreach ($serviceData['methods'] as $methodName => $methodData) { @@ -148,21 +143,40 @@ class Generator $outputMessageName = false; $outputBinding = false; if (isset($methodData['interface']['outputComplexTypes'])) { - $outputBinding = $inputBinding; + $outputBinding = array('use' => 'literal'); $outputMessageName = $this->_createOperationOutput($wsdl, $operationName, $methodData); } - $wsdl->addPortOperation($portType, $operationName, $inputMessageName, $outputMessageName); + /** Default SOAP fault should be added to each operation declaration */ + $faultsInfo = array( + array( + 'name' => Fault::NODE_DETAIL_WRAPPER, + 'message' => Wsdl::TYPES_NS . ':' . $this->_getDefaultFaultMessageName() + ) + ); + if (isset($methodData['interface']['faultComplexTypes'])) { + $faultsInfo = array_merge( + $faultsInfo, + $this->_createOperationFaults($wsdl, $operationName, $methodData) + ); + } + + $wsdl->addPortOperation( + $portType, + $operationName, + $inputMessageName, + $outputMessageName, + $faultsInfo + ); $bindingOperation = $wsdl->addBindingOperation( $binding, $operationName, $inputBinding, $outputBinding, - false, + $faultsInfo, SOAP_1_2 ); $wsdl->addSoapOperation($bindingOperation, $operationName, SOAP_1_2); - // @TODO: implement faults binding } } return $wsdl->toXML(); @@ -198,7 +212,7 @@ class Generator ) { $response += $this->getComplexTypeNodes($serviceName, $referencedTypeName, $domDocument); /** Add target namespace to the referenced type name */ - $referencedType->value = \Magento\Webapi\Model\Soap\Wsdl::TYPES_NS . ':' . $prefixedRefTypeName; + $referencedType->value = Wsdl::TYPES_NS . ':' . $prefixedRefTypeName; } } $complexTypeNode->setAttribute( @@ -228,17 +242,17 @@ class Generator /** * Create input message and corresponding element and complex types in WSDL. * - * @param \Magento\Webapi\Model\Soap\Wsdl $wsdl + * @param Wsdl $wsdl * @param string $operationName * @param array $methodData * @return string input message name */ - protected function _createOperationInput(\Magento\Webapi\Model\Soap\Wsdl $wsdl, $operationName, $methodData) + protected function _createOperationInput(Wsdl $wsdl, $operationName, $methodData) { $inputMessageName = $this->getInputMessageName($operationName); $elementData = array( 'name' => $inputMessageName, - 'type' => \Magento\Webapi\Model\Soap\Wsdl::TYPES_NS . ':' . $inputMessageName + 'type' => Wsdl::TYPES_NS . ':' . $inputMessageName ); if (isset($methodData['interface']['inputComplexTypes'])) { foreach ($methodData['interface']['inputComplexTypes'] as $complexTypeNode) { @@ -252,28 +266,28 @@ class Generator $inputMessageName, array( 'messageParameters' => array( - 'element' => \Magento\Webapi\Model\Soap\Wsdl::TYPES_NS . ':' . $inputMessageName + 'element' => Wsdl::TYPES_NS . ':' . $inputMessageName ) ) ); - return \Magento\Webapi\Model\Soap\Wsdl::TYPES_NS . ':' . $inputMessageName; + return Wsdl::TYPES_NS . ':' . $inputMessageName; } /** - * Create output message and corresponding element and complex types in WSDL. + * Create output message, corresponding element and complex types in WSDL. * - * @param \Magento\Webapi\Model\Soap\Wsdl $wsdl + * @param Wsdl $wsdl * @param string $operationName * @param array $methodData * @return string output message name */ - protected function _createOperationOutput(\Magento\Webapi\Model\Soap\Wsdl $wsdl, $operationName, $methodData) + protected function _createOperationOutput(Wsdl $wsdl, $operationName, $methodData) { $outputMessageName = $this->getOutputMessageName($operationName); $wsdl->addElement( array( 'name' => $outputMessageName, - 'type' => \Magento\Webapi\Model\Soap\Wsdl::TYPES_NS . ':' . $outputMessageName + 'type' => Wsdl::TYPES_NS . ':' . $outputMessageName ) ); if (isset($methodData['interface']['outputComplexTypes'])) { @@ -285,11 +299,51 @@ class Generator $outputMessageName, array( 'messageParameters' => array( - 'element' => \Magento\Webapi\Model\Soap\Wsdl::TYPES_NS . ':' . $outputMessageName + 'element' => Wsdl::TYPES_NS . ':' . $outputMessageName ) ) ); - return \Magento\Webapi\Model\Soap\Wsdl::TYPES_NS . ':' . $outputMessageName; + return Wsdl::TYPES_NS . ':' . $outputMessageName; + } + + /** + * Create an array of items that contain information about method faults. + * + * @param Wsdl $wsdl + * @param string $operationName + * @param array $methodData + * @return array array(array('name' => ..., 'message' => ...)) + */ + protected function _createOperationFaults(Wsdl $wsdl, $operationName, $methodData) + { + $faults = array(); + if (isset($methodData['interface']['faultComplexTypes'])) { + foreach ($methodData['interface']['faultComplexTypes'] as $faultName => $faultComplexTypes) { + $faultMessageName = $this->getFaultMessageName($operationName, $faultName); + $wsdl->addElement( + array( + 'name' => $faultMessageName, + 'type' => Wsdl::TYPES_NS . ':' . $faultMessageName + ) + ); + foreach ($faultComplexTypes as $complexTypeNode) { + $wsdl->addComplexType($complexTypeNode); + } + $wsdl->addMessage( + $faultMessageName, + array( + 'messageParameters' => array( + 'element' => Wsdl::TYPES_NS . ':' . $faultMessageName + ) + ) + ); + $faults[] = array( + 'name' => $operationName . $faultName, + 'message' => Wsdl::TYPES_NS . ':' . $faultMessageName + ); + } + } + return $faults; } /** @@ -381,6 +435,18 @@ class Generator return $operationName . 'Response'; } + /** + * Get fault message node name for operation. + * + * @param string $operationName + * @param string $faultName + * @return string + */ + public function getFaultMessageName($operationName, $faultName) + { + return $operationName . $faultName . 'Fault'; + } + /** * Get complexType name defined in the XSD for requests * @@ -403,6 +469,30 @@ class Generator return ucfirst($serviceMethod) . "Response"; } + /** + * Get info about complex types defined in the XSD for the service method faults. + * + * @param string $serviceMethod + * @param \DOMDocument $domDocument + * @return array array(array('complexTypeName' => ..., 'faultName' => ...)) + */ + public function getXsdFaultTypeNames($serviceMethod, $domDocument) + { + $faultTypeNames = array(); + $xpath = new \DOMXPath($domDocument); + $serviceMethod = ucfirst($serviceMethod); + $typeXPath = "//xsd:complexType[starts-with(@name,'{$serviceMethod}') and contains(@name,'Fault')]"; + $complexTypeNodes = $xpath->query($typeXPath); + /** @var \DOMElement $complexTypeNode */ + foreach ($complexTypeNodes as $complexTypeNode) { + $complexTypeName = $complexTypeNode->getAttribute('name'); + if (preg_match("/^{$serviceMethod}(\w+)Fault$/", $complexTypeName, $matches)) { + $faultTypeNames[] = array('complexTypeName' => $complexTypeName, 'faultName' => $matches[1]); + } + } + return $faultTypeNames; + } + /** * Prepare data about requested service for WSDL generator. * @@ -426,14 +516,19 @@ class Generator $serviceDataTypes = array('methods' => array()); $serviceClass = $serviceData[\Magento\Webapi\Model\Soap\Config::KEY_CLASS]; foreach ($serviceData['methods'] as $operationData) { + $methodInterface = array(); $serviceMethod = $operationData[\Magento\Webapi\Model\Soap\Config::KEY_METHOD]; /** @var $payloadSchemaDom \DOMDocument */ $payloadSchemaDom = $this->_apiConfig->getServiceSchemaDOM($serviceClass); $operationName = $this->getOperationName($serviceName, $serviceMethod); + + /** Process input complex type */ $inputParameterName = $this->getInputMessageName($operationName); - $inputComplexTypes = $this->getComplexTypeNodes($serviceName, + $inputComplexTypes = $this->getComplexTypeNodes( + $serviceName, $this->getXsdRequestTypeName($serviceMethod), - $payloadSchemaDom); + $payloadSchemaDom + ); if (empty($inputComplexTypes)) { if ($operationData[\Magento\Webapi\Model\Soap\Config::KEY_IS_REQUIRED]) { throw new \LogicException( @@ -442,35 +537,106 @@ class Generator ); } else { /** Generate empty input request to make WSDL compliant with WS-I basic profile */ - $inputComplexTypes[] = $this->_generateEmptyComplexType($inputParameterName); + $inputComplexTypes[] = $this->_generateEmptyComplexType($inputParameterName, $payloadSchemaDom); } } - $serviceDataTypes['methods'][$serviceMethod]['interface']['inputComplexTypes'] = $inputComplexTypes; + $methodInterface['inputComplexTypes'] = $inputComplexTypes; + + /** Process output complex type */ $outputParameterName = $this->getOutputMessageName($operationName); - $outputComplexTypes = $this->getComplexTypeNodes($serviceName, + $outputComplexTypes = $this->getComplexTypeNodes( + $serviceName, $this->getXsdResponseTypeName($serviceMethod), - $payloadSchemaDom); + $payloadSchemaDom + ); if (!empty($outputComplexTypes)) { - $serviceDataTypes['methods'][$serviceMethod]['interface']['outputComplexTypes'] = $outputComplexTypes; + $methodInterface['outputComplexTypes'] = $outputComplexTypes; } else { throw new \LogicException( sprintf('The method "%s" of service "%s" must have "%s" complex type defined in its schema.', $serviceMethod, $serviceName, $outputParameterName) ); } + + /** Process fault complex types */ + foreach ($this->getXsdFaultTypeNames($serviceMethod, $payloadSchemaDom) as $faultComplexType) { + $faultComplexTypes = $this->_getFaultComplexTypeNodes( + $serviceName, + $faultComplexType['complexTypeName'], + $payloadSchemaDom + ); + if (!empty($faultComplexTypes)) { + $methodInterface['faultComplexTypes'][$faultComplexType['faultName']] = $faultComplexTypes; + } + } + $serviceDataTypes['methods'][$serviceMethod]['interface'] = $methodInterface; } return $serviceDataTypes; } + /** + * Add WSDL elements related to default SOAP fault, which are common for all operations: element, type and message. + * + * @param Wsdl $wsdl + * @return \DOMNode[] + */ + protected function _addDefaultFaultComplexTypeNodes($wsdl) + { + $domDocument = new \DOMDocument(); + $typeName = Fault::NODE_DETAIL_WRAPPER; + $defaultFault = $this->_generateEmptyComplexType($typeName, $domDocument); + $elementName = Fault::NODE_DETAIL_WRAPPER; + $wsdl->addElement(array('name' => $elementName, 'type' => Wsdl::TYPES_NS . ':' . $typeName)); + $wsdl->addMessage( + $this->_getDefaultFaultMessageName(), + array('messageParameters' => array('element' => Wsdl::TYPES_NS . ':' . $elementName)) + ); + $this->_addDefaultFaultElements($defaultFault); + $wsdl->addComplexType($defaultFault); + } + + /** + * Generate all necessary complex types for the fault of specified type. + * + * @param string $serviceName + * @param string $typeName + * @param \DOMDocument $domDocument + * @return \DOMNode[] + */ + protected function _getFaultComplexTypeNodes($serviceName, $typeName, $domDocument) + { + $complexTypesNodes = $this->getComplexTypeNodes($serviceName, $typeName, $domDocument); + $faultTypeName = $serviceName . $typeName; + $paramsTypeName = $faultTypeName . 'Params'; + if (isset($complexTypesNodes[$faultTypeName])) { + /** Rename fault complex type to fault param complex type */ + $faultComplexType = $complexTypesNodes[$faultTypeName]; + $faultComplexType->setAttribute('name', $paramsTypeName); + $complexTypesNodes[$paramsTypeName] = $complexTypesNodes[$faultTypeName]; + + /** Create new fault complex type, which will contain reference to fault param complex type */ + $newFaultComplexType = $this->_generateEmptyComplexType($faultTypeName, $domDocument); + $this->_addDefaultFaultElements($newFaultComplexType); + /** Create 'Parameters' element and use fault param complex type as its type */ + $parametersElement = $domDocument->createElement('xsd:element'); + $parametersElement->setAttribute('name', Fault::NODE_DETAIL_PARAMETERS); + $parametersElement->setAttribute('type', Wsdl::TYPES_NS . ':' . $paramsTypeName); + $newFaultComplexType->firstChild->appendChild($parametersElement); + + $complexTypesNodes[$faultTypeName] = $newFaultComplexType; + } + return $complexTypesNodes; + } + /** * Generate empty complex type with the specified name. * * @param string $complexTypeName + * @param \DOMDocument $domDocument * @return \DOMElement */ - protected function _generateEmptyComplexType($complexTypeName) + protected function _generateEmptyComplexType($complexTypeName, $domDocument) { - $domDocument = $this->_domDocumentFactory->createDomDocument(); $complexTypeNode = $domDocument->createElement('xsd:complexType'); $complexTypeNode->setAttribute('name', $complexTypeName); $xsdNamespace = 'http://www.w3.org/2001/XMLSchema'; @@ -480,4 +646,35 @@ class Generator $complexTypeNode->appendChild($sequenceNode); return $complexTypeNode; } + + /** + * Add 'Detail' and 'Trace' elements to the fault element. + * + * @param \DOMElement $faultElement + */ + protected function _addDefaultFaultElements($faultElement) + { + /** Create 'Code' element */ + $codeElement = $faultElement->ownerDocument->createElement('xsd:element'); + $codeElement->setAttribute('name', Fault::NODE_DETAIL_CODE); + $codeElement->setAttribute('type', 'xsd:int'); + $faultElement->firstChild->appendChild($codeElement); + + /** Create 'Trace' element */ + $traceElement = $faultElement->ownerDocument->createElement('xsd:element'); + $traceElement->setAttribute('name', Fault::NODE_DETAIL_TRACE); + $traceElement->setAttribute('type', 'xsd:string'); + $traceElement->setAttribute('minOccurs', '0'); + $faultElement->firstChild->appendChild($traceElement); + } + + /** + * Retrieve name of default SOAP fault message name in WSDL. + * + * @return string + */ + protected function _getDefaultFaultMessageName() + { + return Fault::NODE_DETAIL_WRAPPER; + } } diff --git a/app/code/Magento/Webapi/etc/di.xml b/app/code/Magento/Webapi/etc/di.xml index f217e427c6bdbb8bb9e06a2b5268a189e1abdeac..eb2e6b5fd1e1dec24e17f1a8b095b9e3fc9afc34 100644 --- a/app/code/Magento/Webapi/etc/di.xml +++ b/app/code/Magento/Webapi/etc/di.xml @@ -147,4 +147,29 @@ </value> </param> </type> + <type name="Magento\Webapi\Controller\Rest"> + <param name="request"> + <instance type="Magento\Webapi\Controller\Rest\Request\Proxy"/> + </param> + <param name="response"> + <instance type="Magento\Webapi\Controller\Rest\Response\Proxy"/> + </param> + <param name="router"> + <instance type="Magento\Webapi\Controller\Rest\Router\Proxy"/> + </param> + <param name="oauthHelper"> + <instance type="Magento\Oauth\Helper\Data\Proxy"/> + </param> + </type> + <type name="Magento\Webapi\Controller\Soap"> + <param name="soapServer"> + <instance type="Magento\Webapi\Model\Soap\Server\Proxy"/> + </param> + <param name="errorProcessor"> + <instance type="Magento\Webapi\Controller\ErrorProcessor\Proxy"/> + </param> + <param name="oauthHelper"> + <instance type="Magento\Oauth\Helper\Service\Proxy"/> + </param> + </type> </config> diff --git a/app/code/Magento/Webapi/etc/webapi.xsd b/app/code/Magento/Webapi/etc/webapi.xsd index 58f489a0ad16554b73761c1406cca000484d7382..23a46959412b63b05ce69dbaece36eb7104c37e7 100644 --- a/app/code/Magento/Webapi/etc/webapi.xsd +++ b/app/code/Magento/Webapi/etc/webapi.xsd @@ -1,6 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> <!-- /** - * Structure description for webapi.xml services file. + * Structure description for webapi.xml configuration files. * * Magento * @@ -25,38 +26,35 @@ */ --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:element name="config"> - <xs:complexType> - <xs:sequence> - <xs:element name="service"> - <xs:complexType> - <xs:sequence> - <xs:element name="rest-route"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:string"> - <xs:attribute name="httpMethod"> - <xs:simpleType> - <xs:restriction base="xs:string"> + <xs:element name="config" type="configType"/> + <xs:complexType name="configType"> + <xs:sequence> + <xs:element type="serviceType" name="service" maxOccurs="unbounded" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="serviceType"> + <xs:sequence> + <xs:element type="restRouteType" name="rest-route" maxOccurs="unbounded" minOccurs="0"/> + </xs:sequence> + <xs:attribute type="xs:string" name="class"/> + <xs:attribute type="xs:string" name="baseUrl"/> + </xs:complexType> + <xs:complexType name="restRouteType"> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="httpMethod"> + <xs:simpleType> + <xs:restriction base="xs:string"> <xs:enumeration value="GET"/> <xs:enumeration value="PUT"/> <xs:enumeration value="POST"/> <xs:enumeration value="DELETE"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute type="xs:string" name="method"/> - <xs:attribute type="xs:boolean" name="secure" default="false"/> - </xs:extension> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute type="xs:string" name="class"/> - <xs:attribute type="xs:string" name="baseUrl"/> - </xs:complexType> - </xs:element> - </xs:sequence> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute type="xs:string" name="method"/> + <xs:attribute type="xs:boolean" name="secure" default="false"/> + </xs:extension> + </xs:simpleContent> </xs:complexType> - </xs:element> </xs:schema> diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Registration/Create/Form.php b/app/code/Magento/Webhook/Block/Adminhtml/Registration/Create/Form.php index 1c93e77a79fc6d3b48a98787c7fb977c4c51124c..1c63171b3fac6453925bd860487d0084c366eecb 100644 --- a/app/code/Magento/Webhook/Block/Adminhtml/Registration/Create/Form.php +++ b/app/code/Magento/Webhook/Block/Adminhtml/Registration/Create/Form.php @@ -115,9 +115,8 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic */ private function _generateRandomString($length) { - return $this->_coreData - ->getRandomString( - $length, \Magento\Core\Helper\Data::CHARS_DIGITS . \Magento\Core\Helper\Data::CHARS_LOWERS - ); + return $this->mathRandom->getRandomString( + $length, \Magento\Math\Random::CHARS_DIGITS . \Magento\Math\Random::CHARS_LOWERS + ); } } diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Edit/Form.php b/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Edit/Form.php index 5586d5df93b08b7f0ea88da209cac86dbc00101f..e34c6b81fd8c5a2fb5faccca5dc5a004e417c647 100644 --- a/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Edit/Form.php +++ b/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Edit/Form.php @@ -54,7 +54,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Webhook\Model\Source\Authentication $authentication * @param \Magento\Webhook\Model\Source\Hook $hook * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -64,7 +64,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Webhook\Model\Source\Authentication $authentication, \Magento\Webhook\Model\Source\Hook $hook, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Registration.php b/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Registration.php index a47de9d7570b4246f79093fb66ff955be967390d..bf74d87b938606d13aa08966832cf62b4e2756ca 100644 --- a/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Registration.php +++ b/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Registration.php @@ -60,16 +60,14 @@ class Registration extends \Magento\Backend\Controller\AbstractAction * @param \Magento\Webhook\Service\SubscriptionV1Interface $subscriptionService * @param \Magento\Core\Model\Registry $registry * @param \Magento\Backend\Controller\Context $context - * @param string $areaCode */ public function __construct( \Magento\Webhook\Model\Webapi\User\Factory $userFactory, \Magento\Webhook\Service\SubscriptionV1Interface $subscriptionService, \Magento\Core\Model\Registry $registry, - \Magento\Backend\Controller\Context $context, - $areaCode = null + \Magento\Backend\Controller\Context $context ) { - parent::__construct($context, $areaCode); + parent::__construct($context); $this->_userFactory = $userFactory; $this->_subscriptionService = $subscriptionService; $this->_registry = $registry; diff --git a/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Subscription.php b/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Subscription.php index d14864055ca3fcd40456f8addb077d7d1786f9f3..8a108ca04352ece796de3e556be02725009fd11a 100644 --- a/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Subscription.php +++ b/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Subscription.php @@ -59,15 +59,13 @@ class Subscription extends \Magento\Backend\Controller\AbstractAction * @param \Magento\Core\Model\Registry $registry * @param \Magento\Webhook\Service\SubscriptionV1Interface $subscriptionService * @param \Magento\Backend\Controller\Context $context - * @param string $areaCode */ public function __construct( \Magento\Core\Model\Registry $registry, \Magento\Webhook\Service\SubscriptionV1Interface $subscriptionService, - \Magento\Backend\Controller\Context $context, - $areaCode = null + \Magento\Backend\Controller\Context $context ) { - parent::__construct($context, $areaCode); + parent::__construct($context); $this->_registry = $registry; $this->_subscriptionService = $subscriptionService; diff --git a/app/code/Magento/Core/Model/Route/ConfigInterface.php b/app/code/Magento/Webhook/Model/Config.php similarity index 76% rename from app/code/Magento/Core/Model/Route/ConfigInterface.php rename to app/code/Magento/Webhook/Model/Config.php index a56c4cf991e16660739321f6b16b239e50ae55ca..48945bf39708aa1b80446c44d25e02922123e9a6 100644 --- a/app/code/Magento/Core/Model/Route/ConfigInterface.php +++ b/app/code/Magento/Webhook/Model/Config.php @@ -1,7 +1,5 @@ <?php /** - * Routes configuration interface - * * Magento * * NOTICE OF LICENSE @@ -23,17 +21,28 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Route; -interface ConfigInterface +namespace Magento\Webhook\Model; + +class Config { + /** + * Get webhook list + * + * @return array + */ + public function getWebhooks() + { + return array(); + } /** - * Fetch routes from configs by area code and router id + * Get webhook subscriptions * - * @param string $areaCode - * @param string $routerId * @return array */ - public function getRoutes($areaCode, $routerId); -} + public function getSubscriptions() + { + return array(); + } +} \ No newline at end of file diff --git a/app/code/Magento/Webhook/Model/Endpoint.php b/app/code/Magento/Webhook/Model/Endpoint.php index e0299a8e6c444c20c1254539f775fc4cf5513eea..492e606302686f2bee885ad3ce368228fd8dbc1d 100644 --- a/app/code/Magento/Webhook/Model/Endpoint.php +++ b/app/code/Magento/Webhook/Model/Endpoint.php @@ -1,7 +1,5 @@ <?php /** - * Represents an endpoint to which messages can be sent - * * Magento * * NOTICE OF LICENSE @@ -24,6 +22,12 @@ * @package Magento_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Webhook\Model; + +/** + * Represents an endpoint to which messages can be sent * * @method string getName() * @method \Magento\Webhook\Model\Endpoint setName(string $value) @@ -36,8 +40,6 @@ * @method \Magento\Webhook\Model\Endpoint setAuthenticationType(string $value) * @method \Magento\Webhook\Model\Endpoint setTimeoutInSecs(string $value) */ -namespace Magento\Webhook\Model; - class Endpoint extends \Magento\Core\Model\AbstractModel implements \Magento\Outbound\EndpointInterface { /** @@ -46,10 +48,16 @@ class Endpoint extends \Magento\Core\Model\AbstractModel implements \Magento\Out */ private $_userFactory; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Webhook\Model\User\Factory $userFactory + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -58,13 +66,14 @@ class Endpoint extends \Magento\Core\Model\AbstractModel implements \Magento\Out \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Webhook\Model\User\Factory $userFactory, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); - $this->_userFactory = $userFactory; + $this->_dateTime = $dateTime; } /** @@ -111,7 +120,7 @@ class Endpoint extends \Magento\Core\Model\AbstractModel implements \Magento\Out } if ($this->hasDataChanges()) { - $this->setUpdatedAt($this->_getResource()->formatDate(time())); + $this->setUpdatedAt($this->_dateTime->formatDate(time())); } return $this; diff --git a/app/code/Magento/Webhook/Model/Event.php b/app/code/Magento/Webhook/Model/Event.php index 5c89bf86fb2cbc0052a480ca7bc89fd2fb017f73..1d3f9ef91578b1a13a8e182df97a5e7085b41814 100644 --- a/app/code/Magento/Webhook/Model/Event.php +++ b/app/code/Magento/Webhook/Model/Event.php @@ -1,7 +1,5 @@ <?php /** - * Stores event information in Magento database - * * Magento * * NOTICE OF LICENSE @@ -24,15 +22,44 @@ * @package Magento_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Webhook\Model; + +/** + * Stores event information in Magento database * * @method \Magento\Webhook\Model\Event setStatus() * @method \Magento\Webhook\Model\Event setUpdatedAt() * @method \Magento\Webhook\Model\Event setCreatedAt() */ -namespace Magento\Webhook\Model; - class Event extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub\EventInterface { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + + /** + * @param \Magento\Core\Model\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Data\Collection\Db $resourceCollection + * @param array $data + */ + public function __construct( + \Magento\Core\Model\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Stdlib\DateTime $dateTime, + \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Data\Collection\Db $resourceCollection = null, + array $data = array() + ) { + $this->_dateTime = $dateTime; + parent::__construct($context, $registry, $resource, $resourceCollection, $data); + } + /** * Initialize Model */ @@ -52,9 +79,9 @@ class Event extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub { parent::_beforeSave(); if ($this->isObjectNew()) { - $this->setCreatedAt($this->_getResource()->formatDate(true)); + $this->setCreatedAt($this->_dateTime->formatDate(true)); } elseif ($this->getId() && !$this->hasData('updated_at')) { - $this->setUpdatedAt($this->_getResource()->formatDate(true)); + $this->setUpdatedAt($this->_dateTime->formatDate(true)); } return $this; } diff --git a/app/code/Magento/Webhook/Model/Job.php b/app/code/Magento/Webhook/Model/Job.php index bf4049765ccb18f60439db25550fad9df6f9256d..d313a0bbfd1d359614cafe5037986bef13ad3bf4 100644 --- a/app/code/Magento/Webhook/Model/Job.php +++ b/app/code/Magento/Webhook/Model/Job.php @@ -1,7 +1,5 @@ <?php /** - * Handles HTTP responses, and manages retry schedule - * * Magento * * NOTICE OF LICENSE @@ -24,6 +22,12 @@ * @package Magento_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Webhook\Model; + +/** + * Handles HTTP responses, and manages retry schedule * * @method bool hasEvent() * @method \Magento\Webhook\Model\Job setEventId() @@ -37,8 +41,6 @@ * @method \Magento\Webhook\Model\Job setUpdatedAt() * @method \Magento\Webhook\Model\Job setCreatedAt() */ -namespace Magento\Webhook\Model; - class Job extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub\JobInterface { /** @var \Magento\Webhook\Model\Event\Factory */ @@ -47,6 +49,11 @@ class Job extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub\J /** @var \Magento\Webhook\Model\Subscription\Factory */ protected $_subscriptionFactory; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + /** @var array */ private $_retryTimeToAdd = array( 1 => 1, @@ -64,6 +71,7 @@ class Job extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub\J * @param \Magento\Webhook\Model\Subscription\Factory $subscriptionFactory * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $coreRegistry + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -73,12 +81,14 @@ class Job extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub\J \Magento\Webhook\Model\Subscription\Factory $subscriptionFactory, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $coreRegistry, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_eventFactory = $eventFactory; $this->_subscriptionFactory = $subscriptionFactory; + $this->_dateTime = $dateTime; parent::__construct($context, $coreRegistry, $resource, $resourceCollection, $data); } @@ -109,9 +119,9 @@ class Job extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub\J { parent::_beforeSave(); if ($this->isObjectNew()) { - $this->setCreatedAt($this->_getResource()->formatDate(true)); + $this->setCreatedAt($this->_dateTime->formatDate(true)); } elseif ($this->getId() && !$this->hasData('updated_at')) { - $this->setUpdatedAt($this->_getResource()->formatDate(true)); + $this->setUpdatedAt($this->_dateTime->formatDate(true)); } return $this; } @@ -182,8 +192,8 @@ class Job extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub\J if ($retryCount < count($this->_retryTimeToAdd)) { $addedTimeInMinutes = $this->_retryTimeToAdd[$retryCount + 1] * 60 + time(); $this->setRetryCount($retryCount + 1); - $this->setRetryAt(\Magento\Date::formatDate($addedTimeInMinutes)); - $this->setUpdatedAt(\Magento\Date::formatDate(time(), true)); + $this->setRetryAt($this->_dateTime->formatDate($addedTimeInMinutes)); + $this->setUpdatedAt($this->_dateTime->formatDate(time(), true)); $this->setStatus(\Magento\PubSub\JobInterface::STATUS_RETRY); } else { $this->setStatus(\Magento\PubSub\JobInterface::STATUS_FAILED); diff --git a/app/code/Magento/Webhook/Model/Observer.php b/app/code/Magento/Webhook/Model/Observer.php index 99028d51e9832e050fcedfca9cc745cc4f75baf5..c36abfac7b5f423e82a781ac35404c9acde2c79d 100644 --- a/app/code/Magento/Webhook/Model/Observer.php +++ b/app/code/Magento/Webhook/Model/Observer.php @@ -35,18 +35,18 @@ class Observer /** @var \Magento\Webhook\Model\Resource\Subscription\Collection $_subscriptionSet */ private $_subscriptionSet; - /** @var \Magento\Core\Model\Logger */ + /** @var \Magento\Logger */ private $_logger; /** * @param \Magento\Webhook\Model\Webapi\EventHandler $webapiEventHandler * @param \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function __construct( \Magento\Webhook\Model\Webapi\EventHandler $webapiEventHandler, \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { $this->_webapiEventHandler = $webapiEventHandler; $this->_subscriptionSet = $subscriptionSet; diff --git a/app/code/Magento/Webhook/Model/Resource/Event/Collection.php b/app/code/Magento/Webhook/Model/Resource/Event/Collection.php index 6c96625c6878dab9471ed4c086bc061b6587fe87..81df66dec3253175c34231fd1d94e751d5d6698d 100644 --- a/app/code/Magento/Webhook/Model/Resource/Event/Collection.php +++ b/app/code/Magento/Webhook/Model/Resource/Event/Collection.php @@ -1,7 +1,5 @@ <?php /** - * Event resource Collection - * * Magento * * NOTICE OF LICENSE @@ -25,8 +23,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Webhook\Model\Resource\Event; +/** + * Event resource Collection + */ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection { /** @@ -42,22 +44,30 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** @var int timeout to wait until decide that event is failed */ protected $_timeoutIdling; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Core\Model\Resource\Db\Abstract $resource + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource * @param null $timeoutIdling */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null, $timeoutIdling = null ) { + $this->_dateTime = $dateTime; parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $resource); $this->_timeoutIdling = is_null($timeoutIdling) ? self::DEFAULT_TIMEOUT_IDLING_EVENTS : $timeoutIdling; @@ -151,7 +161,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /* if event is in progress state for less than hour we do nothing with it*/ $okUpdatedTime = time() - $this->_timeoutIdling; $this->addFieldToFilter('status', \Magento\PubSub\EventInterface::STATUS_IN_PROGRESS) - ->addFieldToFilter('updated_at', array('to' => \Magento\Date::formatDate($okUpdatedTime), + ->addFieldToFilter('updated_at', array('to' => $this->_dateTime->formatDate($okUpdatedTime), 'datetime' => true)); $idsToRevoke = $this->_getLoadedIds(); if (count($idsToRevoke)) { diff --git a/app/code/Magento/Webhook/Model/Resource/Job/Collection.php b/app/code/Magento/Webhook/Model/Resource/Job/Collection.php index 604bad8b35b0e8474de6febd88c394725c1792c1..b8129754f59d8f0c60ced2a72405bca182dfa3e7 100644 --- a/app/code/Magento/Webhook/Model/Resource/Job/Collection.php +++ b/app/code/Magento/Webhook/Model/Resource/Job/Collection.php @@ -44,20 +44,23 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Core\Model\Resource\Db\Abstract $resource + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource * @param null $timeoutIdling */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null, $timeoutIdling = null ) { + $this->dateTime = $dateTime; parent::__construct($eventManager, $logger, $fetchStrategy, $entityFactory, $resource); $this->_timeoutIdling = is_null($timeoutIdling) ? self::DEFAULT_TIMEOUT_IDLING_JOBS : $timeoutIdling; @@ -87,7 +90,10 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\PubSub\JobInterface::STATUS_READY_TO_SEND, \Magento\PubSub\JobInterface::STATUS_RETRY ))) - ->addFieldToFilter('retry_at', array('to' => \Magento\Date::formatDate(true), 'datetime' => true)) + ->addFieldToFilter( + 'retry_at', + array('to' => $this->dateTime->formatDate(true), 'datetime' => true) + ) ->setOrder('updated_at', \Magento\Data\Collection::SORT_ORDER_ASC) ->setPageSize(self::PAGE_SIZE); return $this; @@ -161,7 +167,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /* if event is in progress state for less than defined delay we do nothing with it */ $okUpdatedTime = time() - $this->_timeoutIdling; $this->addFieldToFilter('status', \Magento\PubSub\JobInterface::STATUS_IN_PROGRESS) - ->addFieldToFilter('updated_at', array('to' => \Magento\Date::formatDate($okUpdatedTime), + ->addFieldToFilter('updated_at', array('to' => $this->dateTime->formatDate($okUpdatedTime), 'datetime' => true)); if (!count($this->getItems())) { diff --git a/app/code/Magento/Webhook/Model/Resource/Subscription.php b/app/code/Magento/Webhook/Model/Resource/Subscription.php index e2bf33e27a149044510d0814ec6b4eb0e5d93baf..f6c7ce8e088da60b782f7fdfdcb11f9a7c99f803 100644 --- a/app/code/Magento/Webhook/Model/Resource/Subscription.php +++ b/app/code/Magento/Webhook/Model/Resource/Subscription.php @@ -29,19 +29,21 @@ namespace Magento\Webhook\Model\Resource; class Subscription extends \Magento\Core\Model\Resource\Db\AbstractDb { - /** @var \Magento\Core\Model\ConfigInterface $_coreConfig */ - private $_coreConfig; + /** + * @var array + */ + private $_webHookList; /** - * @param \Magento\Core\Model\Resource $resource - * @param \Magento\Core\Model\ConfigInterface $config + * @param \Magento\App\Resource $resource + * @param \Magento\Webhook\Model\Config $config */ public function __construct( - \Magento\Core\Model\Resource $resource, - \Magento\Core\Model\ConfigInterface $config + \Magento\App\Resource $resource, + \Magento\Webhook\Model\Config $config ) { + $this->_webHookList = $config->getWebhooks(); parent::__construct($resource); - $this->_coreConfig = $config; } /** @@ -133,24 +135,20 @@ class Subscription extends \Magento\Core\Model\Resource\Db\AbstractDb } /** - * Get list of webhook topics defined in config.xml + * Get list of webhook topics defined in webhook.xml * * @return string[] */ protected function _getSupportedTopics() { - $node = $this->_coreConfig->getNode(\Magento\Webhook\Model\Source\Hook::XML_PATH_WEBHOOK); $availableHooks = array(); - if (!$node) { - return $availableHooks; - } - foreach ($node->asArray() as $key => $hookNode) { - foreach ($hookNode as $name => $hook) { + foreach ($this->_webHookList as $key => $configData) { + foreach ($configData as $name => $hook) { if (is_array($hook)) { $availableHooks[] = $key . '/' . $name; } } - if (isset($hookNode['label'])) { + if (isset($configData['label'])) { $availableHooks[] = $key; } } diff --git a/app/code/Magento/Webhook/Model/Resource/Subscription/Collection.php b/app/code/Magento/Webhook/Model/Resource/Subscription/Collection.php index e8511b73377112b0d41e298c3ca31bbeded1a9bb..9b1ce3657fc16939dd38ca042086e879b5bcd67b 100644 --- a/app/code/Magento/Webhook/Model/Resource/Subscription/Collection.php +++ b/app/code/Magento/Webhook/Model/Resource/Subscription/Collection.php @@ -39,7 +39,7 @@ class Collection /** * @param \Magento\Webhook\Model\Resource\Endpoint $endpointResource * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource @@ -47,7 +47,7 @@ class Collection public function __construct( \Magento\Webhook\Model\Resource\Endpoint $endpointResource, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/Webhook/Model/Resource/Subscription/Grid/Collection.php b/app/code/Magento/Webhook/Model/Resource/Subscription/Grid/Collection.php index 4fae380813b72ca2c44216fa23ce2b8a1b7a63f3..2d6c06e4cf1989c8362e17ea98e6abb7ba3fd128 100644 --- a/app/code/Magento/Webhook/Model/Resource/Subscription/Grid/Collection.php +++ b/app/code/Magento/Webhook/Model/Resource/Subscription/Grid/Collection.php @@ -34,7 +34,7 @@ class Collection * @param \Magento\Webhook\Model\Subscription\Config $subscriptionConfig * @param \Magento\Webhook\Model\Resource\Endpoint $endpointResource * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\Resource\Db\Abstract $resource @@ -43,7 +43,7 @@ class Collection \Magento\Webhook\Model\Subscription\Config $subscriptionConfig, \Magento\Webhook\Model\Resource\Endpoint $endpointResource, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/Webhook/Model/Source/Hook.php b/app/code/Magento/Webhook/Model/Source/Hook.php index 48b2cde54e29295135d5dda3e7828592770a60e4..d450cfb56a9bc40eee1c6af3305dba407353abbb 100644 --- a/app/code/Magento/Webhook/Model/Source/Hook.php +++ b/app/code/Magento/Webhook/Model/Source/Hook.php @@ -29,11 +29,6 @@ namespace Magento\Webhook\Model\Source; class Hook implements \Magento\Core\Model\Option\ArrayInterface { - /** - * Path to environments section in the config - */ - const XML_PATH_WEBHOOK = 'global/webhook/webhooks'; - /** * Cache of options * @@ -41,15 +36,12 @@ class Hook implements \Magento\Core\Model\Option\ArrayInterface */ protected $_options = null; - /** @var \Magento\Core\Model\Config */ - private $_config; - /** - * @param \Magento\Core\Model\Config $config + * @param \Magento\Webhook\Model\Config $config */ - public function __construct(\Magento\Core\Model\Config $config ) + public function __construct(\Magento\Webhook\Model\Config $config ) { - $this->_config = $config; + $this->_options = $config->getWebhooks(); } /** @@ -59,15 +51,6 @@ class Hook implements \Magento\Core\Model\Option\ArrayInterface */ public function toOptionArray() { - if (!$this->_options) { - $this->_options = array(); - - $configElement = $this->_config->getNode(self::XML_PATH_WEBHOOK); - if ($configElement) { - $this->_options = $configElement->asArray(); - } - } - return $this->_options; } diff --git a/app/code/Magento/Webhook/Model/Subscription.php b/app/code/Magento/Webhook/Model/Subscription.php index e78b0d526a3f3db62c71e530e6e2f32e338a9905..0496978978631e768189d667bbbfe8057f2ccb1f 100644 --- a/app/code/Magento/Webhook/Model/Subscription.php +++ b/app/code/Magento/Webhook/Model/Subscription.php @@ -1,7 +1,5 @@ <?php /** - * Represents a subscription to one or more topics - * * Magento * * NOTICE OF LICENSE @@ -24,6 +22,12 @@ * @package Magento_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Webhook\Model; + +/** + * Represents a subscription to one or more topics * * @method string getName() * @method \Magento\Webhook\Model\Subscription setName(string $value) @@ -41,8 +45,6 @@ * @method bool hasStatus() * @method int getSubscriptionId() */ -namespace Magento\Webhook\Model; - class Subscription extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub\SubscriptionInterface @@ -64,6 +66,11 @@ class Subscription */ private $_endpoint = null; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + /** * Tracks whether or not we've already loaded endpoint data from the DB. * @@ -75,6 +82,7 @@ class Subscription * @param \Magento\Webhook\Model\Endpoint $endpoint * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $coreRegistry + * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -83,6 +91,7 @@ class Subscription \Magento\Webhook\Model\Endpoint $endpoint, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $coreRegistry, + \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -92,7 +101,7 @@ class Subscription $data['status'] = \Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE; } parent::__construct($context, $coreRegistry, $resource, $resourceCollection, $data); - + $this->_dateTime = $dateTime; $this->_endpoint = $endpoint; } @@ -125,7 +134,7 @@ class Subscription } if ($this->hasDataChanges()) { - $this->setUpdatedAt($this->_getResource()->formatDate(time())); + $this->setUpdatedAt($this->_dateTime->formatDate(time())); } return parent::_beforeSave(); diff --git a/app/code/Magento/Webhook/Model/Subscription/Config.php b/app/code/Magento/Webhook/Model/Subscription/Config.php index bcc49af8b3acf338c126d22aa65c5565e3d4840f..638168d7eb1ae2c2ae20417391f03296c27a5221 100644 --- a/app/code/Magento/Webhook/Model/Subscription/Config.php +++ b/app/code/Magento/Webhook/Model/Subscription/Config.php @@ -29,35 +29,38 @@ namespace Magento\Webhook\Model\Subscription; class Config { - /** Webhook subscription configuration path */ - const XML_PATH_SUBSCRIPTIONS = 'global/webhook/subscriptions'; - - /** @var \Magento\Webhook\Model\Resource\Subscription\Collection */ + /** + * @var \Magento\Webhook\Model\Resource\Subscription\Collection + */ protected $_subscriptionSet; - /** @var \Magento\Core\Model\Config */ - protected $_mageConfig; + /** + * @var \Magento\Webhook\Model\Config + */ + protected $_config; - /** @var \Magento\Webhook\Model\Subscription\Factory */ + /** + * @var Factory + */ protected $_subscriptionFactory; - /** @var \Magento\Core\Model\Logger */ + /** @var \Magento\Logger */ private $_logger; /** * @param \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet - * @param \Magento\Core\Model\Config $mageConfig + * @param \Magento\Webhook\Model\Config $config * @param \Magento\Webhook\Model\Subscription\Factory $subscriptionFactory - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger */ public function __construct( \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet, - \Magento\Core\Model\Config $mageConfig, + \Magento\Webhook\Model\Config $config, \Magento\Webhook\Model\Subscription\Factory $subscriptionFactory, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger ) { $this->_subscriptionSet = $subscriptionSet; - $this->_mageConfig = $mageConfig; + $this->_config = $config; $this->_subscriptionFactory = $subscriptionFactory; $this->_logger = $logger; } @@ -69,17 +72,7 @@ class Config */ public function updateSubscriptionCollection() { - $subscriptionConfig = $this->_mageConfig->getNode(self::XML_PATH_SUBSCRIPTIONS); - - if (!empty($subscriptionConfig)) { - $subscriptionConfig = $subscriptionConfig->asArray(); - } - // It could be no subscriptions have been defined - if (!$subscriptionConfig) { - return $this; - } - - foreach ($subscriptionConfig as $alias => $subscriptionData) { + foreach ($this->_config->getSubscriptions() as $alias => $subscriptionData) { try { $this->_validateConfigData($subscriptionData, $alias); $subscriptions = $this->_subscriptionSet->getSubscriptionsByAlias($alias); diff --git a/app/code/Magento/Webhook/Model/Webapi/User/Factory.php b/app/code/Magento/Webhook/Model/Webapi/User/Factory.php index 8172b0226730eea751a91f4d3402152b8f1da217..6283aa9f5a546f6cab0ab8dd94da9ff92ec7aa19 100644 --- a/app/code/Magento/Webhook/Model/Webapi/User/Factory.php +++ b/app/code/Magento/Webhook/Model/Webapi/User/Factory.php @@ -53,8 +53,10 @@ class Factory /** @var \Magento\Acl\CacheInterface */ protected $_cache; - /** @var \Magento\Core\Helper\Data */ - private $_coreHelper; + /** + * @var \Magento\Math\Random + */ + protected $_mathRandom; /** * @param \Magento\Webapi\Model\Acl\Rule\Factory $ruleFactory @@ -62,7 +64,7 @@ class Factory * @param \Magento\Webapi\Model\Acl\Role\Factory $roleFactory * @param \Magento\Webapi\Model\Acl\Resource\Provider $resourceProvider * @param \Magento\Webapi\Model\Acl\Cache $cache - * @param \Magento\Core\Helper\Data $coreHelper + * @param \Magento\Math\Random $mathRandom */ public function __construct( \Magento\Webapi\Model\Acl\Rule\Factory $ruleFactory, @@ -70,13 +72,13 @@ class Factory \Magento\Webapi\Model\Acl\Role\Factory $roleFactory, \Magento\Webapi\Model\Acl\Resource\Provider $resourceProvider, \Magento\Webapi\Model\Acl\Cache $cache, - \Magento\Core\Helper\Data $coreHelper + \Magento\Math\Random $mathRandom ) { $this->_ruleFactory = $ruleFactory; $this->_userFactory = $userFactory; $this->_roleFactory = $roleFactory; - $this->_coreHelper = $coreHelper; $this->_cache = $cache; + $this->_mathRandom = $mathRandom; $this->_initVirtualResourceMapping($resourceProvider); } @@ -122,7 +124,7 @@ class Factory // Check if a role with this name already exists, we need a new role with a unique name if ($role->getId()) { - $uniqString = $this->_coreHelper->uniqHash(); + $uniqString = $this->_mathRandom->getUniqueHash(); $roleName = $this->_createRoleName($email, $company, $uniqString); } diff --git a/app/code/Magento/Webhook/etc/di.xml b/app/code/Magento/Webhook/etc/di.xml index f06c00ba068b7079309975b4195c854e693cd4f2..51dafbf59c88424462823521f019d44b1eff2b31 100644 --- a/app/code/Magento/Webhook/etc/di.xml +++ b/app/code/Magento/Webhook/etc/di.xml @@ -24,11 +24,6 @@ */ --> <config> - <type name="Magento\Webhook\Model\Resource\Subscription"> - <param name="config"> - <instance type="Magento\Core\Model\Config" /> - </param> - </type> <type name="Magento\Outbound\Formatter\Factory"> <param name="formatterMap"> <value> diff --git a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php index b1cd827588fa0308b79bd13e6ad9f3e1f3d56243..ecf5d17de3dabe3ee9f6e7492d6a69a81467716e 100644 --- a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php @@ -44,7 +44,7 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price protected $_directoryHelper; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Directory\Helper\Data $directoryHelper * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Model\Config $config @@ -53,7 +53,7 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price * @param \Magento\Weee\Model\Resource\Attribute\Backend\Weee\Tax $attributeTax */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Catalog\Helper\Data $catalogData, \Magento\Core\Model\Config $config, diff --git a/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php index 52bfa596c793d30e3d210f89a2d9e9f296b22f79..c24d91ff8d6c9e43db36dcc3df85c3510fadd350 100644 --- a/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php @@ -43,11 +43,11 @@ class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb /** * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource $resource + * @param \Magento\App\Resource $resource */ public function __construct( \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource $resource + \Magento\App\Resource $resource ) { $this->_storeManager = $storeManager; parent::__construct($resource); diff --git a/app/code/Magento/Weee/Model/Resource/Tax.php b/app/code/Magento/Weee/Model/Resource/Tax.php index eff4796d59f30c0b7218bb57a333f162968a381b..9c3a7b01de7f9d88168ad3b16f8525d80f7d65f8 100644 --- a/app/code/Magento/Weee/Model/Resource/Tax.php +++ b/app/code/Magento/Weee/Model/Resource/Tax.php @@ -24,21 +24,32 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Weee\Model\Resource; /** * Wee tax resource model - * - * @category Magento - * @package Magento_Weee - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Weee\Model\Resource; - class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + + /** + * @param \Magento\App\Resource $resource + * @param \Magento\Stdlib\DateTime $dateTime + */ + public function __construct( + \Magento\App\Resource $resource, + \Magento\Stdlib\DateTime $dateTime + ) { + $this->dateTime = $dateTime; + parent::__construct($resource); + } + /** * Resource initialization - * */ protected function _construct() { @@ -96,7 +107,7 @@ class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected function _updateDiscountPercents($productCondition = null) { - $now = \Magento\Date::toTimestamp(\Magento\Date::now()); + $now = $this->dateTime->toTimestamp($this->dateTime->now()); $adapter = $this->_getWriteAdapter(); $select = $this->_getReadAdapter()->select(); diff --git a/app/code/Magento/Weee/etc/di.xml b/app/code/Magento/Weee/etc/di.xml index fb4b4836fa54c04b147769a967123e461ee4e0be..7d55b785ba7823996c9ae1ad8c62f7c9a40cf2e5 100644 --- a/app/code/Magento/Weee/etc/di.xml +++ b/app/code/Magento/Weee/etc/di.xml @@ -40,7 +40,7 @@ <instance type="Magento\Weee\Helper\Data\Proxy" /> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <weee_setup>Magento\Sales\Model\Resource\Setup</weee_setup> diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Form.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Form.php index 76a1cae238ffbd342627d8c871c1275dbc87b38a..5914d380b1b02a6d6a91582b1052a8de01c2811e 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Form.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Form.php @@ -43,7 +43,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Widget\Model\WidgetFactory $widgetFactory @@ -51,7 +51,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Widget\Model\WidgetFactory $widgetFactory, diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Layout.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Layout.php index 320dca50de8c0c1d083e67b611facaa8437fae2d..b97da01e738bd9c91501fcfe66ead332c8d2e8e2 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Layout.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Layout.php @@ -24,14 +24,14 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser; + /** * Widget Instance layouts chooser * * @method getArea() * @method getTheme() */ -namespace Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser; - class Layout extends \Magento\Core\Block\Html\Select { /** @@ -44,20 +44,28 @@ class Layout extends \Magento\Core\Block\Html\Select */ protected $_themesFactory; + /** + * @var \Magento\App\State + */ + protected $_appState; + /** * @param \Magento\Core\Block\Context $context * @param \Magento\View\Layout\ProcessorFactory $layoutProcessorFactory * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $themesFactory + * @param \Magento\App\State $appState * @param array $data */ public function __construct( \Magento\Core\Block\Context $context, \Magento\View\Layout\ProcessorFactory $layoutProcessorFactory, \Magento\Core\Model\Resource\Theme\CollectionFactory $themesFactory, + \Magento\App\State $appState, array $data = array() ) { $this->_layoutProcessorFactory = $layoutProcessorFactory; $this->_themesFactory = $themesFactory; + $this->_appState = $appState; parent::__construct($context, $data); } @@ -73,8 +81,11 @@ class Layout extends \Magento\Core\Block\Html\Select $layoutUpdateParams = array( 'theme' => $this->_getThemeInstance($this->getTheme()), ); - $pageTypesAll = $this->_getLayoutProcessor($layoutUpdateParams)->getAllPageHandles(); - $this->_addPageTypeOptions($pageTypesAll); + $pageTypes = $this->_appState->emulateAreaCode( + 'frontend', + array($this->_getLayoutProcessor($layoutUpdateParams), 'getAllPageHandles') + ); + $this->_addPageTypeOptions($pageTypes); } return parent::_beforeToHtml(); } @@ -83,10 +94,6 @@ class Layout extends \Magento\Core\Block\Html\Select * Retrieve theme instance by its identifier * * @param int $themeId - * - * - * - * * @return \Magento\Core\Model\Theme|null */ protected function _getThemeInstance($themeId) @@ -114,6 +121,7 @@ class Layout extends \Magento\Core\Block\Html\Select */ protected function _addPageTypeOptions(array $pageTypes) { + $label = array(); // Sort list of page types by label foreach ($pageTypes as $key => $row) { $label[$key] = $row['label']; diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php index 7e3e3c5376d2370c6fd42da52f74fb46fa45127f..c80a427e4928afbc01cad2920d58d20c6658778e 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php @@ -56,7 +56,7 @@ class Main /** * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -66,7 +66,7 @@ class Main */ public function __construct( \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php index 3a5ceffa425422090c07a4b8b95b6f3cb90f7769..7762d5fe86ad445ccea95ec7e18885dc2d560144 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php @@ -164,45 +164,45 @@ class Layout $options = array(); $options[] = array( 'value' => '', - 'label' => $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('-- Please Select --')) + 'label' => $this->escapeJsQuote(__('-- Please Select --')) ); $options[] = array( 'label' => __('Categories'), 'value' => array( array( 'value' => 'anchor_categories', - 'label' => $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Anchor Categories')) + 'label' => $this->escapeJsQuote(__('Anchor Categories')) ), array( 'value' => 'notanchor_categories', - 'label' => $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Non-Anchor Categories')) + 'label' => $this->escapeJsQuote(__('Non-Anchor Categories')) ) ) ); foreach ($this->_productType->getTypes() as $typeId => $type) { $productsOptions[] = array( 'value' => $typeId.'_products', - 'label' => $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape($type['label']) + 'label' => $this->escapeJsQuote($type['label']) ); } array_unshift($productsOptions, array( 'value' => 'all_products', - 'label' => $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('All Product Types')) + 'label' => $this->escapeJsQuote(__('All Product Types')) )); $options[] = array( - 'label' => $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Products')), + 'label' => $this->escapeJsQuote(__('Products')), 'value' => $productsOptions ); $options[] = array( - 'label' => $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Generic Pages')), + 'label' => $this->escapeJsQuote(__('Generic Pages')), 'value' => array( array( 'value' => 'all_pages', - 'label' => $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('All Pages')) + 'label' => $this->escapeJsQuote(__('All Pages')) ), array( 'value' => 'pages', - 'label' => $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Specified Page')) + 'label' => $this->escapeJsQuote(__('Specified Page')) ) ) ); @@ -300,7 +300,7 @@ class Layout { $button = $this->getLayout()->createBlock('Magento\Adminhtml\Block\Widget\Button') ->setData(array( - 'label' => $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Remove Layout Update')), + 'label' => $this->escapeJsQuote(__('Remove Layout Update')), 'onclick' => 'WidgetInstance.removePageGroup(this)', 'class' => 'action-delete' )); diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php index c6c932d95b4145ddac4a46c1bf7ee02c12489a48..6dca42608e3e9751581946fb3e546818851fe40a 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php @@ -53,7 +53,7 @@ class Settings * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\Theme\LabelFactory $themeLabelFactory * @param array $data */ @@ -61,7 +61,7 @@ class Settings \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\Theme\LabelFactory $themeLabelFactory, array $data = array() ) { diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php index 7c973412fe82b8846d8f2a084dffa8d45e1fde6d..1df1752a411495261b58235b8653847716ea2baf 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php @@ -57,7 +57,7 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Core\Model\Option\ArrayPool $sourceModelPool * @param \Magento\Widget\Model\Widget $widget * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\Form\Factory $formFactory + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Backend\Block\Template\Context $context * @param array $data @@ -66,7 +66,7 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Core\Model\Option\ArrayPool $sourceModelPool, \Magento\Widget\Model\Widget $widget, \Magento\Core\Model\Registry $registry, - \Magento\Data\Form\Factory $formFactory, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Helper\Data $coreData, \Magento\Backend\Block\Template\Context $context, array $data = array() diff --git a/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php b/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php index 4b7631cb8c861a773b84c069687f3780cf753b79..8eff3d9bbdc173530800aaf22e9b55415152d8bc 100644 --- a/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php +++ b/app/code/Magento/Widget/Controller/Adminhtml/Widget/Instance.php @@ -44,25 +44,33 @@ class Instance extends \Magento\Backend\Controller\Adminhtml\Action protected $_widgetFactory; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + /** * @param \Magento\Backend\Controller\Context $context * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Widget\Model\Widget\InstanceFactory $widgetFactory - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger + * @param \Magento\Math\Random $mathRandom */ public function __construct( \Magento\Backend\Controller\Context $context, \Magento\Core\Model\Registry $coreRegistry, \Magento\Widget\Model\Widget\InstanceFactory $widgetFactory, - \Magento\Core\Model\Logger $logger + \Magento\Logger $logger, + \Magento\Math\Random $mathRandom ) { $this->_coreRegistry = $coreRegistry; $this->_widgetFactory = $widgetFactory; $this->_logger = $logger; + $this->mathRandom = $mathRandom; parent::__construct($context); } @@ -262,7 +270,7 @@ class Instance extends \Magento\Backend\Controller\Adminhtml\Action $chooser = $this->getLayout() ->createBlock('Magento\Catalog\Block\Adminhtml\Category\Widget\Chooser') ->setUseMassaction(true) - ->setId($this->_objectManager->get('Magento\Core\Helper\Data')->uniqHash('categories')) + ->setId($this->mathRandom->getUniqueHash('categories')) ->setIsAnchorOnly($isAnchorOnly) ->setSelectedCategories(explode(',', $selected)); $this->setBody($chooser->toHtml()); @@ -278,7 +286,7 @@ class Instance extends \Magento\Backend\Controller\Adminhtml\Action $productTypeId = $this->getRequest()->getParam('product_type_id', ''); $chooser = $this->getLayout() ->createBlock('Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser') - ->setName($this->_objectManager->get('Magento\Core\Helper\Data')->uniqHash('products_grid_')) + ->setName($this->mathRandom->getUniqueHash('products_grid_')) ->setUseMassaction(true) ->setProductTypeId($productTypeId) ->setSelectedProducts(explode(',', $selected)); @@ -303,6 +311,15 @@ class Instance extends \Magento\Backend\Controller\Adminhtml\Action * */ public function blocksAction() + { + $this->_objectManager->get('Magento\App\State') + ->emulateAreaCode('frontend', array($this, 'renderPageContainers')); + } + + /** + * Render page containers + */ + public function renderPageContainers() { /* @var $widgetInstance \Magento\Widget\Model\Widget\Instance */ $widgetInstance = $this->_initWidgetInstance(); diff --git a/app/code/Magento/Widget/Model/Config/FileResolver.php b/app/code/Magento/Widget/Model/Config/FileResolver.php index 853672872b5295cb1d954d10b3649b82af19c79f..da89fcdd363111d1caa0f1f032e91c665943b53f 100644 --- a/app/code/Magento/Widget/Model/Config/FileResolver.php +++ b/app/code/Magento/Widget/Model/Config/FileResolver.php @@ -30,7 +30,7 @@ class FileResolver implements \Magento\Config\FileResolverInterface /** * Module configuration file reader * - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_moduleReader; @@ -40,11 +40,11 @@ class FileResolver implements \Magento\Config\FileResolverInterface protected $_applicationDirs; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader * @param \Magento\App\Dir $applicationDirs */ public function __construct( - \Magento\Core\Model\Config\Modules\Reader $moduleReader, + \Magento\Module\Dir\Reader $moduleReader, \Magento\App\Dir $applicationDirs ) { $this->_moduleReader = $moduleReader; diff --git a/app/code/Magento/Widget/Model/Config/SchemaLocator.php b/app/code/Magento/Widget/Model/Config/SchemaLocator.php index ed019cf34bed47a75f25572289b46945b928aace..e628db40728f106d486c35b79dea48ca4277be51 100644 --- a/app/code/Magento/Widget/Model/Config/SchemaLocator.php +++ b/app/code/Magento/Widget/Model/Config/SchemaLocator.php @@ -42,9 +42,9 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema = null; /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(\Magento\Module\Dir\Reader $moduleReader) { $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Widget') . '/widget.xsd'; $this->_perFileSchema = $moduleReader->getModuleDir('etc', 'Magento_Widget') . '/widget_file.xsd'; diff --git a/app/code/Magento/Widget/Model/NamespaceResolver.php b/app/code/Magento/Widget/Model/NamespaceResolver.php new file mode 100644 index 0000000000000000000000000000000000000000..8e377d1abf2f5ac0976e6f58157e4f5c32a3ac22 --- /dev/null +++ b/app/code/Magento/Widget/Model/NamespaceResolver.php @@ -0,0 +1,93 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Widget\Model; + +class NamespaceResolver +{ + /** + * List of module namespaces + * + * @var array + */ + protected $_moduleNamespaces; + + /** + * @var \Magento\Module\ModuleListInterface + */ + protected $_moduleList; + + /** + * @param \Magento\Module\ModuleListInterface $moduleList + */ + public function __construct(\Magento\Module\ModuleListInterface $moduleList) + { + $this->_moduleList = $moduleList; + } + + /** + * Determine whether provided name begins from any available modules, according to namespaces priority + * If matched, returns as the matched module "factory" name or a fully qualified module name + * + * @param string $name + * @param bool $asFullModuleName + * @return string + */ + public function determineOmittedNamespace($name, $asFullModuleName = false) + { + if (null === $this->_moduleNamespaces) { + $this->_moduleNamespaces = array(); + foreach ($this->_moduleList->getModules() as $module) { + $moduleName = $module['name']; + $module = strtolower($moduleName); + $this->_moduleNamespaces[substr($module, 0, strpos($module, '_'))][$module] = $moduleName; + } + } + + $explodeString = (strpos($name, \Magento\Autoload\IncludePath::NS_SEPARATOR) === false) ? + '_' : \Magento\Autoload\IncludePath::NS_SEPARATOR; + $name = explode($explodeString, strtolower($name)); + + $partsNum = count($name); + $defaultNamespaceFlag = false; + foreach ($this->_moduleNamespaces as $namespaceName => $namespace) { + // assume the namespace is omitted (default namespace only, which comes first) + if ($defaultNamespaceFlag === false) { + $defaultNamespaceFlag = true; + $defaultNS = $namespaceName . '_' . $name[0]; + if (isset($namespace[$defaultNS])) { + return $asFullModuleName ? $namespace[$defaultNS] : $name[0]; // return omitted as well + } + } + // assume namespace is qualified + if (isset($name[1])) { + $fullNS = $name[0] . '_' . $name[1]; + if (2 <= $partsNum && isset($namespace[$fullNS])) { + return $asFullModuleName ? $namespace[$fullNS] : $fullNS; + } + } + } + return ''; + } +} \ No newline at end of file diff --git a/app/code/Magento/Widget/Model/Template/Filter.php b/app/code/Magento/Widget/Model/Template/Filter.php index aa5bf71f0ae550b07b151d1d0b10fedae86f42d8..c21947dd5ba38b7b6b19a7b7ad0ad896ecc8a143 100644 --- a/app/code/Magento/Widget/Model/Template/Filter.php +++ b/app/code/Magento/Widget/Model/Template/Filter.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Widget\Model\Template; + /** * Template Filter Model - * - * @category Magento - * @package Magento_Widget - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Widget\Model\Template; - class Filter extends \Magento\Cms\Model\Template\Filter { /** @@ -46,8 +42,9 @@ class Filter extends \Magento\Cms\Model\Template\Filter protected $_widget; /** - * @param \Magento\Core\Model\Logger $logger - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Stdlib\String $string + * @param \Magento\Logger $logger + * @param \Magento\Escaper $escaper * @param \Magento\Core\Model\View\Url $viewUrl * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\VariableFactory $coreVariableFactory @@ -56,10 +53,12 @@ class Filter extends \Magento\Cms\Model\Template\Filter * @param \Magento\View\LayoutFactory $layoutFactory * @param \Magento\Widget\Model\Resource\Widget $widgetResource * @param \Magento\Widget\Model\Widget $widget + * @param \Magento\App\State $appState */ public function __construct( - \Magento\Core\Model\Logger $logger, - \Magento\Core\Helper\Data $coreData, + \Magento\Stdlib\String $string, + \Magento\Logger $logger, + \Magento\Escaper $escaper, \Magento\Core\Model\View\Url $viewUrl, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\VariableFactory $coreVariableFactory, @@ -67,13 +66,22 @@ class Filter extends \Magento\Cms\Model\Template\Filter \Magento\View\LayoutInterface $layout, \Magento\View\LayoutFactory $layoutFactory, \Magento\Widget\Model\Resource\Widget $widgetResource, - \Magento\Widget\Model\Widget $widget + \Magento\Widget\Model\Widget $widget, + \Magento\App\State $appState ) { $this->_widgetResource = $widgetResource; $this->_widget = $widget; parent::__construct( - $logger, $coreData, $viewUrl, $coreStoreConfig, $coreVariableFactory, $storeManager, - $layout, $layoutFactory + $string, + $logger, + $escaper, + $viewUrl, + $coreStoreConfig, + $coreVariableFactory, + $storeManager, + $layout, + $layoutFactory, + $appState ); } @@ -103,13 +111,13 @@ class Filter extends \Magento\Cms\Model\Template\Filter } else { return ''; } - - // we have no other way to avoid fatal errors for type like 'cms/widget__link', '_cms/widget_link' etc. + + // we have no other way to avoid fatal errors for type like 'cms/widget__link', '_cms/widget_link' etc. $xml = $this->_widget->getWidgetByClassType($type); if ($xml === null) { return ''; } - + // define widget block and check the type is instance of Widget Interface $widget = $this->_layout->createBlock($type, $name, array('data' => $params)); if (!$widget instanceof \Magento\Widget\Block\BlockInterface) { diff --git a/app/code/Magento/Widget/Model/Widget.php b/app/code/Magento/Widget/Model/Widget.php index eb2139fd6aadb5ac0ee861aebf2f0e6ea99889fa..d05254c5799af6bf499895b43a6dcf846ee1b4e4 100644 --- a/app/code/Magento/Widget/Model/Widget.php +++ b/app/code/Magento/Widget/Model/Widget.php @@ -58,27 +58,27 @@ class Widget /** * Core data * - * @var \Magento\Core\Helper\Data + * @var \Magento\Escaper */ - protected $_coreData = null; + protected $_escaper; /** @var array */ protected $_widgetsArray = array(); /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Widget\Model\Config\Data $dataStorage * @param \Magento\Core\Model\View\Url $viewUrl * @param \Magento\Core\Model\View\Url $viewUrl * @param \Magento\Core\Model\View\FileSystem $viewFileSystem */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Widget\Model\Config\Data $dataStorage, \Magento\Core\Model\View\Url $viewUrl, \Magento\Core\Model\View\FileSystem $viewFileSystem ) { - $this->_coreData = $coreData; + $this->_escaper = $escaper; $this->_dataStorage = $dataStorage; $this->_viewUrl = $viewUrl; $this->_viewFileSystem = $viewFileSystem; @@ -244,7 +244,7 @@ class Widget */ public function getWidgetDeclaration($type, $params = array(), $asIs = true) { - $directive = '{{widget type="' . $type . '"'; + $directive = '{{widget type="' . preg_quote($type) . '"'; foreach ($params as $name => $value) { // Retrieve default option value if pre-configured @@ -270,7 +270,7 @@ class Widget $html = sprintf('<img id="%s" src="%s" title="%s">', $this->_idEncode($directive), $this->getPlaceholderImageUrl($type), - $this->_coreData->escapeUrl($directive) + $this->_escaper->escapeUrl($directive) ); return $html; } diff --git a/app/code/Magento/Widget/Model/Widget/Instance.php b/app/code/Magento/Widget/Model/Widget/Instance.php index 0c961ffa191f7098c2aa2b059360540058a5293c..39ec5567ab51a990ccbc46023cef8b72ab319721 100644 --- a/app/code/Magento/Widget/Model/Widget/Instance.php +++ b/app/code/Magento/Widget/Model/Widget/Instance.php @@ -82,8 +82,10 @@ class Instance extends \Magento\Core\Model\AbstractModel /** @var \Magento\Widget\Model\Widget */ protected $_widgetModel; - /** @var \Magento\Core\Model\Config */ - protected $_coreConfig; + /** + * @var \Magento\Widget\Model\NamespaceResolver + */ + protected $_namespaceResolver; /** * @var \Magento\Core\Model\Cache\TypeListInterface @@ -96,8 +98,17 @@ class Instance extends \Magento\Core\Model\AbstractModel protected $_relatedCacheTypes; /** - * @param \Magento\Widget\Helper\Data $widgetData - * @param \Magento\Core\Helper\Data $coreData + * @var \Magento\Escaper + */ + protected $_escaper; + + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + + /** + * @param \Magento\Escaper $escaper * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\View\FileSystem $viewFileSystem @@ -105,15 +116,15 @@ class Instance extends \Magento\Core\Model\AbstractModel * @param \Magento\Catalog\Model\Product\Type $productType * @param \Magento\Widget\Model\Config\Reader $reader * @param \Magento\Widget\Model\Widget $widgetModel - * @param \Magento\Core\Model\Config $coreConfig + * @param \Magento\Widget\Model\NamespaceResolver $namespaceResolver + * @param \Magento\Math\Random $mathRandom * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $relatedCacheTypes * @param array $data */ public function __construct( - \Magento\Widget\Helper\Data $widgetData, - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Core\Model\View\FileSystem $viewFileSystem, @@ -121,21 +132,22 @@ class Instance extends \Magento\Core\Model\AbstractModel \Magento\Catalog\Model\Product\Type $productType, \Magento\Widget\Model\Config\Reader $reader, \Magento\Widget\Model\Widget $widgetModel, - \Magento\Core\Model\Config $coreConfig, + \Magento\Widget\Model\NamespaceResolver $namespaceResolver, + \Magento\Math\Random $mathRandom, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $relatedCacheTypes = array(), array $data = array() ) { - $this->_widgetData = $widgetData; - $this->_coreData = $coreData; + $this->_escaper = $escaper; $this->_viewFileSystem = $viewFileSystem; $this->_cacheTypeList = $cacheTypeList; $this->_relatedCacheTypes = $relatedCacheTypes; $this->_productType = $productType; $this->_reader = $reader; $this->_widgetModel = $widgetModel; - $this->_coreConfig = $coreConfig; + $this->mathRandom = $mathRandom; + $this->_namespaceResolver = $namespaceResolver; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -397,7 +409,7 @@ class Instance extends \Magento\Core\Model\AbstractModel $configFile = $this->_viewFileSystem->getFilename('widget.xml', array( 'area' => $this->getArea(), 'theme' => $this->getThemeId(), - 'module' => $this->_coreConfig->determineOmittedNamespace( + 'module' => $this->_namespaceResolver->determineOmittedNamespace( preg_replace('/^(.+?)\/.+$/', '\\1', $this->getType()), true ), )); @@ -528,7 +540,7 @@ class Instance extends \Magento\Core\Model\AbstractModel $template = ' template="' . $templatePath . '"'; } - $hash = $this->_coreData->uniqHash(); + $hash = $this->mathRandom->getUniqueHash(); $xml .= '<block class="' . $this->getType() . '" name="' . $hash . '"' . $template . '>'; foreach ($parameters as $name => $value) { if (is_array($value)) { @@ -538,7 +550,7 @@ class Instance extends \Magento\Core\Model\AbstractModel $xml .= '<action method="setData">' . '<argument name="name" xsi:type="string">' . $name . '</argument>' . '<argument name="value" xsi:type="string">' - . $this->_widgetData->escapeHtml($value) . '</argument>' + . $this->_escaper->escapeHtml($value) . '</argument>' . '</action>'; } } diff --git a/app/code/Magento/Widget/etc/di.xml b/app/code/Magento/Widget/etc/di.xml index 6dadc3fe3685a87fa36771d360cabff2bf8dd752..ecb8a39183ad6bdc3b25ab0d309a16b702b58027 100644 --- a/app/code/Magento/Widget/etc/di.xml +++ b/app/code/Magento/Widget/etc/di.xml @@ -51,7 +51,7 @@ <value>Magento\Widget\Model\Template\Filter</value> </param> </type> - <type name="Magento\App\Updater\SetupFactory"> + <type name="Magento\Module\Updater\SetupFactory"> <param name="resourceTypes"> <value> <widget_setup>Magento\Core\Model\Resource\Setup\Generic</widget_setup> diff --git a/app/code/Magento/Widget/view/adminhtml/instance/edit/layout.phtml b/app/code/Magento/Widget/view/adminhtml/instance/edit/layout.phtml index f61bb256f9d5b7fd6128b8bea9972b06ed65af9f..9bdee8c52103346e3407c181fb15fb41edee6ad5 100644 --- a/app/code/Magento/Widget/view/adminhtml/instance/edit/layout.phtml +++ b/app/code/Magento/Widget/view/adminhtml/instance/edit/layout.phtml @@ -53,18 +53,18 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id=" '<col width="200" />'+ '<thead>'+ '<tr>'+ - '<th><label><?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('%1', $container['label'])) ?></label></th>'+ - '<th><label><?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Container')) ?> <span class="required">*</span></label></th>'+ - '<th><label><?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Template')) ?></label></th>'+ + '<th><label><?php echo $this->escapeJsQuote(__('%1', $container['label'])) ?></label></th>'+ + '<th><label><?php echo $this->escapeJsQuote(__('Container')) ?> <span class="required">*</span></label></th>'+ + '<th><label><?php echo $this->escapeJsQuote(__('Template')) ?></label></th>'+ '</tr>'+ '</thead>'+ '<tbody>'+ '<tr>'+ '<td>'+ '<input type="radio" class="radio for_all" id="all_<?php echo $container['name'] ?>_{{id}}" name="widget_instance[{{id}}][<?php echo $container['name'] ?>][for]" value="all" onclick="WidgetInstance.togglePageGroupChooser(this)" checked="checked" /> '+ - '<label for="all_<?php echo $container['name'] ?>_{{id}}"><?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('All')) ?></label><br />'+ + '<label for="all_<?php echo $container['name'] ?>_{{id}}"><?php echo $this->escapeJsQuote(__('All')) ?></label><br />'+ '<input type="radio" class="radio for_specific" id="specific_<?php echo $container['name'] ?>_{{id}}" name="widget_instance[{{id}}][<?php echo $container['name'] ?>][for]" value="specific" onclick="WidgetInstance.togglePageGroupChooser(this)" /> '+ - '<label for="specific_<?php echo $container['name'] ?>_{{id}}"><?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Specific %1', $container['label'])) ?></label>'+ + '<label for="specific_<?php echo $container['name'] ?>_{{id}}"><?php echo $this->escapeJsQuote(__('Specific %1', $container['label'])) ?></label>'+ '</td>'+ '<td>'+ '<div class="block_reference_container">'+ @@ -84,11 +84,11 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id=" '<input type="hidden" class="product_type_id" name="widget_instance[{{id}}][<?php echo $container['name'] ?>][product_type_id]" value="<?php echo $container['product_type_id'] ?>" />'+ '<p>' + '<input type="text" class="input-text entities" name="widget_instance[{{id}}][<?php echo $container['name'] ?>][entities]" value="{{<?php echo $container['name'] ?>_entities}}" readonly="readonly" /> ' + - '<a class="widget-option-chooser" href="javascript:void(0)" onclick="WidgetInstance.displayEntityChooser(\'<?php echo $container['code'] ?>\', \'<?php echo $container['name'] ?>_ids_{{id}}\')" title="<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Open Chooser')) ?>">' + - '<img src="<?php echo $this->getViewFileUrl('images/rule_chooser_trigger.gif') ?>" alt="<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Open Chooser')); ?>" />' + + '<a class="widget-option-chooser" href="javascript:void(0)" onclick="WidgetInstance.displayEntityChooser(\'<?php echo $container['code'] ?>\', \'<?php echo $container['name'] ?>_ids_{{id}}\')" title="<?php echo $this->escapeJsQuote(__('Open Chooser')) ?>">' + + '<img src="<?php echo $this->getViewFileUrl('images/rule_chooser_trigger.gif') ?>" alt="<?php echo $this->escapeJsQuote(__('Open Chooser')); ?>" />' + '</a> ' + - '<a href="javascript:void(0)" onclick="WidgetInstance.hideEntityChooser(\'<?php echo $container['name'] ?>_ids_{{id}}\')" title="<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Apply')); ?>">' + - '<img src="<?php echo $this->getViewFileUrl('images/rule_component_apply.gif') ?>" alt="<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Apply')); ?>" />' + + '<a href="javascript:void(0)" onclick="WidgetInstance.hideEntityChooser(\'<?php echo $container['name'] ?>_ids_{{id}}\')" title="<?php echo $this->escapeJsQuote(__('Apply')); ?>">' + + '<img src="<?php echo $this->getViewFileUrl('images/rule_component_apply.gif') ?>" alt="<?php echo $this->escapeJsQuote(__('Apply')); ?>" />' + '</a>' + '</p>'+ '<div class="chooser"></div>'+ @@ -104,8 +104,8 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id=" '<col width="200" />'+ '<thead>'+ '<tr>'+ - '<th><label><?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Container')) ?> <span class="required">*</span></label></th>'+ - '<th><label><?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Template')) ?></label></th>'+ + '<th><label><?php echo $this->escapeJsQuote(__('Container')) ?> <span class="required">*</span></label></th>'+ + '<th><label><?php echo $this->escapeJsQuote(__('Template')) ?></label></th>'+ '<th> </th>'+ '</tr>'+ '</thead>'+ @@ -134,9 +134,9 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id=" '<col width="200" />'+ '<thead>'+ '<tr>'+ - '<th><label><?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Page')) ?> <span class="required">*</span></label></th>'+ - '<th><label><?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Container')) ?> <span class="required">*</span></label></th>'+ - '<th><label><?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape(__('Template')) ?></label></th>'+ + '<th><label><?php echo $this->escapeJsQuote(__('Page')) ?> <span class="required">*</span></label></th>'+ + '<th><label><?php echo $this->escapeJsQuote(__('Container')) ?> <span class="required">*</span></label></th>'+ + '<th><label><?php echo $this->escapeJsQuote(__('Template')) ?></label></th>'+ '</tr>'+ '</thead>'+ '<tbody>'+ diff --git a/app/code/Magento/Wishlist/Controller/AbstractController.php b/app/code/Magento/Wishlist/Controller/AbstractController.php index cfa5dca1febe96c37065b20970ade786c114cf18..d1bcd71eea91c34f8804757535ce4d38d7205435 100644 --- a/app/code/Magento/Wishlist/Controller/AbstractController.php +++ b/app/code/Magento/Wishlist/Controller/AbstractController.php @@ -120,7 +120,7 @@ abstract class AbstractController extends \Magento\Core\Controller\Front\Action $messages[] = __('%1 for "%2".', trim($e->getMessage(), '.'), $item->getProduct()->getName()); } } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $messages[] = __('We cannot add this item to your shopping cart.'); } } diff --git a/app/code/Magento/Wishlist/Controller/Index.php b/app/code/Magento/Wishlist/Controller/Index.php index 39e7e305322036d8bc599b5efb8452dc5a545d78..172143ebe20f9984f825ca6dc751cf4557598585 100644 --- a/app/code/Magento/Wishlist/Controller/Index.php +++ b/app/code/Magento/Wishlist/Controller/Index.php @@ -254,7 +254,7 @@ class Index /** @var $helper \Magento\Wishlist\Helper\Data */ $helper = $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); - $message = __('%1 has been added to your wishlist. Click <a href="%2">here</a> to continue shopping.', $helper->escapeHtml($product->getName()), $this->_objectManager->get('Magento\Core\Helper\Data')->escapeUrl($referer)); + $message = __('%1 has been added to your wishlist. Click <a href="%2">here</a> to continue shopping.', $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName()), $this->_objectManager->get('Magento\Escaper')->escapeUrl($referer)); $session->addSuccess($message); } catch (\Magento\Core\Exception $e) { @@ -262,7 +262,7 @@ class Index } catch (\Exception $e) { $session->addError(__('An error occurred while adding item to wish list.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('*', array('wishlist_id' => $wishlist->getId())); @@ -309,7 +309,7 @@ class Index } catch (\Exception $e) { $this->_objectManager->get('Magento\Customer\Model\Session') ->addError(__('We can\'t configure the product.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_redirect('*'); return; } @@ -363,7 +363,7 @@ class Index $session->addError($e->getMessage()); } catch (\Exception $e) { $session->addError(__('An error occurred while updating wish list.')); - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('*/*', array('wishlist_id' => $wishlist->getId())); } @@ -413,7 +413,7 @@ class Index try { $item->delete(); } catch (\Exception $e) { - $this->_objectManager->get('Magento\Core\Model\Logger')->logException($e); + $this->_objectManager->get('Magento\Logger')->logException($e); $this->_objectManager->get('Magento\Customer\Model\Session')->addError( __('Can\'t delete item from wishlist') ); @@ -431,7 +431,7 @@ class Index $updatedItems++; } catch (\Exception $e) { $this->_objectManager->get('Magento\Customer\Model\Session')->addError( - __('Can\'t save description %1', $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($description)) + __('Can\'t save description %1', $this->_objectManager->get('Magento\Escaper')->escapeHtml($description)) ); } } @@ -601,8 +601,8 @@ class Index $cart->getQuote()->removeItem($itemId); $cart->save(); $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); - $productName = $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($item->getProduct()->getName()); - $wishlistName = $this->_objectManager->get('Magento\Core\Helper\Data')->escapeHtml($wishlist->getName()); + $productName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($item->getProduct()->getName()); + $wishlistName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($wishlist->getName()); $session->addSuccess( __("%1 has been moved to wish list %2", $productName, $wishlistName) ); diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php b/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php index 622ca6aa595c7646eff55c0dc8c8857ba24fdc3e..50ab2fcfab72135007ad5927979b7c63dc122980 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php @@ -127,7 +127,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl protected $_productVisibility; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_coreResource; @@ -155,14 +155,14 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData * @param \Magento\Sales\Helper\Admin $adminhtmlSales * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Date $date * @param \Magento\Wishlist\Model\Config $wishlistConfig * @param \Magento\Catalog\Model\Product\Visibility $productVisibility - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory * @param \Magento\Catalog\Model\Resource\ConfigFactory $catalogConfFactory @@ -173,14 +173,14 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\CatalogInventory\Helper\Data $catalogInventoryData, \Magento\Sales\Helper\Admin $adminhtmlSales, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Date $date, \Magento\Wishlist\Model\Config $wishlistConfig, \Magento\Catalog\Model\Product\Visibility $productVisibility, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollFactory, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, \Magento\Catalog\Model\Resource\ConfigFactory $catalogConfFactory, @@ -471,14 +471,14 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl $now = $this->_date->date(); $gmtOffset = (int)$this->_date->getGmtOffset(); if (isset($constraints['from'])) { - $lastDay = new \Zend_Date($now, \Magento\Date::DATETIME_INTERNAL_FORMAT); + $lastDay = new \Zend_Date($now, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); $lastDay->subSecond($gmtOffset) ->subDay(intval($constraints['from'])); $filter['to'] = $lastDay; } if (isset($constraints['to'])) { - $firstDay = new \Zend_Date($now, \Magento\Date::DATETIME_INTERNAL_FORMAT); + $firstDay = new \Zend_Date($now, \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT); $firstDay->subSecond($gmtOffset) ->subDay(intval($constraints['to']) + 1); $filter['from'] = $firstDay; diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php b/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php index 3fedafad97588a1034d5802d412d4e80b854106e..206653a3a35bcf5f86564031194a838c969c05d8 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php @@ -40,14 +40,14 @@ class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData * @param \Magento\Sales\Helper\Admin $adminhtmlSales * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Date $date * @param \Magento\Wishlist\Model\Config $wishlistConfig * @param \Magento\Catalog\Model\Product\Visibility $productVisibility - * @param \Magento\Core\Model\Resource $coreResource + * @param \Magento\App\Resource $coreResource * @param \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory * @param \Magento\Catalog\Model\Resource\ConfigFactory $catalogConfFactory @@ -59,14 +59,14 @@ class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection \Magento\CatalogInventory\Helper\Data $catalogInventoryData, \Magento\Sales\Helper\Admin $adminhtmlSales, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Date $date, \Magento\Wishlist\Model\Config $wishlistConfig, \Magento\Catalog\Model\Product\Visibility $productVisibility, - \Magento\Core\Model\Resource $coreResource, + \Magento\App\Resource $coreResource, \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollFactory, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, \Magento\Catalog\Model\Resource\ConfigFactory $catalogConfFactory, diff --git a/app/code/Magento/Wishlist/Model/Wishlist.php b/app/code/Magento/Wishlist/Model/Wishlist.php index d038a145a20c3a4ba64a714882a1f643cbf9c68a..a9d13a45cd10ec4bf20846f010d5b9f13ff57340 100644 --- a/app/code/Magento/Wishlist/Model/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Wishlist.php @@ -24,6 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Wishlist\Model; /** * Wishlist model @@ -36,13 +37,7 @@ * @method \Magento\Wishlist\Model\Wishlist setSharingCode(string $value) * @method string getUpdatedAt() * @method \Magento\Wishlist\Model\Wishlist setUpdatedAt(string $value) - * - * @category Magento - * @package Magento_Wishlist - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Wishlist\Model; - class Wishlist extends \Magento\Core\Model\AbstractModel { /** @@ -79,13 +74,6 @@ class Wishlist extends \Magento\Core\Model\AbstractModel */ protected $_wishlistData; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData; - /** * Catalog product * @@ -125,10 +113,19 @@ class Wishlist extends \Magento\Core\Model\AbstractModel */ protected $_productFactory; + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Catalog\Helper\Product $catalogProduct - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Wishlist\Helper\Data $wishlistData * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry @@ -139,12 +136,13 @@ class Wishlist extends \Magento\Core\Model\AbstractModel * @param \Magento\Wishlist\Model\ItemFactory $wishlistItemFactory * @param \Magento\Wishlist\Model\Resource\Item\CollectionFactory $wishlistCollFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory + * @param \Magento\Math\Random $mathRandom + * @param \Magento\Stdlib\DateTime $dateTime * @param array $data */ public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Catalog\Helper\Product $catalogProduct, - \Magento\Core\Helper\Data $coreData, \Magento\Wishlist\Helper\Data $wishlistData, \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, @@ -155,17 +153,20 @@ class Wishlist extends \Magento\Core\Model\AbstractModel \Magento\Wishlist\Model\ItemFactory $wishlistItemFactory, \Magento\Wishlist\Model\Resource\Item\CollectionFactory $wishlistCollFactory, \Magento\Catalog\Model\ProductFactory $productFactory, + \Magento\Math\Random $mathRandom, + \Magento\Stdlib\DateTime $dateTime, array $data = array() ) { $this->_eventManager = $eventManager; $this->_catalogProduct = $catalogProduct; - $this->_coreData = $coreData; $this->_wishlistData = $wishlistData; $this->_storeManager = $storeManager; $this->_date = $date; $this->_wishlistItemFactory = $wishlistItemFactory; $this->_wishlistCollFactory = $wishlistCollFactory; $this->_productFactory = $productFactory; + $this->mathRandom = $mathRandom; + $this->dateTime = $dateTime; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -242,7 +243,7 @@ class Wishlist extends \Magento\Core\Model\AbstractModel */ protected function _getSharingRandomCode() { - return $this->_coreData->uniqHash(); + return $this->mathRandom->getUniqueHash(); } /** @@ -296,7 +297,7 @@ class Wishlist extends \Magento\Core\Model\AbstractModel $item = $this->_wishlistItemFactory->create(); $item->setProductId($product->getId()) ->setWishlistId($this->getId()) - ->setAddedAt(now()) + ->setAddedAt($this->dateTime->now()) ->setStoreId($storeId) ->setOptions($product->getCustomOptions()) ->setProduct($product) diff --git a/app/code/Magento/Wishlist/view/adminhtml/customer/edit/tab/wishlist.phtml b/app/code/Magento/Wishlist/view/adminhtml/customer/edit/tab/wishlist.phtml index 1254160ead4fc5167d9134a40e105d6d0ee32f45..878377174105363efd49ded9375d76f95f01f4cb 100644 --- a/app/code/Magento/Wishlist/view/adminhtml/customer/edit/tab/wishlist.phtml +++ b/app/code/Magento/Wishlist/view/adminhtml/customer/edit/tab/wishlist.phtml @@ -72,8 +72,8 @@ wishlistControl = { productConfigure.addListType( 'wishlist', { - urlFetch: '<?php echo $this->getUrl('*/customer_wishlist_product_composite_wishlist/configure') ?>', - urlConfirm: '<?php echo $this->getUrl('*/customer_wishlist_product_composite_wishlist/update') ?>' + urlFetch: '<?php echo $this->getUrl('customer/wishlist_product_composite_wishlist/configure') ?>', + urlConfirm: '<?php echo $this->getUrl('customer/wishlist_product_composite_wishlist/update') ?>' } ); //--> diff --git a/app/code/Magento/Wishlist/view/adminhtml/layout/adminhtml_customer_wishlist.xml b/app/code/Magento/Wishlist/view/adminhtml/layout/customer_index_wishlist.xml similarity index 96% rename from app/code/Magento/Wishlist/view/adminhtml/layout/adminhtml_customer_wishlist.xml rename to app/code/Magento/Wishlist/view/adminhtml/layout/customer_index_wishlist.xml index dfdfc1159dfbf3fcb392264cc1c5d784d17c6128..6b0ad6db1472bbb561557c31406a1cff29691f01 100644 --- a/app/code/Magento/Wishlist/view/adminhtml/layout/adminhtml_customer_wishlist.xml +++ b/app/code/Magento/Wishlist/view/adminhtml/layout/customer_index_wishlist.xml @@ -40,7 +40,7 @@ <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="customer.wishlist.edit.tab.columnSet"> <arguments> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">*/catalog_product/edit</item> + <item name="path" xsi:type="string">catalog/product/edit</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="id" xsi:type="string">getProductId</item> </item> @@ -52,7 +52,7 @@ <argument name="header" xsi:type="string" translate="true">Product</argument> <argument name="id" xsi:type="string">product_name</argument> <argument name="index" xsi:type="string">product_name</argument> - <argument name="renderer" xsi:type="string">Magento\Adminhtml\Block\Customer\Edit\Tab\View\Grid\Renderer\Item</argument> + <argument name="renderer" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\Tab\View\Grid\Renderer\Item</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="description"> @@ -60,7 +60,7 @@ <argument name="header" xsi:type="string" translate="true">User description</argument> <argument name="index" xsi:type="string">description</argument> <argument name="id" xsi:type="string">description</argument> - <argument name="renderer" xsi:type="string">Magento\Adminhtml\Block\Customer\Edit\Tab\Wishlist\Grid\Renderer\Description</argument> + <argument name="renderer" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\Tab\Wishlist\Grid\Renderer\Description</argument> </arguments> </block> <block class="Magento\Backend\Block\Widget\Grid\Column" as="qty"> @@ -101,7 +101,7 @@ <arguments> <argument name="header" xsi:type="string" translate="true">Action</argument> <argument name="index" xsi:type="string">wishlist_item_id</argument> - <argument name="renderer" xsi:type="string">Magento\Adminhtml\Block\Customer\Grid\Renderer\Multiaction</argument> + <argument name="renderer" xsi:type="string">Magento\Customer\Block\Adminhtml\Grid\Renderer\Multiaction</argument> <argument name="sortable" xsi:type="string">0</argument> <argument name="filter" xsi:type="string">0</argument> <argument name="actions" xsi:type="array"> diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_simple.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_simple.xml index 650858247fcc958e07a3d5870e2bd6b9ddfb66f3..5511ff2db5d60f8ded85ce921f5a9b1e07b8fca1 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_simple.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_simple.xml @@ -23,6 +23,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Configure Wishlist Item (Simple)" type="page" parent="wishlist_index_configure"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Configure Wishlist Item (Simple)" type="page"> <update handle="catalog_product_view_type_simple"/> </layout> diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_share.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_share.xml index 5ddc35bf88a12a375784ec5364768c1ee5bbcc90..ffda63b67f3bccb9922b6ba5077e3e0f1c48541c 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_share.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_share.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Customer My Account Wish List Sharing Form" type="page" parent="wishlist_index_index"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Customer My Account Wish List Sharing Form" type="page"> <update handle="customer_account"/> <referenceContainer name="my.account.wrapper"> <block class="Magento\Wishlist\Block\Customer\Sharing" name="wishlist.sharing" template="sharing.phtml"/> diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_shared_index.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_shared_index.xml index 39db3ab07c0668c1eee31c6bfa744e1f8d5aaa4e..7ed767417f843769f74d4fdd4f87dd54a09b9876 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_shared_index.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_shared_index.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Customer Shared Wish List View" type="page" parent="wishlist_index_share"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Customer Shared Wish List View" type="page"> <referenceContainer name="content"> <block class="Magento\Wishlist\Block\Share\Wishlist" name="customer.wishlist" template="shared.phtml"/> </referenceContainer> diff --git a/app/code/Magento/Wishlist/view/frontend/render/item/price_msrp_item.phtml b/app/code/Magento/Wishlist/view/frontend/render/item/price_msrp_item.phtml index b126f09a1665b95550fa9a478ce61a90d5ba5c28..617a7193877bc6f2b25ee0709b1ba1f4d7cb452e 100644 --- a/app/code/Magento/Wishlist/view/frontend/render/item/price_msrp_item.phtml +++ b/app/code/Magento/Wishlist/view/frontend/render/item/price_msrp_item.phtml @@ -52,14 +52,14 @@ <?php if ($_catalogHelper->isShowPriceOnGesture($_product)): ?> <?php $priceElementId = 'product-price-' . $_id . $this->getIdSuffix(); ?> <span id="<?php echo $priceElementId ?>" style="display:none"></span> - <?php $popupId = 'msrp-popup-' . $_id . $_coreHelper->getRandomString(20); ?> + <?php $popupId = 'msrp-popup-' . $_id . $this->getRandomString(20); ?> <a href="#" id="<?php echo($popupId);?>"><?php echo __('Click for price'); ?></a> <?php else: ?> <span class="msrp-price-hide-message"> <?php echo $_catalogHelper->getMsrpPriceMessage($_product) ?> </span> <?php endif; ?> - <?php $helpLinkId = 'msrp-help-' . $_id . $_coreHelper->getRandomString(20); ?> + <?php $helpLinkId = 'msrp-help-' . $_id . $this->getRandomString(20); ?> <a href="#" id="<?php echo($helpLinkId);?>"><?php echo __("What's this?"); ?></a> </div> <script type="text/javascript"> diff --git a/app/design/adminhtml/magento_backend/css/debug.css b/app/design/adminhtml/magento_backend/css/debug.css index 3dfb74027be10e8d0e1d49dc61f52f57fea88b33..9879625b94e33be573b1dce2e45cd2708d815352 100644 --- a/app/design/adminhtml/magento_backend/css/debug.css +++ b/app/design/adminhtml/magento_backend/css/debug.css @@ -694,7 +694,7 @@ th.required:after { .sales-recurring-profile-index .col-1-layout, .adminhtml-giftwrapping-index .col-1-layout, .sales-billing-agreement-index .col-1-layout, -.adminhtml-checkout-agreement-index .col-1-layout, +.checkout-agreement-index .col-1-layout, /* catalog */ .catalog-product-index .col-1-layout, .adminhtml-catalog-event-index .col-1-layout, @@ -712,19 +712,19 @@ th.required:after { .adminhtml-googleshopping-types-index .col-1-layout, .adminhtml-sitemap-index .col-1-layout, /* customers */ -.adminhtml-customer-online-index .col-1-layout, -.adminhtml-customer-index .col-1-layout, +.customer-online-index .col-1-layout, +.customer-index-index .col-1-layout, .adminhtml-customer-attribute-index .col-1-layout, .adminhtml-customer-address-attribute-index .col-1-layout, -.adminhtml-customer-group-index .col-1-layout, +.customer-group-index .col-1-layout, .adminhtml-customersegment-index .col-1-layout, .adminhtml-reward-rate-index .col-1-layout, .adminhtml-giftcardaccount-index .col-1-layout, .adminhtml-giftregistry-index .col-1-layout, .adminhtml-invitation-index .col-1-layout, /* promotions */ -.adminhtml-promo-catalog-index .col-1-layout, -.adminhtml-promo-quote-index .col-1-layout, +.catalog-rule-promo-catalog-index .col-1-layout, +.sales-rule-promo-quote-index .col-1-layout, .adminhtml-reminder-index .col-1-layout, /* newsletter */ .adminhtml-newsletter-template-index .col-1-layout, @@ -733,7 +733,8 @@ th.required:after { .adminhtml-newsletter-problem-index .col-1-layout, /* cms */ .adminhtml-cms-page-index .col-1-layout, -.adminhtml-cms-block-index .col-1-layout, +.cms-page-index .col-1-layout, +.cms-block-index .col-1-layout, .adminhtml-widget-instance-index .col-1-layout, .adminhtml-banner-index .col-1-layout, /* reports */ @@ -779,7 +780,8 @@ th.required:after { .tax-rate-index .col-1-layout, .adminhtml-system-currency-index .col-1-layout, .adminhtml-cache-index .col-1-layout, -.sales-order-status-index .col-1-layout { +.sales-order-status-index .col-1-layout, +.adminhtml-integration-index .col-1-layout { padding: 0; background: transparent; border: 0; @@ -795,7 +797,7 @@ th.required:after { .adminhtml-rma-index .page-actions, .adminhtml-giftwrapping-index .page-actions, .adminhtml-rma-item-attribute-index .page-actions, -.adminhtml-checkout-agreement-index .page-actions, +.checkout-agreement-index .page-actions, /* catalog */ .catalog-product-index .page-actions, .adminhtml-catalog-event-index .page-actions, @@ -810,24 +812,25 @@ th.required:after { .adminhtml-googleshopping-types-index .page-actions, .adminhtml-sitemap-index .page-actions, /* customers */ -.adminhtml-customer-index .page-actions, +.customer-index-index .page-actions, .adminhtml-customer-attribute-index .page-actions, .adminhtml-customer-address-attribute-index .page-actions, -.adminhtml-customer-group-index .page-actions, +.customer-group-index .page-actions, .adminhtml-customersegment-index .page-actions, .adminhtml-reward-rate-index .page-actions, .adminhtml-giftcardaccount-index .page-actions, .adminhtml-giftregistry-index .page-actions, .adminhtml-invitation-index .page-actions, /* promotions */ -.adminhtml-promo-catalog-index .page-actions, -.adminhtml-promo-quote-index .page-actions, +.catalog-rule-promo-catalog-index .page-actions, +.sales-rule-promo-quote-index .page-actions, .adminhtml-reminder-index .page-actions, /* newsletter */ .adminhtml-newsletter-template-index .page-actions, /* cms */ .adminhtml-cms-page-index .page-actions, -.adminhtml-cms-block-index .page-actions, +.cms-page-index .page-actions, +.cms-block-index .page-actions, .adminhtml-widget-instance-index .page-actions, .adminhtml-banner-index .page-actions, /* reports */ @@ -841,7 +844,8 @@ th.required:after { .adminhtml-user-index .page-actions, .adminhtml-user-role-index .page-actions, .tax-rule-index .page-actions, -.tax-rate-index .page-actions { +.tax-rate-index .page-actions, +.adminhtml-integration-index .page-actions { position: absolute; z-index: 2; margin-top: 8px; @@ -853,7 +857,7 @@ th.required:after { .adminhtml-rma-index .page-actions.fixed, .adminhtml-giftwrapping-index .page-actions.fixed, .adminhtml-rma-item-attribute-index .page-actions.fixed, -.adminhtml-checkout-agreement-index .page-actions.fixed, +.checkout-agreement-index .page-actions.fixed, /* catalog */ .catalog-product-index .page-actions.fixed, .adminhtml-catalog-event-index .page-actions.fixed, @@ -868,24 +872,25 @@ th.required:after { .adminhtml-googleshopping-types-index .page-actions.fixed, .adminhtml-sitemap-index .page-actions.fixed, /* customers */ -.adminhtml-customer-index .page-actions.fixed, +.customer-index-index .page-actions.fixed, .adminhtml-customer-attribute-index .page-actions.fixed, .adminhtml-customer-address-attribute-index .page-actions.fixed, -.adminhtml-customer-group-index .page-actions.fixed, +.customer-group-index .page-actions.fixed, .adminhtml-customersegment-index .page-actions.fixed, .adminhtml-reward-rate-index .page-actions.fixed, .adminhtml-giftcardaccount-index .page-actions.fixed, .adminhtml-giftregistry-index .page-actions.fixed, .adminhtml-invitation-index .page-actions.fixed, /* promotions */ -.adminhtml-promo-catalog-index .page-actions.fixed, -.adminhtml-promo-quote-index .page-actions.fixed, +.catalog-rule-promo-catalog-index .page-actions.fixed, +.sales-rule-promo-quote-index .page-actions.fixed, .adminhtml-reminder-index .page-actions.fixed, /* newsletter */ .adminhtml-newsletter-template-index .page-actions.fixed, /* cms */ .adminhtml-cms-page-index .page-actions.fixed, -.adminhtml-cms-block-index .page-actions.fixed, +.cms-page-index .page-actions.fixed, +.cms-block-index .page-actions.fixed, .adminhtml-widget-instance-index .page-actions.fixed, .adminhtml-banner-index .page-actions.fixed, /* reports */ @@ -899,7 +904,8 @@ th.required:after { .adminhtml-user-index .page-actions.fixed, .adminhtml-user-role-index .page-actions.fixed, .tax-rule-index .page-actions.fixed, -.tax-rate-index .page-actions.fixed { +.tax-rate-index .page-actions.fixed, +.adminhtml-integration-index .page-actions.fixed { left: 0; margin: 0; padding: 0 21px; @@ -910,7 +916,7 @@ th.required:after { .adminhtml-rma-index .page-actions .add, .adminhtml-giftwrapping-index .page-actions .add, .adminhtml-rma-item-attribute-index .page-actions .add, -.adminhtml-checkout-agreement-index .page-actions .add, +.checkout-agreement-index .page-actions .add, /* catalog */ .catalog-product-index .page-actions .btn-round > .action-default, .adminhtml-catalog-event-index .page-actions .add, @@ -925,24 +931,25 @@ th.required:after { .adminhtml-googleshopping-types-index .page-actions .add, .adminhtml-sitemap-index .page-actions .add, /* customers */ -.adminhtml-customer-index .page-actions .add, +.customer-index-index .page-actions .add, .adminhtml-customer-attribute-index .page-actions .add, .adminhtml-customer-address-attribute-index .page-actions .add, -.adminhtml-customer-group-index .page-actions .add, +.customer-group-index .page-actions .add, .adminhtml-customersegment-index .page-actions .add, .adminhtml-reward-rate-index .page-actions .add, .adminhtml-giftcardaccount-index .page-actions .add, .adminhtml-giftregistry-index .page-actions .add, .adminhtml-invitation-index .page-actions .add, /* promotions */ -.adminhtml-promo-catalog-index .page-actions .add, -.adminhtml-promo-quote-index .page-actions .add, +.catalog-rule-promo-catalog-index .page-actions .add, +.sales-rule-promo-quote-index .page-actions .add, .adminhtml-reminder-index .page-actions .add, /* newsletter */ .adminhtml-newsletter-template-index .page-actions .add, /* cms */ .adminhtml-cms-page-index .page-actions .add, -.adminhtml-cms-block-index .page-actions .add, +.cms-page-index .page-actions .add, +.cms-block-index .page-actions .add, .adminhtml-widget-instance-index .page-actions .add, .adminhtml-banner-index .page-actions .add, /* reports */ @@ -956,7 +963,8 @@ th.required:after { .adminhtml-user-index .page-actions .add, .adminhtml-user-role-index .page-actions .add, .tax-rule-index .page-actions .add, -.tax-rate-index .page-actions .add { +.tax-rate-index .page-actions .add, +.adminhtml-integration-index .page-actions .add { width: 32px; height: 32px; overflow: hidden; @@ -980,7 +988,7 @@ th.required:after { .eq-ie8 .adminhtml-rma-index .page-actions .add, .eq-ie8 .adminhtml-giftwrapping-index .page-actions .add, .eq-ie8 .adminhtml-rma-item-attribute-index .page-actions .add, -.eq-ie8 .adminhtml-checkout-agreement-index .page-actions .add, +.eq-ie8 .checkout-agreement-index .page-actions .add, /* catalog */ .eq-ie8 .catalog-product-index .page-actions .btn-round > .action-default, .eq-ie8 .adminhtml-catalog-event-index .page-actions .add, @@ -995,24 +1003,25 @@ th.required:after { .eq-ie8 .adminhtml-googleshopping-types-index .page-actions .add, .eq-ie8 .adminhtml-sitemap-index .page-actions .add, /* customers */ -.eq-ie8 .adminhtml-customer-index .page-actions .add, +.eq-ie8 .customer-index-index .page-actions .add, .eq-ie8 .adminhtml-customer-attribute-index .page-actions .add, .eq-ie8 .adminhtml-customer-address-attribute-index .page-actions .add, -.eq-ie8 .adminhtml-customer-group-index .page-actions .add, +.eq-ie8 .customer-group-index .page-actions .add, .eq-ie8 .adminhtml-customersegment-index .page-actions .add, .eq-ie8 .adminhtml-reward-rate-index .page-actions .add, .eq-ie8 .adminhtml-giftcardaccount-index .page-actions .add, .eq-ie8 .adminhtml-giftregistry-index .page-actions .add, .eq-ie8 .adminhtml-invitation-index .page-actions .add, /* promotions */ -.eq-ie8 .adminhtml-promo-catalog-index .page-actions .add, -.eq-ie8 .adminhtml-promo-quote-index .page-actions .add, +.eq-ie8 .catalog-rule-promo-catalog-index .page-actions .add, +.eq-ie8 .sales-rule-promo-quote-index .page-actions .add, .eq-ie8 .adminhtml-reminder-index .page-actions .add, /* newsletter */ .eq-ie8 .adminhtml-newsletter-template-index .page-actions .add, /* cms */ .eq-ie8 .adminhtml-cms-page-index .page-actions .add, -.eq-ie8 .adminhtml-cms-block-index .page-actions .add, +.eq-ie8 .cms-page-index .page-actions .add, +.eq-ie8 .cms-block-index .page-actions .add, .eq-ie8 .adminhtml-widget-instance-index .page-actions .add, .eq-ie8 .adminhtml-banner-index .page-actions .add, /* reports */ @@ -1026,7 +1035,8 @@ th.required:after { .eq-ie8 .adminhtml-user-index .page-actions .add, .eq-ie8 .adminhtml-user-role-index .page-actions .add, .eq-ie8 .tax-rule-index .page-actions .add, -.eq-ie8 .tax-rate-index .page-actions .add { +.eq-ie8 .tax-rate-index .page-actions .add, +.eq-ie8 .adminhtml-integration-index .page-actions .add { filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f58228', endColorstr='#f3731c',GradientType=0 ); } @@ -1034,7 +1044,7 @@ th.required:after { .adminhtml-rma-index .page-actions .add:hover, .adminhtml-giftwrapping-index .page-actions .add:hover, .adminhtml-rma-item-attribute-index .page-actions .add:hover, -.adminhtml-checkout-agreement-index .page-actions .add:hover, +.checkout-agreement-index .page-actions .add:hover, /* catalog */ .catalog-product-index .page-actions .btn-round > .action-default:hover, .adminhtml-catalog-event-index .page-actions .add:hover, @@ -1049,24 +1059,25 @@ th.required:after { .adminhtml-googleshopping-types-index .page-actions .add:hover, .adminhtml-sitemap-index .page-actions .add:hover, /* customers */ -.adminhtml-customer-index .page-actions .add:hover, +.customer-index-index .page-actions .add:hover, .adminhtml-customer-attribute-index .page-actions .add:hover, .adminhtml-customer-address-attribute-index .page-actions .add:hover, -.adminhtml-customer-group-index .page-actions .add:hover, +.customer-group-index .page-actions .add:hover, .adminhtml-customersegment-index .page-actions .add:hover, .adminhtml-reward-rate-index .page-actions .add:hover, .adminhtml-giftcardaccount-index .page-actions .add:hover, .adminhtml-giftregistry-index .page-actions .add:hover, .adminhtml-invitation-index .page-actions .add:hover, /* promotions */ -.adminhtml-promo-catalog-index .page-actions .add:hover, -.adminhtml-promo-quote-index .page-actions .add:hover, +.catalog-rule-promo-catalog-index .page-actions .add:hover, +.sales-rule-promo-quote-index .page-actions .add:hover, .adminhtml-reminder-index .page-actions .add:hover, /* newsletter */ .adminhtml-newsletter-template-index .page-actions .add:hover, /* cms */ .adminhtml-cms-page-index .page-actions .add:hover, -.adminhtml-cms-block-index .page-actions .add:hover, +.cms-page-index .page-actions .add:hover, +.cms-block-index .page-actions .add:hover, .adminhtml-widget-instance-index .page-actions .add:hover, .adminhtml-banner-index .page-actions .add:hover, /* reports */ @@ -1080,7 +1091,8 @@ th.required:after { .adminhtml-user-index .page-actions .add:hover, .adminhtml-user-role-index .page-actions .add:hover, .tax-rule-index .page-actions .add:hover, -.tax-rate-index .page-actions .add:hover { +.tax-rate-index .page-actions .add:hover, +.adminhtml-integration-index .page-actions .add:hover { border: 1px solid #e4731c; background: #e47821; background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2U0NzgyMSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNkZjY4MTciIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); @@ -1096,7 +1108,7 @@ th.required:after { .eq-ie8 .adminhtml-rma-index .page-actions .add:hover, .eq-ie8 .adminhtml-giftwrapping-index .page-actions .add:hover, .eq-ie8 .adminhtml-rma-item-attribute-index .page-actions .add:hover, -.eq-ie8 .adminhtml-checkout-agreement-index .page-actions .add:hover, +.eq-ie8 .checkout-agreement-index .page-actions .add:hover, /* catalog */ .eq-ie8 .catalog-product-index .page-actions .btn-round > .action-default:hover, .eq-ie8 .adminhtml-catalog-event-index .page-actions .add:hover, @@ -1111,24 +1123,24 @@ th.required:after { .eq-ie8 .adminhtml-googleshopping-types-index .page-actions .add:hover, .eq-ie8 .adminhtml-sitemap-index .page-actions .add:hover, /* customers */ -.eq-ie8 .adminhtml-customer-index .page-actions .add:hover, +.eq-ie8 .customer-index-index .page-actions .add:hover, .eq-ie8 .adminhtml-customer-attribute-index .page-actions .add:hover, .eq-ie8 .adminhtml-customer-address-attribute-index .page-actions .add:hover, -.eq-ie8 .adminhtml-customer-group-index .page-actions .add:hover, +.eq-ie8 .customer-group-index .page-actions .add:hover, .eq-ie8 .adminhtml-customersegment-index .page-actions .add:hover, .eq-ie8 .adminhtml-reward-rate-index .page-actions .add:hover, .eq-ie8 .adminhtml-giftcardaccount-index .page-actions .add:hover, .eq-ie8 .adminhtml-giftregistry-index .page-actions .add:hover, .eq-ie8 .adminhtml-invitation-index .page-actions .add:hover, /* promotions */ -.eq-ie8 .adminhtml-promo-catalog-index .page-actions .add:hover, -.eq-ie8 .adminhtml-promo-quote-index .page-actions .add:hover, +.eq-ie8 .catalog-rule-promo-catalog-index .page-actions .add:hover, +.eq-ie8 .sales-rule-promo-quote-index .page-actions .add:hover, .eq-ie8 .adminhtml-reminder-index .page-actions .add:hover, /* newsletter */ .eq-ie8 .adminhtml-newsletter-template-index .page-actions .add:hover, /* cms */ -.eq-ie8 .adminhtml-cms-page-index .page-actions .add:hover, -.eq-ie8 .adminhtml-cms-block-index .page-actions .add:hover, +.eq-ie8 .cms-page-index .page-actions .add:hover, +.eq-ie8 .cms-block-index .page-actions .add:hover, .eq-ie8 .adminhtml-widget-instance-index .page-actions .add:hover, .eq-ie8 .adminhtml-banner-index .page-actions .add:hover, /* reports */ @@ -1142,7 +1154,8 @@ th.required:after { .eq-ie8 .adminhtml-user-index .page-actions .add:hover, .eq-ie8 .adminhtml-user-role-index .page-actions .add:hover, .eq-ie8 .tax-rule-index .page-actions .add:hover, -.eq-ie8 .tax-rate-index .page-actions .add:hover { +.eq-ie8 .tax-rate-index .page-actions .add:hover, +.eq-ie8 .adminhtml-integration-index .page-actions .add:hover { filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e47821', endColorstr='#df6817',GradientType=0 ); } @@ -1150,7 +1163,7 @@ th.required:after { .adminhtml-rma-index .page-actions .add:active, .adminhtml-giftwrapping-index .page-actions .add:active, .adminhtml-rma-item-attribute-index .page-actions .add:active, -.adminhtml-checkout-agreement-index .page-actions .add:active, +.checkout-agreement-index .page-actions .add:active, /* catalog */ .catalog-product-index .page-actions .btn-round > .action-default:active, .adminhtml-catalog-event-index .page-actions .add:active, @@ -1165,24 +1178,25 @@ th.required:after { .adminhtml-googleshopping-types-index .page-actions .add:active, .adminhtml-sitemap-index .page-actions .add:active, /* customers */ -.adminhtml-customer-index .page-actions .add:active, +.customer-index-index .page-actions .add:active, .adminhtml-customer-attribute-index .page-actions .add:active, .adminhtml-customer-address-attribute-index .page-actions .add:active, -.adminhtml-customer-group-index .page-actions .add:active, +.customer-group-index .page-actions .add:active, .adminhtml-customersegment-index .page-actions .add:active, .adminhtml-reward-rate-index .page-actions .add:active, .adminhtml-giftcardaccount-index .page-actions .add:active, .adminhtml-giftregistry-index .page-actions .add:active, .adminhtml-invitation-index .page-actions .add:active, /* promotions */ -.adminhtml-promo-catalog-index .page-actions .add:active, -.adminhtml-promo-quote-index .page-actions .add:active, +.catalog-rule-promo-catalog-index .page-actions .add:active, +.sales-rule-promo-quote-index .page-actions .add:active, .adminhtml-reminder-index .page-actions .add:active, /* newsletter */ .adminhtml-newsletter-template-index .page-actions .add:active, /* cms */ .adminhtml-cms-page-index .page-actions .add:active, -.adminhtml-cms-block-index .page-actions .add:active, +.cms-page-index .page-actions .add:active, +.cms-block-index .page-actions .add:active, .adminhtml-widget-instance-index .page-actions .add:active, .adminhtml-banner-index .page-actions .add:active, /* reports */ @@ -1196,7 +1210,8 @@ th.required:after { .adminhtml-user-index .page-actions .add:active, .adminhtml-user-role-index .page-actions .add:active, .tax-rule-index .page-actions .add:active, -.tax-rate-index .page-actions .add:active { +.tax-rate-index .page-actions .add:active, +.adminhtml-integration-index .page-actions .add:active { background: #e2701av; -webkit-box-shadow: inset 0px 1px 1px 1px rgba(185, 90, 19, 1); box-shadow: inset 0px 1px 1px 1px rgba(185, 90, 19, 1); @@ -1208,7 +1223,7 @@ th.required:after { .adminhtml-rma-index .page-actions .add > span, .adminhtml-rma-item-attribute-index .page-actions .add > span, .adminhtml-giftwrapping-index .page-actions .add > span, -.adminhtml-checkout-agreement-index .page-actions .add > span, +.checkout-agreement-index .page-actions .add > span, /* catalog */ .catalog-product-index .page-actions .btn-round > .action-default > span, .adminhtml-catalog-event-index .page-actions .add > span, @@ -1223,24 +1238,25 @@ th.required:after { .adminhtml-googleshopping-types-index .page-actions .add > span, .adminhtml-sitemap-index .page-actions .add > span, /* customers */ -.adminhtml-customer-index .page-actions .add > span, +.customer-index-index .page-actions .add > span, .adminhtml-customer-attribute-index .page-actions .add > span, .adminhtml-customer-address-attribute-index .page-actions .add > span, -.adminhtml-customer-group-index .page-actions .add > span, +.customer-group-index .page-actions .add > span, .adminhtml-customersegment-index .page-actions .add > span, .adminhtml-reward-rate-index .page-actions .add > span, .adminhtml-giftcardaccount-index .page-actions .add > span, .adminhtml-giftregistry-index .page-actions .add > span, .adminhtml-invitation-index .page-actions .add > span, /* promotions */ -.adminhtml-promo-catalog-index .page-actions .add > span, -.adminhtml-promo-quote-index .page-actions .add > span, +.catalog-rule-promo-catalog-index .page-actions .add > span, +.sales-rule-promo-quote-index .page-actions .add > span, .adminhtml-reminder-index .page-actions .add > span, /* newsletter */ .adminhtml-newsletter-template-index .page-actions .add > span, /* cms */ .adminhtml-cms-page-index .page-actions .add > span, -.adminhtml-cms-block-index .page-actions .add > span, +.cms-page-index .page-actions .add > span, +.cms-block-index .page-actions .add > span, .adminhtml-widget-instance-index .page-actions .add > span, .adminhtml-banner-index .page-actions .add > span, /* reports */ @@ -1254,7 +1270,8 @@ th.required:after { .adminhtml-user-index .page-actions .add > span, .adminhtml-user-role-index .page-actions .add > span, .tax-rule-index .page-actions .add > span, -.tax-rate-index .page-actions .add > span { +.tax-rate-index .page-actions .add > span, +.adminhtml-integration-index .page-actions .add > span { text-indent: -999em; display: block; width: 32px; @@ -1265,7 +1282,7 @@ th.required:after { .adminhtml-rma-index .page-actions .add > span:before, .adminhtml-giftwrapping-index .page-actions .add > span:before, .adminhtml-rma-item-attribute-index .page-actions .add > span:before, -.adminhtml-checkout-agreement-index .page-actions .add > span:before, +.checkout-agreement-index .page-actions .add > span:before, /* catalog */ .catalog-product-index .page-actions .btn-round > .action-default > span:before, .adminhtml-catalog-event-index .page-actions .add > span:before, @@ -1280,24 +1297,25 @@ th.required:after { .adminhtml-googleshopping-types-index .page-actions .add > span:before, .adminhtml-sitemap-index .page-actions .add > span:before, /* customers */ -.adminhtml-customer-index .page-actions .add > span:before, +.customer-index-index .page-actions .add > span:before, .adminhtml-customer-attribute-index .page-actions .add > span:before, .adminhtml-customer-address-attribute-index .page-actions .add > span:before, -.adminhtml-customer-group-index .page-actions .add > span:before, +.customer-group-index .page-actions .add > span:before, .adminhtml-customersegment-index .page-actions .add > span:before, .adminhtml-reward-rate-index .page-actions .add > span:before, .adminhtml-giftcardaccount-index .page-actions .add > span:before, .adminhtml-giftregistry-index .page-actions .add > span:before, .adminhtml-invitation-index .page-actions .add > span:before, /* promotions */ -.adminhtml-promo-catalog-index .page-actions .add > span:before, -.adminhtml-promo-quote-index .page-actions .add > span:before, +.catalog-rule-promo-catalog-index .page-actions .add > span:before, +.sales-rule-promo-quote-index .page-actions .add > span:before, .adminhtml-reminder-index .page-actions .add > span:before, /* newsletter */ .adminhtml-newsletter-template-index .page-actions .add > span:before, /* cms */ .adminhtml-cms-page-index .page-actions .add > span:before, -.adminhtml-cms-block-index .page-actions .add > span:before, +.cms-page-index .page-actions .add > span:before, +.cms-block-index .page-actions .add > span:before, .adminhtml-widget-instance-index .page-actions .add > span:before, .adminhtml-banner-index .page-actions .add > span:before, /* reports */ @@ -1311,7 +1329,8 @@ th.required:after { .adminhtml-user-index .page-actions .add > span:before, .adminhtml-user-role-index .page-actions .add > span:before, .tax-rule-index .page-actions .add > span:before, -.tax-rate-index .page-actions .add > span:before { +.tax-rate-index .page-actions .add > span:before, +.adminhtml-integration-index .page-actions .add > span:before { text-indent: 0; font-family: 'MUI-Icons'; font-weight: normal; @@ -1431,7 +1450,7 @@ th.required:after { .adminhtml-rma-index .grid-actions, .adminhtml-giftwrapping-index .grid-actions, .adminhtml-rma-item-attribute-index .grid-actions, -.adminhtml-checkout-agreement-index .grid-actions, +.checkout-agreement-index .grid-actions, /* catalog */ .catalog-product-index .grid-actions, .adminhtml-catalog-event-index .grid-actions, @@ -1446,24 +1465,25 @@ th.required:after { .adminhtml-googleshopping-types-index .grid-actions, .adminhtml-sitemap-index .grid-actions, /* customers */ -.adminhtml-customer-index .grid-actions, +.customer-index-index .grid-actions, .adminhtml-customer-attribute-index .grid-actions, .adminhtml-customer-address-attribute-index .grid-actions, -.adminhtml-customer-group-index .grid-actions, +.customer-group-index .grid-actions, .adminhtml-customersegment-index .grid-actions, .adminhtml-reward-rate-index .grid-actions, .adminhtml-giftcardaccount-index .grid-actions, .adminhtml-giftregistry-index .grid-actions, .adminhtml-invitation-index .grid-actions, /* promotions */ -.adminhtml-promo-catalog-index .grid-actions, -.adminhtml-promo-quote-index .grid-actions, +.catalog-rule-promo-catalog-index .grid-actions, +.sales-rule-promo-quote-index .grid-actions, .adminhtml-reminder-index .grid-actions, /* newsletter */ .adminhtml-newsletter-template-index .grid-actions, /* cms */ .adminhtml-cms-page-index .grid-actions, -.adminhtml-cms-block-index .grid-actions, +.cms-page-index .grid-actions, +.cms-block-index .grid-actions, .adminhtml-widget-instance-index .grid-actions, .adminhtml-banner-index .grid-actions, /* reports */ @@ -1477,7 +1497,8 @@ th.required:after { .adminhtml-user-index .grid-actions, .adminhtml-user-role-index .grid-actions, .tax-rule-index .grid-actions, -.tax-rate-index .grid-actions { +.tax-rate-index .grid-actions, +.adminhtml-integration-index .grid-actions { border-radius: 5px 5px 0 0; margin-top: 20px; padding-left: 100px; @@ -1537,11 +1558,11 @@ th.required:after { padding-left: 80px; } -.adminhtml-promo-catalog-index .grid-actions { +.catalog-rule-promo-catalog-index .grid-actions { padding-left: 210px; } -.adminhtml-promo-catalog-index .page-actions .apply { +.catalog-rule-promo-catalog-index .page-actions .apply { float: right; margin: 3px 0 0 10px; } diff --git a/app/design/adminhtml/magento_backend/css/pages.css b/app/design/adminhtml/magento_backend/css/pages.css index 9a7c6b0d09a44acca6c7e45f1f06230a1a883ab6..fd1fd798dd86614441e1f15343e5890e1ecb525a 100644 --- a/app/design/adminhtml/magento_backend/css/pages.css +++ b/app/design/adminhtml/magento_backend/css/pages.css @@ -1854,7 +1854,7 @@ } .adminhtml-giftwrapping-index .col-id, -.adminhtml-checkout-agreement-index .col-id, +.checkout-agreement-index .col-id, [class^=" sales-billing-"] .col-id, [class^=" sales-transactions-"] .col-id { width: 35px; @@ -1879,7 +1879,7 @@ [class^=" adminhtml-rma-"] .col-required, [class^=" adminhtml-rma-"] .col-system, [class^=" adminhtml-rma-"] .col-visible-on-front, -.adminhtml-checkout-agreement-index .col-status, +.checkout-agreement-index .col-status, .adminhtml-rma-item-attribute-edit .col-position { text-align: right; white-space: nowrap; @@ -1984,7 +1984,7 @@ } .adminhtml-giftwrapping-index .col-websites, -.adminhtml-checkout-agreement-index .col-store-view { +.checkout-agreement-index .col-store-view { white-space: nowrap; width: 200px; } diff --git a/app/design/frontend/magento_backup/Magento_Paypal/express/shortcut.phtml b/app/design/frontend/magento_backup/Magento_Paypal/express/shortcut.phtml index e79714b90dc5a3d1ea47598f5aa5fa8db697ec5b..8db827ddaa703c70ca9c9069b7571daf2588c3e1 100644 --- a/app/design/frontend/magento_backup/Magento_Paypal/express/shortcut.phtml +++ b/app/design/frontend/magento_backup/Magento_Paypal/express/shortcut.phtml @@ -56,7 +56,7 @@ "<?php echo $this->getViewFileUrl('Magento_Paypal::js/paypal-checkout.js') ?>", function() { $('.paypal-logo').paypalCheckout({ - confirmMessage: "<?php echo $this->helper('Magento\Core\Helper\Data')->jsQuoteEscape($this->getConfirmationMessage())?>", + confirmMessage: "<?php echo $this->escapeJsQuote($this->getConfirmationMessage())?>", confirmUrl: "<?php echo !empty($confirmationUrl) ? $confirmationUrl : false ?>", isCatalogProduct: "<?php echo !empty($isInCatalogProduct) ? $isInCatalogProduct : false ?>", paypalCheckoutSelector: '#pp-checkout-url', diff --git a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_express_review_details.xml b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_express_review_details.xml index 6de51a8c3a0393679233d16ca8157160e9e3c101..f340c6287044ac02cbf05c40f9695db510518968 100644 --- a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_express_review_details.xml +++ b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_express_review_details.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Paypal\Block\Express\Review\Details" output="1" name="paypal.express.review.details" template="express/review/details.phtml"> + <block class="Magento\Paypal\Block\Express\Review\Details" output="1" name="root" template="express/review/details.phtml"> <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="onepage/review/item.phtml"/> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="onepage/review/item.phtml"/> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="onepage/review/item.phtml"/> diff --git a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_hostedpro_cancel.xml b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_hostedpro_cancel.xml index bcdd5b3d58adc0713268b7cdeacf5f503155cc9d..e40967effa8e0758ecd7ae1e10d4198021135015 100644 --- a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_hostedpro_cancel.xml +++ b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_hostedpro_cancel.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Hosted Pro Frame" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Hosted\Pro\Iframe" name="hosted.pro.iframe" template="hss/redirect.phtml"/> - </block> + <block class="Magento\Paypal\Block\Hosted\Pro\Iframe" name="hosted.pro.iframe" output="1" template="hss/redirect.phtml"/> </layout> diff --git a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_cancelpayment.xml b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_cancelpayment.xml index 9b96ede33cb0acd2b577bbd69179a3ea696e6321..2d6206809a423847fde23e6a8489c8b9c4e2d253 100644 --- a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_cancelpayment.xml +++ b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_cancelpayment.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Cancel Payment" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" template="payflowlink/redirect.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" output="1" template="payflowlink/redirect.phtml"/> </layout> diff --git a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_form.xml b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_form.xml index 47df5abbee0d64ec2799a45f22a195d3d74c26d3..c8a142b6b66a4d33ef84c219d549ff5968e1fbfc 100644 --- a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_form.xml +++ b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_form.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Form" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" template="payflowlink/form.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" output="1" template="payflowlink/form.phtml"/> </layout> diff --git a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_returnurl.xml b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_returnurl.xml index 817f34824aa4b0db6a6d3ff6c7da4627c10e6b7d..2dbd4cc55ec90c1d6e5ee9273cf9941744cba78c 100644 --- a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_returnurl.xml +++ b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflow_returnurl.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Return URL" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" template="payflowlink/redirect.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Link\Iframe" name="payflow.link.iframe" output="1" template="payflowlink/redirect.phtml"/> </layout> diff --git a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_cancelpayment.xml b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_cancelpayment.xml index ec688ce2f1cc5d6eacc0e0ca402cc2c2365d815c..b0bd45e752744e4b7acf0a6df0e5240c162ecf50 100644 --- a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_cancelpayment.xml +++ b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_cancelpayment.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Advanced Cancel Payment" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" template="payflowadvanced/redirect.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" template="payflowadvanced/redirect.phtml"/> </layout> diff --git a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_form.xml b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_form.xml index 20dc05ce077d93507f01ec2b91762e390b6eea2e..5f48316a8c43a165446fb5309b4dc50853bf167a 100644 --- a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_form.xml +++ b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_form.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Advanced Form" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" template="payflowadvanced/form.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" template="payflowadvanced/form.phtml"/> </layout> diff --git a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_returnurl.xml b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_returnurl.xml index fcf21c97f04ec2060319b879ad246bee413d454e..69c7a612956cfff45ec076d8b8695b44d902a13a 100644 --- a/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_returnurl.xml +++ b/app/design/frontend/magento_backup/Magento_Paypal/layout/override/paypal_payflowadvanced_returnurl.xml @@ -24,7 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Paypal Payflow Advanced Return URL" type="page"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" template="payflowadvanced/redirect.phtml"/> - </block> + <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" template="payflowadvanced/redirect.phtml"/> </layout> diff --git a/app/design/frontend/magento_backup/Magento_PaypalUk/layput/override/paypal_express_review_details.xml b/app/design/frontend/magento_backup/Magento_PaypalUk/layput/override/paypal_express_review_details.xml index e60382310eda6d7ac3cbdb1330cc8ad964d138a4..2ac04b323fbf9977449c32616dbdd1ffa45a116b 100644 --- a/app/design/frontend/magento_backup/Magento_PaypalUk/layput/override/paypal_express_review_details.xml +++ b/app/design/frontend/magento_backup/Magento_PaypalUk/layput/override/paypal_express_review_details.xml @@ -24,12 +24,10 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"> - <block class="Magento\Paypal\Block\Express\Review\Details" name="paypal.express.review.details" template="express/review/details.phtml"> - <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="onepage/review/item.phtml"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="onepage/review/item.phtml"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="onepage/review/item.phtml"/> - <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="onepage/review/totals.phtml"/> - </block> + <block class="Magento\Paypal\Block\Express\Review\Details" name="root" output="1" template="express/review/details.phtml"> + <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="onepage/review/item.phtml"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="onepage/review/item.phtml"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="onepage/review/item.phtml"/> + <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="onepage/review/totals.phtml"/> </block> </layout> diff --git a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_billing_agreement_index.xml b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_billing_agreement_index.xml index 70ae62068e255cf63092a4152ce35ccb92bb3a24..0eb79578e40dda86d79ce69b24bdcdc6a5477ebe 100644 --- a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_billing_agreement_index.xml +++ b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_billing_agreement_index.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Billing Agreement" type="page" parent="customer_account_index"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Billing Agreement" type="page"> <update handle="customer_account"/> <referenceBlock name="root"> <action method="setTemplate"> diff --git a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_billing_agreement_view.xml b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_billing_agreement_view.xml index 038fd3576a19ffd5c0fd8d40bdae97451e1c33d0..9093b37040432a5f1e3cd3d22cebfe85bccb816a 100644 --- a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_billing_agreement_view.xml +++ b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_billing_agreement_view.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Billing Agreement View" type="page" parent="sales_billing_agreement_index"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Billing Agreement View" type="page"> <update handle="customer_account"/> <referenceBlock name="root"> <action method="setTemplate"> diff --git a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_guest_printorder.xml b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_guest_printorder.xml index 5a1ff2d5430e6e9cc6c34aab12b67b5fcb8b2c9a..76c4e6475afd879b53f738005ea59799e0086ec0 100644 --- a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_guest_printorder.xml +++ b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_guest_printorder.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Sales Order Print View" type="page" parent="print"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Sales Order Print View" type="page"> <referenceContainer name="content"> <block class="Magento\Sales\Block\Order\PrintShipment" name="sales.order.print" template="order/print.phtml"> <block class="Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer" as="default" template="order/items/renderer/default.phtml"/> diff --git a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_index.xml b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_index.xml index 36d4758c9a0bccd64321b115728b2459918a9176..57be56d1936123bc9b044d5f2aad1b43353f0879 100644 --- a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_index.xml +++ b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_index.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Recurring Profile" type="page" parent="customer_account_index"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Recurring Profile" type="page"> <update handle="customer_account"/> <referenceBlock name="root"> <action method="setTemplate"> diff --git a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_orders.xml b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_orders.xml index 7172f01d739c1fcc66bb5344a4e28781b55543b0..f4266eab8eda9d34668edfdaff8623e16ed0dcc2 100644 --- a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_orders.xml +++ b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_orders.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Recurring Profile Orders List" type="page" parent="sales_recurring_profile_view__tabs"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Recurring Profile Orders List" type="page"> <update handle="customer_account"/> <update handle="sales_recurring_profile_view__tabs"/> <referenceBlock name="sales.recurring.profile.view.tab.orders"> diff --git a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_view.xml b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_view.xml index ee5837b43e6a05093282715f0f2d6a0296ad97c0..816ad80e9be791cb87978598184ca5bbb75e858b 100644 --- a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_view.xml +++ b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_view.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Recurring Profile View" type="page" parent="sales_recurring_profile_view__tabs"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Recurring Profile View" type="page"> <update handle="customer_account"/> <update handle="sales_recurring_profile_view__tabs"/> <referenceBlock name="sales.recurring.profile.view.tab.profile"> diff --git a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_view__tabs.xml b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_view__tabs.xml index 4110ed7fbf7f5409a35cbdc26db08cf8b6a2480c..6900e63f006aedf5b39b851e89890cffb2072fb6 100644 --- a/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_view__tabs.xml +++ b/app/design/frontend/magento_backup/Magento_Sales/layout/override/sales_recurring_profile_view__tabs.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Recurring Profile View Tabs" type="page" parent="sales_recurring_profile_index"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Recurring Profile View Tabs" type="page"> <referenceBlock name="root"> <action method="setTemplate"> <argument name="template" xsi:type="string">2columns-left.phtml</argument> diff --git a/app/design/frontend/magento_backup/Magento_Sales/order/creditmemo/items/renderer/default.phtml b/app/design/frontend/magento_backup/Magento_Sales/order/creditmemo/items/renderer/default.phtml index 5f717e6a19af4a9262c6eee1a1d656ba6de57e82..d771a7efa8bad4dca336238e43cf09d46fc43eeb 100644 --- a/app/design/frontend/magento_backup/Magento_Sales/order/creditmemo/items/renderer/default.phtml +++ b/app/design/frontend/magento_backup/Magento_Sales/order/creditmemo/items/renderer/default.phtml @@ -59,7 +59,7 @@ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" aria-controls="order-item-gift-message-<?php echo $_item->getId()?>" data-item-id="<?php echo $_item->getId()?>"><?php echo __('Gift Message') ?></a> <?php endif; ?> </td> - <td><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="a-right"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/design/frontend/magento_backup/Magento_Sales/order/invoice/items/renderer/default.phtml b/app/design/frontend/magento_backup/Magento_Sales/order/invoice/items/renderer/default.phtml index c07b48bc77cfad314d3c79805f0ebc2805342ca1..45313d9463376f21bb6ce32bec1eb89ae09bb0cb 100644 --- a/app/design/frontend/magento_backup/Magento_Sales/order/invoice/items/renderer/default.phtml +++ b/app/design/frontend/magento_backup/Magento_Sales/order/invoice/items/renderer/default.phtml @@ -60,7 +60,7 @@ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" aria-controls="order-item-gift-message-<?php echo $_item->getId()?>" data-item-id="<?php echo $_item->getId()?>"><?php echo __('Gift Message') ?></a> <?php endif; ?> </td> - <td><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="a-right"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> <span class="price-excl-tax"> @@ -87,7 +87,7 @@ </span> - + <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($this->getItem())): ?> <span class="cart-tax-info" id="eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;"> diff --git a/app/design/frontend/magento_backup/Magento_Sales/order/items/renderer/default.phtml b/app/design/frontend/magento_backup/Magento_Sales/order/items/renderer/default.phtml index f527029e49e8e433d610f7623b2eca45df28e702..8b96cbcb9fee3dcde78ec562b87bad258eb1b2d2 100644 --- a/app/design/frontend/magento_backup/Magento_Sales/order/items/renderer/default.phtml +++ b/app/design/frontend/magento_backup/Magento_Sales/order/items/renderer/default.phtml @@ -61,7 +61,7 @@ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" aria-controls="order-item-gift-message-<?php echo $_item->getId()?>" data-item-id="<?php echo $_item->getId()?>"><?php echo __('Gift Message') ?></a> <?php endif; ?> </td> - <td><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="a-right"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/design/frontend/magento_plushe/Magento_Bundle/sales/order/items/renderer.phtml b/app/design/frontend/magento_plushe/Magento_Bundle/sales/order/items/renderer.phtml index 3692830fff3e057ce52814818fe1d04359a30de4..45b77530802aef9ec7a482c37f001902782abc38 100644 --- a/app/design/frontend/magento_plushe/Magento_Bundle/sales/order/items/renderer.phtml +++ b/app/design/frontend/magento_plushe/Magento_Bundle/sales/order/items/renderer.phtml @@ -23,6 +23,8 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> <?php $parentItem = $this->getItem() ?> <?php $items = array_merge(array($parentItem), $parentItem->getChildrenItems()); ?> @@ -56,7 +58,7 @@ <?php else: ?> <td class="col value"><div class="option value"><?php echo $this->getValueHtml($_item)?></div></td> <?php endif; ?> - <td class="col sku"><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($_item->getSku())) ?></td> + <td class="col sku"><?php echo $this->prepareSku($_item->getSku()) ?></td> <td class="col price"> <?php if (!$_item->getParentItem()): ?> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> diff --git a/app/design/frontend/magento_plushe/Magento_Catalog/product/view/base-image.phtml b/app/design/frontend/magento_plushe/Magento_Catalog/product/view/base-image.phtml index a46a1b61be17464382b58bf84d45bd1e8fa60766..e8ab0f4616b6ce1df48cef29afd3829bd3919015 100644 --- a/app/design/frontend/magento_plushe/Magento_Catalog/product/view/base-image.phtml +++ b/app/design/frontend/magento_plushe/Magento_Catalog/product/view/base-image.phtml @@ -75,8 +75,8 @@ swapNotices: false, isOldMode: <?php print $_isOldDisplayMode; ?>, messages: { - noticeDefault: '<?php echo $this->jsQuoteEscape(__("Click on image to zoom")) ?>', - loadingMessage: '<?php echo $this->jsQuoteEscape(__("Loading...")) ?>' + noticeDefault: '<?php echo $this->escapeJsQuote(__("Click on image to zoom")) ?>', + loadingMessage: '<?php echo $this->escapeJsQuote(__("Loading...")) ?>' } }); <?php else: ?> @@ -91,8 +91,8 @@ swapNotices: true, isOldMode: <?php print $_isOldDisplayMode; ?>, messages: { - noticeDefault: '<?php echo $this->jsQuoteEscape(__("Click on image to zoom")) ?>', - noticeLightBox: '<?php echo $this->jsQuoteEscape(__("Click on image to view it full sized")) ?>', loadingMessage: '<?php echo $this->jsQuoteEscape(__("Loading...")) ?>' + noticeDefault: '<?php echo $this->escapeJsQuote(__("Click on image to zoom")) ?>', + noticeLightBox: '<?php echo $this->escapeJsQuote(__("Click on image to view it full sized")) ?>', loadingMessage: '<?php echo $this->escapeJsQuote(__("Loading...")) ?>' } }); <?php endif; ?> diff --git a/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml b/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml index 65f32a6e195ca1fc644471a839db811d149cd526..6d2f675ae55e4d4ef42124bcea4bdebeb7be7a97 100644 --- a/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml +++ b/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml @@ -23,6 +23,8 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\Downloadable\Block\Sales\Order\Item\Renderer\Downloadable */ ?> <?php $_item = $this->getItem() ?> <?php $_order = $this->getItem()->getOrderItem()->getOrder() ?> @@ -72,7 +74,7 @@ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" aria-controls="order-item-gift-message-<?php echo $_item->getId()?>" data-item-id="<?php echo $_item->getId()?>"><?php echo __('Gift Message') ?></a> <?php endif; ?> </td> - <td class="col sku"><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td class="col sku"><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="col price"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/invoice/items/renderer/downloadable.phtml b/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/invoice/items/renderer/downloadable.phtml index cc6e3bad1652cb2f0b8d515405f89703cac33792..5df170eecb4f30d7a91b41bfb43dbdf3506ef71e 100644 --- a/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/invoice/items/renderer/downloadable.phtml +++ b/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/invoice/items/renderer/downloadable.phtml @@ -22,6 +22,8 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\Downloadable\Block\Sales\Order\Item\Renderer\Downloadable */ ?> <?php $_item = $this->getItem() ?> <?php $_order = $this->getItem()->getOrderItem()->getOrder() ?> @@ -70,7 +72,7 @@ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" aria-controls="order-item-gift-message-<?php echo $_item->getId()?>" data-item-id="<?php echo $_item->getId()?>"><?php echo __('Gift Message') ?></a> <?php endif; ?> </td> - <td class="col sku"><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td class="col sku"><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="col price"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/items/renderer/downloadable.phtml b/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/items/renderer/downloadable.phtml index 5b73ec009c1d646231d4d556d4dbb1bf9d53cec8..8b0a06a9a83043bd90d682143b7e4ea1c594db3c 100644 --- a/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/items/renderer/downloadable.phtml +++ b/app/design/frontend/magento_plushe/Magento_Downloadable/sales/order/items/renderer/downloadable.phtml @@ -22,6 +22,8 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\Downloadable\Block\Sales\Order\Item\Renderer\Downloadable */ ?> <?php $_item = $this->getItem() ?> <tr id="order-item-row-<?php echo $_item->getId() ?>"> @@ -77,7 +79,7 @@ </a> <?php endif; ?> </td> - <td class="col sku"><?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\String')->splitInjection($this->getSku())) ?></td> + <td class="col sku"><?php echo $this->prepareSku($this->getSku()) ?></td> <td class="col price"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?> <span class="price-excl-tax"> diff --git a/app/design/frontend/magento_plushe/Magento_Sendfriend/send.phtml b/app/design/frontend/magento_plushe/Magento_Sendfriend/send.phtml index 998017fe960d58193598e19b45c58031efb7a26e..b4ee62ed58c8fc278df965c25aa8fb657bb4132d 100644 --- a/app/design/frontend/magento_plushe/Magento_Sendfriend/send.phtml +++ b/app/design/frontend/magento_plushe/Magento_Sendfriend/send.phtml @@ -30,7 +30,7 @@ */ ?> <script id="add-recipient-tmpl" type="text/x-jQuery-tmpl"> - <a href="delete_email" id="btn-remove${_index_}" class="action delete" title="<?php echo $this->jsQuoteEscape(__('Remove Email')) ?>"><span><?php echo $this->jsQuoteEscape(__('Remove Email')) ?></span></a> + <a href="delete_email" id="btn-remove${_index_}" class="action delete" title="<?php echo $this->escapeJsQuote(__('Remove Email')) ?>"><span><?php echo $this->escapeJsQuote(__('Remove Email')) ?></span></a> <div class="field name required"> <label for="recipients-name${_index_}" class="label"><span><?php echo __('Name:')?></span></label> diff --git a/app/design/frontend/magento_plushe/Magento_Wishlist/layout/override/base/wishlist_shared_index.xml b/app/design/frontend/magento_plushe/Magento_Wishlist/layout/override/base/wishlist_shared_index.xml index 1e6bd663cc6735410b2ee6ac78a26e6e96de961a..bfa717b7ee2e5d58e1af98ac14ab356d5acdc005 100644 --- a/app/design/frontend/magento_plushe/Magento_Wishlist/layout/override/base/wishlist_shared_index.xml +++ b/app/design/frontend/magento_plushe/Magento_Wishlist/layout/override/base/wishlist_shared_index.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Customer Shared Wishlist View" type="page" parent="wishlist_index_share"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Customer Shared Wishlist View" type="page"> <referenceContainer name="content"> <block class="Magento\Wishlist\Block\Share\Wishlist" name="customer.wishlist" template="shared.phtml"/> </referenceContainer> diff --git a/app/design/frontend/magento_plushe/js/theme.js b/app/design/frontend/magento_plushe/js/theme.js index d4a340719e91a22c5c12ef7a8616cf795a19c5c3..81262c4b16fb6292f382f2bbdd31b5c6cef5d27b 100644 --- a/app/design/frontend/magento_plushe/js/theme.js +++ b/app/design/frontend/magento_plushe/js/theme.js @@ -29,9 +29,9 @@ var list = $('[data-action="scroll"]').addClass('carousel'); var listInner = $('> .minilist.items', list); var items = $('.item', list); - var itemWidth = $(items[0]).outerWidth(); - var perpage = Math.floor(list.outerWidth()/itemWidth); - var pages = Math.floor(items.length/perpage); + var itemWidth = $(items).length ? $(items[0]).outerWidth() : null; + var perpage = (itemWidth !== null) ? Math.floor(list.outerWidth()/itemWidth) : null; + var pages = (perpage !== null) ? Math.floor(items.length/perpage) : null; var page=0; for (var i=0 ; i < perpage; i++) { $(items[i + page*perpage]).addClass('shown'); diff --git a/app/etc/config.xml b/app/etc/config.xml deleted file mode 100644 index 4d18453dbad3bc71764b8a3468f832f0c20f791a..0000000000000000000000000000000000000000 --- a/app/etc/config.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <default> - <system> - <filesystem> - <base>{{root_dir}}</base> - <app>{{root_dir}}/app</app> - <code>{{app_dir}}/code</code> - <design>{{app_dir}}/design</design> - <locale>{{app_dir}}/locale</locale> - <etc>{{app_dir}}/etc</etc> - <media>{{media_dir}}</media> - <upload>{{media_dir}}/upload</upload> - <var>{{var_dir}}</var> - <cache>{{var_dir}}/cache</cache> - <session>{{var_dir}}/session</session> - <tmp>{{var_dir}}/tmp</tmp> - <pear>{{var_dir}}/pear</pear> - <export>{{var_dir}}/export</export> - </filesystem> - </system> - <general> - <locale> - <code>en_US</code> - <timezone>America/Los_Angeles</timezone> - </locale> - </general> - </default> -</config> diff --git a/app/etc/di.xml b/app/etc/di.xml index d4e183fa70cd864ced0f2a77fe868040dd687a22..82a9656a41199225d934415c3c375f38982a0a24 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -29,9 +29,9 @@ <preference for="Magento\App\ResponseInterface" type="Magento\App\Response\Http" /> <preference for="Magento\App\RouterListInterface" type="Magento\App\RouterList" /> <preference for="Magento\App\FrontControllerInterface" type="Magento\App\FrontController" /> - <preference for="Magento\App\UpdaterInterface" type="Magento\App\Updater" /> + <preference for="Magento\Module\UpdaterInterface" type="Magento\Module\Updater" /> <preference for="Magento\Core\Model\AppInterface" type="Magento\Core\Model\App\Proxy" /> - <preference for="Magento\Core\Model\CacheInterface" type="Magento\Core\Model\Cache\Proxy" /> + <preference for="Magento\App\CacheInterface" type="Magento\Core\Model\Cache\Proxy" /> <preference for="Magento\Core\Model\Cache\StateInterface" type="Magento\Core\Model\Cache\State" /> <preference for="Magento\Core\Model\Cache\TypeListInterface" type="Magento\Core\Model\Cache\TypeList" /> <preference for="Magento\Core\Model\Store\ConfigInterface" type="Magento\Core\Model\Store\Config" /> @@ -45,48 +45,43 @@ <preference for="Magento\Config\ScopeInterface" type="Magento\Config\Scope" /> <preference for="Magento\Config\FileResolverInterface" type="Magento\Core\Model\Config\FileResolver" /> <preference for="Magento\Config\CacheInterface" type="Magento\Core\Model\Cache\Type\Config" /> - <preference for="Magento\Config\ValidationStateInterface" type="Magento\Core\Model\Config\ValidationState" /> - <preference for="Magento\App\ModuleListInterface" type="Magento\App\ModuleList" /> + <preference for="Magento\Config\ValidationStateInterface" type="Magento\App\Config\ValidationState" /> + <preference for="Magento\Module\ModuleListInterface" type="Magento\Module\ModuleList" /> <preference for="Magento\Event\ConfigInterface" type="Magento\Event\Config" /> <preference for="Magento\Event\InvokerInterface" type="Magento\Event\Invoker\InvokerDefault" /> <preference for="Magento\Interception\PluginList" type="Magento\Interception\PluginList\PluginList" /> <preference for="Magento\Event\ManagerInterface" type="Magento\Event\Manager\Proxy" /> <preference for="Magento\View\LayoutInterface" type="Magento\Core\Model\Layout" /> <preference for="Magento\View\Layout\ProcessorInterface" type="Magento\Core\Model\Layout\Merge" /> + <preference for="Magento\App\Route\ConfigInterface" type="Magento\App\Route\Config" /> + <preference for="Magento\App\Resource\ConfigInterface" type="Magento\App\Resource\Config\Proxy" /> <type name="Magento\View\Layout\Structure" shared="false" /> <type name="Magento\View\BlockPool" shared="false" /> - <type name="Magento\Data\Form\Factory"> - <param name="session"> - <instance type="Magento\Core\Model\Session" /> - </param> - </type> + <preference for="Magento\Error\HandlerInterface" type="Magento\App\Error\Handler" /> <type name="Magento\App\State"> <param name="installDate"> <value type="argument">Magento\App\State::PARAM_INSTALL_DATE</value> </param> <param name="mode"> - <value type="argument">Magento\Core\Model\App::PARAM_MODE</value> + <value type="argument">Magento\App\State::PARAM_MODE</value> </param> </type> - <type name="Magento\Core\App\FrontController\Plugin\Install"> + <type name="Magento\Module\FrontController\Plugin\Install"> <param name="cache"> <instance type="Magento\Core\Model\Cache\Type\Config" /> </param> </type> - <type name="Magento\Core\Model\Config\ValidationState"> + <type name="Magento\App\Config\ValidationState"> <param name="appMode"> - <value type="argument">Magento\Core\Model\App::PARAM_MODE</value> + <value type="argument">Magento\App\State::PARAM_MODE</value> </param> </type> - <type name="Magento\Core\Model\Config\Loader\Local"> + <type name="Magento\App\Config\Loader"> <param name="customFile"> - <value type="argument">Magento\Core\Model\App::PARAM_CUSTOM_LOCAL_FILE</value> - </param> - <param name="customConfig"> - <value type="argument">Magento\Core\Model\App::PARAM_CUSTOM_LOCAL_CONFIG</value> + <value type="argument">Magento\App\Config\Loader::PARAM_CUSTOM_FILE</value> </param> </type> - <type name="Magento\App\Module\Declaration\Reader\Filesystem"> + <type name="Magento\Module\Declaration\Reader\Filesystem"> <param name="allowedModules"> <value type="argument">Magento\Core\Model\App::PARAM_ALLOWED_MODULES</value> </param> @@ -95,6 +90,19 @@ <param name="enforcedOptions"> <value type="argument">Magento\Core\Model\App::PARAM_CACHE_OPTIONS</value> </param> + <param name="decorators"> + <value> + <tag> + <class>Magento\Cache\Frontend\Decorator\TagScope</class> + <parameters> + <tag>MAGE</tag> + </parameters> + </tag> + </value> + </param> + <param name="resource"> + <instance type="Magento\App\Resource\Proxy" /> + </param> </type> <type name="Magento\Core\Model\Cache\State"> <param name="banAll"> @@ -109,16 +117,6 @@ <value type="argument">Magento\Core\Model\App::PARAM_RUN_TYPE</value> </param> </type> - <type name="Magento\Core\Model\Config"> - <param name="storage"> - <instance type="Magento\Core\Model\Config\Storage" /> - </param> - </type> - <type name="Magento\Core\Model\Config\Storage"> - <param name="loader"> - <instance type="Magento\Core\Model\Config\Loader\Proxy" /> - </param> - </type> <type name="Magento\Core\Model\Translate"> <param name="cache"> <instance type="Magento\Core\Model\Cache\Type\Translate" /> @@ -129,11 +127,6 @@ <instance type="Magento\Core\Model\Config\Proxy" /> </param> </type> - <type name="Magento\Core\Model\Store\StorageFactory"> - <param name="config"> - <instance type="Magento\Core\Model\Config\Proxy" /> - </param> - </type> <type name="Magento\Filesystem" shared="false"> <param name="adapter"> <instance type="Magento\Filesystem\Adapter\Local" /> @@ -154,12 +147,12 @@ </param> </type> <type name="Magento\Acl" shared="false" /> - <type name="Magento\Core\Model\ObjectManager\ConfigLoader"> + <type name="Magento\App\ObjectManager\ConfigLoader"> <param name="cache"> <instance type="Magento\Core\Model\Cache\Type\Config"/> </param> </type> - <type name="Magento\Core\Model\ObjectManager\ConfigCache"> + <type name="Magento\App\ObjectManager\ConfigCache"> <param name="cacheFrontend"> <instance type="Magento\Core\Model\Cache\Type\Config"/> </param> @@ -201,20 +194,30 @@ </value> </param> </type> - <type name="Magento\Core\Model\Resource"> - <param name="resourceConfig"> - <instance type="Magento\Core\Model\Config\Resource\Primary" /> - </param> + <type name="Magento\App\Resource"> <param name="tablePrefix"> - <value type="argument">Magento\Core\Model\Resource::PARAM_TABLE_PREFIX</value> + <value type="argument">Magento\App\Resource::PARAM_TABLE_PREFIX</value> + </param> + </type> + <type name="Magento\App\Resource\Config"> + <param name="cache"> + <instance type="Magento\Core\Model\Cache\Type\Config\Proxy" /> + </param> + <param name="initialResources"> + <value type="argument">Magento\App\Resource\Config::PARAM_INITIAL_RESOURCES</value> + </param> + </type> + <type name="Magento\App\Resource\Config\Reader"> + <param name="fileResolver"> + <instance type="Magento\Core\Model\Config\FileResolver\Proxy" /> </param> </type> <type name="Magento\Config\Scope"> <param name="defaultScope"> - <value>global</value> + <value>primary</value> </param> <param name="areaList"> - <instance type="Magento\App\AreaListProxy" /> + <instance type="Magento\App\AreaList\Proxy" /> </param> </type> <type name="Magento\Core\Model\Url"> @@ -222,4 +225,12 @@ <instance type="Magento\Core\Model\Session\Proxy" /> </param> </type> + <type name="Magento\HTTP\PhpEnvironment\RemoteAddress"> + <param name="alternativeHeaders"> + <value/> + </param> + </type> + <type name="Magento\App\FrontController"> + <plugin name="install" type="Magento\Module\FrontController\Plugin\Install" sortOrder="40"/> + </type> </config> diff --git a/app/functions.php b/app/functions.php new file mode 100644 index 0000000000000000000000000000000000000000..65a6d4bbf14ceac29eebf8df2a3d2cf824d70236 --- /dev/null +++ b/app/functions.php @@ -0,0 +1,41 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Create value-object \Magento\Phrase + * + * @return string + */ +function __() +{ + $argc = func_get_args(); + + /** + * Type casting to string is a workaround. + * Many places in client code at the moment are unable to handle the \Magento\Phrase object properly. + * The intended behavior is to use __toString(), + * so that rendering of the phrase happens only at the last moment when needed + */ + return (string)new \Magento\Phrase(array_shift($argc), $argc); +} diff --git a/dev/shell/indexer.php b/dev/shell/indexer.php index caeed2ca58eeae7e2be523e6907d0f8cace2a31d..6d44ec9c4ba5d3b49e0e897fdca89d7474483db0 100644 --- a/dev/shell/indexer.php +++ b/dev/shell/indexer.php @@ -30,9 +30,7 @@ $params = array( \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store', ); -$entryPoint = new \Magento\Index\Model\EntryPoint\Shell( - basename(__FILE__), - new \Magento\Index\Model\EntryPoint\Shell\ErrorHandler(), - new \Magento\Core\Model\Config\Primary(BP, $params) -); -$entryPoint->processRequest(); +$entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); +$entryPoint->run('Magento\Index\App\Shell', array( + 'entryFileName' => basename(__FILE__), +)); diff --git a/dev/shell/install.php b/dev/shell/install.php index f5b9e477a42112cda1c91f6b22d9fa527d3d0ae0..51927377fc35321ca7fbad1c297e5fa8c8be5d57 100644 --- a/dev/shell/install.php +++ b/dev/shell/install.php @@ -63,5 +63,5 @@ if (empty($args)) { define('BARE_BOOTSTRAP', 1); require_once __DIR__ . '/../../app/bootstrap.php'; -$entryPoint = new \Magento\Install\Model\EntryPoint\Console(BP, $args); -$entryPoint->processRequest(); +$entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP); +$entryPoint->run('Magento\Install\App\Console', array('arguments' => $args)); \ No newline at end of file diff --git a/dev/shell/log.php b/dev/shell/log.php index dfc2472057ab989dc15d575ddaa4421401d342b2..598048971f9b44b34e2c35502e390d7fa9d642e3 100644 --- a/dev/shell/log.php +++ b/dev/shell/log.php @@ -29,8 +29,7 @@ $params = array( \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store', ); -$entryPoint = new \Magento\Log\Model\EntryPoint\Shell( - new \Magento\Core\Model\Config\Primary(BP, $params), - basename(__FILE__) -); -$entryPoint->processRequest(); +$entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); +$entryPoint->run('Magento\Log\App\Shell', array( + 'entryFileName' => basename(__FILE__), +)); diff --git a/dev/tests/integration/framework/Magento/TestFramework/Annotation/AppArea.php b/dev/tests/integration/framework/Magento/TestFramework/Annotation/AppArea.php index 3b988e23d57550d0c5ed15a4c2eac62dfbb02f8a..3cbe13ca4c10e46a38fffed657e5d59e1cce3270 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Annotation/AppArea.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Annotation/AppArea.php @@ -39,7 +39,7 @@ class AppArea */ private $_allowedAreas = array( \Magento\Core\Model\App\Area::AREA_GLOBAL, - \Magento\Core\Model\App\Area::AREA_ADMINHTML, + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \Magento\Core\Model\App\Area::AREA_FRONTEND, 'install', 'webapi_rest', diff --git a/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php b/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php index aaa4d3f7bd0037a919f7e3817a83d85bbe7d7e5d..18707d42440df411f000a5f1c4d7955e6829e8b2 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php @@ -63,19 +63,12 @@ class ConfigFixture protected function _getConfigValue($configPath, $storeCode = false) { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - - if ($storeCode === false) { - /** @var \Magento\Core\Model\Config $configModel */ - $configModel = $objectManager->get('Magento\Core\Model\Config'); - $result = $configModel->getNode($configPath); - } else { + $result = null; + if ($storeCode !== false) { /** @var \Magento\Core\Model\Store\Config $storeConfig */ $storeConfig = $objectManager->get('Magento\Core\Model\Store\Config'); $result = $storeConfig->getConfig($configPath, $storeCode); } - if ($result instanceof \SimpleXMLElement) { - $result = (string)$result; - } return $result; } @@ -90,17 +83,9 @@ class ConfigFixture { if ($storeCode === false) { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $configModel \Magento\Core\Model\Config */ - $configModel = $objectManager->get('Magento\Core\Model\Config'); - // @todo refactor this method when all types of configuration are represented by array if (strpos($configPath, 'default/') === 0) { $configPath = substr($configPath, 8); - $configModel->setValue($configPath, $value); $objectManager->get('Magento\Core\Model\Config')->setValue($configPath, $value); - } else { - $configModel->setNode($configPath, $value); - $objectManager->get('Magento\Core\Model\Config')->setNode($configPath, $value); - $objectManager->get('Magento\Core\Model\Config\Primary')->setNode($configPath, $value); } } else { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface') diff --git a/dev/tests/integration/framework/Magento/TestFramework/App.php b/dev/tests/integration/framework/Magento/TestFramework/App.php new file mode 100644 index 0000000000000000000000000000000000000000..836507d441bfbc3b525bbaea3b4451528e4d7393 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/App.php @@ -0,0 +1,41 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\TestFramework; + +/** + * App class for integration test framework + */ +class App extends \Magento\Core\Model\App +{ + public function loadArea($code) + { + $area = $this->getArea($code); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode($code); + $area->load(); + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/App/State.php b/dev/tests/integration/framework/Magento/TestFramework/App/State.php new file mode 100644 index 0000000000000000000000000000000000000000..8f2fd38b31822ad9ee4342dd2c31778258274dca --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/App/State.php @@ -0,0 +1,51 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * App State class for integration tests framework + */ +namespace Magento\TestFramework\App; + +class State extends \Magento\App\State +{ + /** + * {@inheritdoc} + */ + public function getAreaCode() + { + return $this->_areaCode;; + } + + /** + * {@inheritdoc} + */ + public function setAreaCode($code) + { + $this->_areaCode = $code; + $this->_configScope->setCurrentScope($code); + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index 2c0f8b6b9eab912b4e45cb16fdeb0410f072c584..fe17d2760ea4c467d5d97ab4d5962d9d39e9e054 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -107,7 +107,12 @@ class Application * * @var array */ - protected $_primaryConfig = array(); + protected $_primaryConfigData = array(); + + /** + * @var \Magento\TestFramework\ObjectManagerFactory + */ + protected $_factory; /** * Constructor @@ -134,7 +139,7 @@ class Application $generationDir = "$installDir/generation"; $this->_initParams = array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::CONFIG => $this->_installEtcDir, \Magento\App\Dir::VAR_DIR => $installDir, \Magento\App\Dir::MEDIA => "$installDir/media", @@ -142,8 +147,9 @@ class Application \Magento\App\Dir::PUB_VIEW_CACHE => "$installDir/pub_cache", \Magento\App\Dir::GENERATION => $generationDir, ), - \Magento\Core\Model\App::PARAM_MODE => $appMode + \Magento\App\State::PARAM_MODE => $appMode ); + $this->_factory = new \Magento\TestFramework\ObjectManagerFactory(); } /** @@ -185,62 +191,32 @@ class Application } /** - * Initialize an already installed application + * Initialize application * * @param array $overriddenParams */ public function initialize($overriddenParams = array()) { $overriddenParams['base_dir'] = BP; - $overriddenParams[\Magento\Core\Model\App::PARAM_MODE] = $this->_appMode; - $config = new \Magento\Core\Model\Config\Primary(BP, $this->_customizeParams($overriddenParams)); - if (!\Magento\TestFramework\Helper\Bootstrap::getObjectManager()) { - $objectManager = new \Magento\TestFramework\ObjectManager( - $config, - new \Magento\TestFramework\ObjectManager\Config() - ); - $primaryLoader = new \Magento\Core\Model\ObjectManager\ConfigLoader\Primary($config->getDirectories()); - $this->_primaryConfig = $primaryLoader->load(); + $overriddenParams[\Magento\App\State::PARAM_MODE] = $this->_appMode; + $overriddenParams = $this->_customizeParams($overriddenParams); + + /** @var \Magento\TestFramework\ObjectManager $objectManager */ + $objectManager = Helper\Bootstrap::getObjectManager(); + if (!$objectManager) { + $objectManager = $this->_factory->create(BP, $overriddenParams); } else { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - \Magento\TestFramework\ObjectManager::setInstance($objectManager); - $config->configure($objectManager); - - $objectManager->getFactory()->setArguments(array_replace( - $objectManager->get('Magento\Core\Model\Config\Local')->getParams(), - $config->getParams() - )); - - $objectManager->addSharedInstance($config, 'Magento\Core\Model\Config\Primary'); - $objectManager->addSharedInstance($config->getDirectories(), 'Magento\App\Dir'); - $objectManager->configure(array( - 'preferences' => array( - 'Magento\Core\Model\Cookie' => 'Magento\TestFramework\Cookie' - ) - )); - $objectManager->loadPrimaryConfig($this->_primaryConfig); - $verification = $objectManager->get('Magento\App\Dir\Verification'); - $verification->createAndVerifyDirectories(); - $objectManager->configure( - $objectManager->get('Magento\Core\Model\ObjectManager\ConfigLoader')->load('global') - ); - $objectManager->configure(array( - 'Magento\View\Design\FileResolution\Strategy\Fallback\CachingProxy' => array( - 'parameters' => array('canSaveMap' => false) - ), - 'default_setup' => array( - 'type' => 'Magento\TestFramework\Db\ConnectionAdapter' - ), - 'preferences' => array( - 'Magento\Core\Model\Cookie' => 'Magento\TestFramework\Cookie', - 'Magento\App\RequestInterface' => 'Magento\TestFramework\Request', - 'Magento\App\ResponseInterface' => 'Magento\TestFramework\Response', - ), - )); + $objectManager = $this->_factory->restore($objectManager, BP, $overriddenParams); } - \Magento\TestFramework\Helper\Bootstrap::setObjectManager($objectManager); - $objectManager->get('Magento\Core\Model\Resource') - ->setCache($objectManager->get('Magento\Core\Model\CacheInterface')); + + Helper\Bootstrap::setObjectManager($objectManager); + + $objectManager->configure(array( + 'preferences' => array( + 'Magento\App\State' => 'Magento\TestFramework\App\State', + 'Magento\Core\Model\App' => 'Magento\TestFramework\App', + ), + )); /** Register event observer of Integration Framework */ /** @var \Magento\Event\Config\Data $eventConfigData */ @@ -256,12 +232,8 @@ class Application ) ) ); - /** @var \Magento\App\Dir\Verification $verification */ - $verification = $objectManager->get('Magento\App\Dir\Verification'); - $verification->createAndVerifyDirectories(); $this->loadArea(\Magento\TestFramework\Application::DEFAULT_APP_AREA); - \Magento\Phrase::setRenderer($objectManager->get('Magento\Phrase\Renderer\Placeholder')); } @@ -282,9 +254,9 @@ class Application public function run() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $config = new \Magento\Core\Model\Config\Primary(BP, array()); - $entryPoint = new \Magento\Core\Model\EntryPoint\Http($config, $objectManager); - $entryPoint->processRequest(); + /** @var \Magento\App\Http $app */ + $app = $objectManager->get('Magento\App\Http'); + $app->execute(); } /** @@ -340,9 +312,12 @@ class Application /* Initialize an application in non-installed mode */ $this->initialize(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadAreaPart('install', \Magento\Core\Model\App\Area::PART_CONFIG); + /* Run all install and data-install scripts */ - /** @var $updater \Magento\App\Updater */ - $updater = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Updater'); + /** @var $updater \Magento\Module\Updater */ + $updater = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Module\Updater'); $updater->updateScheme(); $updater->updateData(); @@ -395,18 +370,10 @@ class Application $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->clearCache(); - $resource = $objectManager->get('Magento\Core\Model\Registry') - ->registry('_singleton/Magento\Core\Model\Resource'); - \Magento\Data\Form::setElementRenderer(null); \Magento\Data\Form::setFieldsetRenderer(null); \Magento\Data\Form::setFieldsetElementRenderer(null); $this->_appArea = null; - - if ($resource) { - $objectManager->get('Magento\Core\Model\Registry') - ->register('_singleton/Magento\Core\Model\Resource', $resource); - } } /** @@ -484,16 +451,22 @@ class Application /** * Load application area * - * @param $area + * @param $areaCode */ - public function loadArea($area) + public function loadArea($areaCode) { - $this->_appArea = $area; - if ($area == \Magento\TestFramework\Application::DEFAULT_APP_AREA) { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadAreaPart($area, \Magento\Core\Model\App\Area::PART_CONFIG); + $this->_appArea = $areaCode; + $scope = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\Scope'); + $scope->setCurrentScope($areaCode); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure( + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\App\ObjectManager\ConfigLoader')->load($areaCode) + ); + $app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); + if ($areaCode == \Magento\TestFramework\Application::DEFAULT_APP_AREA) { + $app->loadAreaPart($areaCode, \Magento\Core\Model\App\Area::PART_CONFIG); } else { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea($area); + $app->loadArea($areaCode); } } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php b/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php index e3cdcbfabcf17cb826a30a08c9e06595d11d5878..baecf13321260e0fd58091f2965b66f606d39897 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php @@ -138,8 +138,8 @@ class Transaction */ protected function _getAdapter($connectionName = 'core_write') { - /** @var $resource \Magento\Core\Model\Resource */ - $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Resource'); + /** @var $resource \Magento\App\Resource */ + $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Resource'); return $resource->getConnection($connectionName); } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Helper/Config.php b/dev/tests/integration/framework/Magento/TestFramework/Helper/Config.php index d52283543d9f790d371ac47faea223f83aab4957..d73a2c809acbc0ccbf81efd845c3fb3eaa6a03c7 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Helper/Config.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Helper/Config.php @@ -41,7 +41,7 @@ class Config { $result = array(); $moduleList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\App\ModuleListInterface'); + ->get('Magento\Module\ModuleListInterface'); foreach ($moduleList->getModules() as $module) { $result[] = $module['name']; } diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php index e2cea9ba5e8f3e8c8034d00169d25e71ed137b7b..36c179929c2f5405186289574c157be163fd55df 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php @@ -25,7 +25,7 @@ */ namespace Magento\TestFramework; -class ObjectManager extends \Magento\Core\Model\ObjectManager +class ObjectManager extends \Magento\App\ObjectManager { /** * Classes with xml properties to explicitly call __destruct() due to https://bugs.php.net/bug.php?id=62468 @@ -51,9 +51,9 @@ class ObjectManager extends \Magento\Core\Model\ObjectManager } \Magento\Core\Model\Config\Base::destroy(); - $sharedInstances = array('Magento\ObjectManager' => $this, 'Magento\Core\Model\ObjectManager' => $this); - if (isset($this->_sharedInstances['Magento\Core\Model\Resource'])) { - $sharedInstances['Magento\Core\Model\Resource'] = $this->_sharedInstances['Magento\Core\Model\Resource']; + $sharedInstances = array('Magento\ObjectManager' => $this, 'Magento\App\ObjectManager' => $this); + if (isset($this->_sharedInstances['Magento\App\Resource'])) { + $sharedInstances['Magento\App\Resource'] = $this->_sharedInstances['Magento\App\Resource']; } $this->_sharedInstances = $sharedInstances; $this->_config->clean(); @@ -82,18 +82,6 @@ class ObjectManager extends \Magento\Core\Model\ObjectManager unset($this->_sharedInstances[$className]); } - /** - * Load primary DI configuration - * - * @param array $configData - */ - public function loadPrimaryConfig($configData) - { - if ($configData) { - $this->configure($configData); - } - } - /** * Set objectManager * diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php index 23312d1791870dee9f37a162dd636ed233c6d228..7109f806f722102e77dc6fa4730dbc8e27482626 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php @@ -25,7 +25,7 @@ namespace Magento\TestFramework\ObjectManager; class Configurator - implements \Magento\Core\Model\ObjectManager\DynamicConfigInterface + implements \Magento\ObjectManager\DynamicConfigInterface { /** * Map application initialization params to Object Manager configuration format diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..d557af477e6a37c1d275af9d3b8af1a5bb993da4 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php @@ -0,0 +1,116 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\TestFramework; + +use Magento\App\Dir; + +class ObjectManagerFactory extends \Magento\App\ObjectManagerFactory +{ + /** + * Locator class name + * + * @var string + */ + protected $_locatorClassName = '\Magento\TestFramework\ObjectManager'; + + /** + * Config class name + * + * @var string + */ + protected $_configClassName = '\Magento\TestFramework\ObjectManager\Config'; + + /** + * @var array + */ + protected $_primaryConfigData = null; + + /** + * Restore locator instance + * + * @param ObjectManager $objectManager + * @param string $rootDir + * @param array $arguments + * @return ObjectManager + */ + public function restore(ObjectManager $objectManager, $rootDir, array $arguments) + { + $directories = new Dir( + $rootDir, + isset($arguments[Dir::PARAM_APP_URIS]) ? $arguments[Dir::PARAM_APP_URIS] : array(), + isset($arguments[Dir::PARAM_APP_DIRS]) ? $arguments[Dir::PARAM_APP_DIRS] : array() + ); + + \Magento\TestFramework\ObjectManager::setInstance($objectManager); + + $objectManager->configure($this->_primaryConfigData); + $objectManager->addSharedInstance($directories, 'Magento\App\Dir'); + $objectManager->configure(array( + 'Magento\View\Design\FileResolution\Strategy\Fallback\CachingProxy' => array( + 'parameters' => array('canSaveMap' => false) + ), + 'default_setup' => array( + 'type' => 'Magento\TestFramework\Db\ConnectionAdapter' + ), + 'preferences' => array( + 'Magento\Core\Model\Cookie' => 'Magento\TestFramework\Cookie', + 'Magento\App\RequestInterface' => 'Magento\TestFramework\Request', + 'Magento\App\ResponseInterface' => 'Magento\TestFramework\Response', + ), + )); + + $options = new \Magento\App\Config( + $arguments, + new \Magento\App\Config\Loader($directories) + ); + $objectManager->addSharedInstance($options, 'Magento\App\Config'); + $objectManager->getFactory()->setArguments($options->get()); + $objectManager->configure( + $objectManager->get('Magento\App\ObjectManager\ConfigLoader')->load('global') + ); + + /** @var \Magento\App\Dir\Verification $verification */ + $verification = $objectManager->get('Magento\App\Dir\Verification'); + $verification->createAndVerifyDirectories(); + + return $objectManager; + } + + /** + * Load primary config data + * + * @param Dir $directories + * @param string $appMode + * @return array + * @throws \Magento\BootstrapException + */ + protected function _loadPrimaryConfig(Dir $directories, $appMode) + { + if (null === $this->_primaryConfigData) { + $this->_primaryConfigData = parent::_loadPrimaryConfig($directories, $appMode); + } + return $this->_primaryConfigData; + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php index d914765ffb2e06716eab3ed407c14e3fb5ee4181..16e6e246669f72829ed5cf391cebbe180da3fb21 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php @@ -54,7 +54,7 @@ abstract class AbstractConfigFiles extends \PHPUnit_Framework_TestCase $xmlFiles = $this->getXmlConfigFiles(); if (!empty($xmlFiles)) { - $this->_fileResolverMock = $this->getMockBuilder('Magento\Core\Model\Config\FileResolver\Primary') + $this->_fileResolverMock = $this->getMockBuilder('Magento\App\Config\FileResolver\Primary') ->disableOriginalConstructor()->getMock(); /* Enable Validation regardles of MAGE_MODE */ diff --git a/dev/tests/integration/framework/Magento/TestFramework/Workaround/Cleanup/StaticProperties.php b/dev/tests/integration/framework/Magento/TestFramework/Workaround/Cleanup/StaticProperties.php index 51d673a257f0459dc00ac2821db0160b35bd7272..f1da1c91579fcc39784529b66d2753580fb8bd66 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Workaround/Cleanup/StaticProperties.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Workaround/Cleanup/StaticProperties.php @@ -50,7 +50,7 @@ class StaticProperties */ protected static $_classesToSkip = array( 'Mage', - 'Magento\Core\Model\ObjectManager', + 'Magento\App\ObjectManager', 'Magento\TestFramework\Helper\Bootstrap', 'Magento\TestFramework\Event\Magento', 'Magento\TestFramework\Event\PhpUnit', diff --git a/dev/tests/integration/framework/bootstrap.php b/dev/tests/integration/framework/bootstrap.php index b8c0026298ae775aa82beb38360a5729223a8951..ce013bfde74e97f2732cf9ba11afeade2fa8f45a 100644 --- a/dev/tests/integration/framework/bootstrap.php +++ b/dev/tests/integration/framework/bootstrap.php @@ -38,6 +38,24 @@ $magentoBaseDir = realpath("$testsBaseDir/../../../"); "$testsBaseDir/testsuite", )); +function tool_autoloader($className) +{ + if (strpos($className, 'Magento\\Tools\\') === false) { + return false; + } + + $filePath = str_replace('\\', DS, $className); + $filePath = BP . DS . 'dev' . DS . 'tools' . DS . $filePath . '.php'; + + if (file_exists($filePath)) { + include_once($filePath); + } else { + return false; + } +} + +spl_autoload_register('tool_autoloader'); + /* Bootstrap the application */ $invariantSettings = array( 'TESTS_LOCAL_CONFIG_EXTRA_FILE' => 'etc/integration-tests-config.xml', @@ -56,21 +74,5 @@ $bootstrap->runBootstrap(); Magento\TestFramework\Utility\Files::init(new Magento\TestFramework\Utility\Files($magentoBaseDir)); -function tool_autoloader($className) -{ - if (strpos($className, 'Magento\\Tools\\') === false) { - return false; - } - $filePath = str_replace('\\', DS, $className); - $filePath = BP . DS . 'dev' . DS . 'tools' . DS . $filePath . '.php'; - - if (file_exists($filePath)) { - include_once($filePath); - } else { - return false; - } -} -spl_autoload_register('tool_autoloader'); - /* Unset declared global variables to release the PHPUnit from maintaining their values between tests */ unset($bootstrap); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/ConfigFixtureTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/ConfigFixtureTest.php index ac92b4c3afc3dd92209e702bab5d62a2af818132..2df10090b7331024c750bfaf7ce84f2bca9971d3 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/ConfigFixtureTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/ConfigFixtureTest.php @@ -46,7 +46,7 @@ class ConfigFixtureTest extends \PHPUnit_Framework_TestCase } /** - * @magentoConfigFixture web/unsecure/base_url http://example.com/ + * @magentoConfigFixture current_store web/unsecure/base_url http://example.com/ */ public function testGlobalConfig() { @@ -54,20 +54,17 @@ class ConfigFixtureTest extends \PHPUnit_Framework_TestCase ->expects($this->at(0)) ->method('_getConfigValue') ->with('web/unsecure/base_url') - ->will($this->returnValue('http://localhost/')) - ; + ->will($this->returnValue('http://localhost/')); $this->_object ->expects($this->at(1)) ->method('_setConfigValue') - ->with('web/unsecure/base_url', 'http://example.com/') - ; + ->with('web/unsecure/base_url', 'http://example.com/'); $this->_object->startTest($this); $this->_object ->expects($this->once()) ->method('_setConfigValue') - ->with('web/unsecure/base_url', 'http://localhost/') - ; + ->with('web/unsecure/base_url', 'http://localhost/'); $this->_object->endTest($this); } @@ -80,20 +77,17 @@ class ConfigFixtureTest extends \PHPUnit_Framework_TestCase ->expects($this->at(0)) ->method('_getConfigValue') ->with('dev/restrict/allow_ips', '') - ->will($this->returnValue('127.0.0.1')) - ; + ->will($this->returnValue('127.0.0.1')); $this->_object ->expects($this->at(1)) ->method('_setConfigValue') - ->with('dev/restrict/allow_ips', '192.168.0.1', '') - ; + ->with('dev/restrict/allow_ips', '192.168.0.1', ''); $this->_object->startTest($this); $this->_object ->expects($this->once()) ->method('_setConfigValue') - ->with('dev/restrict/allow_ips', '127.0.0.1', '') - ; + ->with('dev/restrict/allow_ips', '127.0.0.1', ''); $this->_object->endTest($this); } @@ -106,41 +100,33 @@ class ConfigFixtureTest extends \PHPUnit_Framework_TestCase ->expects($this->at(0)) ->method('_getConfigValue') ->with('dev/restrict/allow_ips', 'admin') - ->will($this->returnValue('192.168.0.1')) - ; + ->will($this->returnValue('192.168.0.1')); $this->_object ->expects($this->at(1)) ->method('_setConfigValue') - ->with('dev/restrict/allow_ips', '192.168.0.2', 'admin') - ; + ->with('dev/restrict/allow_ips', '192.168.0.2', 'admin'); $this->_object->startTest($this); $this->_object ->expects($this->once()) ->method('_setConfigValue') - ->with('dev/restrict/allow_ips', '192.168.0.1', 'admin') - ; + ->with('dev/restrict/allow_ips', '192.168.0.1', 'admin'); $this->_object->endTest($this); } - /** - * @magentoConfigFixture some/config/path some_config_value - */ public function testInitStoreAfterOfScope() { $this->_object ->expects($this->never()) - ->method('_getConfigValue') - ; + ->method('_getConfigValue'); $this->_object ->expects($this->never()) - ->method('_setConfigValue') - ; + ->method('_setConfigValue'); $this->_object->initStoreAfter(); } /** - * @magentoConfigFixture web/unsecure/base_url http://example.com/ + * @magentoConfigFixture current_store web/unsecure/base_url http://example.com/ */ public function testInitStoreAfter() { @@ -149,13 +135,11 @@ class ConfigFixtureTest extends \PHPUnit_Framework_TestCase ->expects($this->at(0)) ->method('_getConfigValue') ->with('web/unsecure/base_url') - ->will($this->returnValue('http://localhost/')) - ; + ->will($this->returnValue('http://localhost/')); $this->_object ->expects($this->at(1)) ->method('_setConfigValue') - ->with('web/unsecure/base_url', 'http://example.com/') - ; + ->with('web/unsecure/base_url', 'http://example.com/'); $this->_object->initStoreAfter(); } } diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php index 4aa324bc2397b391e5622bb72973622cd6cf7d42..4d5e9e035cc58c0aeb00c03835820ea5ad6d3788 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php @@ -27,6 +27,8 @@ namespace Magento\Test; +use Magento\App\State; + class ApplicationTest extends \PHPUnit_Framework_TestCase { /** @@ -54,13 +56,13 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $initParams = $object->getInitParams(); $this->assertInternalType('array', $initParams, 'Wrong initialization parameters type'); - $this->assertArrayHasKey(\Magento\Core\Model\App::PARAM_APP_DIRS, $initParams, + $this->assertArrayHasKey(\Magento\App\Dir::PARAM_APP_DIRS, $initParams, 'Directories are not configured'); - $this->assertArrayHasKey(\Magento\Core\Model\App::PARAM_MODE, $initParams, + $this->assertArrayHasKey(State::PARAM_MODE, $initParams, 'Application mode is not configured'); $this->assertEquals( \Magento\App\State::MODE_DEVELOPER, - $initParams[\Magento\Core\Model\App::PARAM_MODE], + $initParams[State::PARAM_MODE], 'Wrong application mode configured' ); } diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/CookieTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/CookieTest.php index f8308c9e807e44bdc37549138956574f6801f679..ad10cd15d2fa474796fe7f8a7947488ad7aac7c1 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/CookieTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/CookieTest.php @@ -48,7 +48,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase $coreStoreConfig, $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false), new \Magento\TestFramework\Request( - $this->getMock('Magento\App\RouterListInterface'), + $this->getMock('\Magento\App\Route\ConfigInterface'), 'http://example.com', $this->getMock('Magento\App\Request\PathInfoProcessorInterface') ), diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Helper/BootstrapTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Helper/BootstrapTest.php index 8ea05427755e425290e775c8591d6a8a9465378b..ed9e29c8dea2630e42cc55b18e30755e98311daf 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Helper/BootstrapTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Helper/BootstrapTest.php @@ -53,7 +53,7 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase * @var array */ protected $_fixtureInitParams = array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::CONFIG => __DIR__, \Magento\App\Dir::VAR_DIR => __DIR__, ), diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php index 788dc2750560df0c7f328afb8a0faaae8c756db4..d26ba641daadd8bbd097daf5ab17abbe877f752f 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php @@ -46,47 +46,42 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase { $resource = new \stdClass; $instanceConfig = new \Magento\TestFramework\ObjectManager\Config(); - $primaryConfig = $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false); - $primaryConfig->expects($this->any())->method('getParams')->will($this->returnValue(array())); - $dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); $verification = $this->getMock('Magento\App\Dir\Verification', array(), array(), '', false); - $cache = $this->getMock('Magento\Core\Model\CacheInterface'); - $configLoader = $this->getMock('Magento\Core\Model\ObjectManager\ConfigLoader', array(), array(), '', false); - $configLoader->expects($this->once())->method('load')->will($this->returnValue(array())); - $configCache = $this->getMock('Magento\Core\Model\ObjectManager\ConfigCache', array(), array(), '', false); - $primaryConfig->expects($this->any())->method('getDirectories')->will($this->returnValue($dirs)); + $cache = $this->getMock('Magento\App\CacheInterface'); + $configLoader = $this->getMock('Magento\App\ObjectManager\ConfigLoader', array(), array(), '', false); + $configCache = $this->getMock('Magento\App\ObjectManager\ConfigCache', array(), array(), '', false); $primaryLoaderMock = $this->getMock( - 'Magento\Core\Model\ObjectManager\ConfigLoader\Primary', array(), array(), '', false + 'Magento\App\ObjectManager\ConfigLoader\Primary', array(), array(), '', false ); $model = new \Magento\TestFramework\ObjectManager( - $primaryConfig, $instanceConfig, + null, $instanceConfig, array( 'Magento\App\Dir\Verification' => $verification, 'Magento\Core\Model\Cache\Type\Config' => $cache, - 'Magento\Core\Model\ObjectManager\ConfigLoader' => $configLoader, - 'Magento\Core\Model\ObjectManager\ConfigCache' => $configCache, + 'Magento\App\ObjectManager\ConfigLoader' => $configLoader, + 'Magento\App\ObjectManager\ConfigCache' => $configCache, 'Magento\Config\ReaderInterface' => $this->getMock('Magento\Config\ReaderInterface'), 'Magento\Config\ScopeInterface' => $this->getMock('Magento\Config\ScopeInterface'), 'Magento\Config\CacheInterface' => $this->getMock('Magento\Config\CacheInterface'), 'Magento\Cache\FrontendInterface' => $this->getMock('Magento\Cache\FrontendInterface'), - 'Magento\Core\Model\Resource' => $this->getMock( - 'Magento\Core\Model\Resource', array(), array(), '', false + 'Magento\App\Resource' => $this->getMock( + 'Magento\App\Resource', array(), array(), '', false ), - 'Magento\Core\Model\Config\Resource' => $this->getMock( - 'Magento\Core\Model\Config\Resource', array(), array(), '', false + 'Magento\App\Resource\Config' => $this->getMock( + 'Magento\App\Resource\Config', array(), array(), '', false ), ), $primaryLoaderMock ); - $model->addSharedInstance($resource, 'Magento\Core\Model\Resource'); + $model->addSharedInstance($resource, 'Magento\App\Resource'); $instance1 = $model->get('Magento\Object'); $this->assertSame($instance1, $model->get('Magento\Object')); $this->assertSame($model, $model->clearCache()); $this->assertSame($model, $model->get('Magento\ObjectManager')); - $this->assertSame($resource, $model->get('Magento\Core\Model\Resource')); + $this->assertSame($resource, $model->get('Magento\App\Resource')); $this->assertNotSame($instance1, $model->get('Magento\Object')); } } diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/RequestTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/RequestTest.php index 6a81be56265f800c1e35e3a42bef16a5ab4e9e80..a6d9fa065cc7ecb0a06b5d20ec65ff6431fc1b0e 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/RequestTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/RequestTest.php @@ -37,7 +37,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = new \Magento\TestFramework\Request( - $this->getMock('Magento\App\RouterListInterface', array(), array(), '', false) + $this->getMock('Magento\App\Route\ConfigInterface', array(), array(), '', false) ); } diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php index 0ac47a15e2e064742ed33932af695e866433232d..b726dbefec984df1f54f2b98cb8199ba747ef53a 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php @@ -46,7 +46,7 @@ class ControllerAbstractTest extends \Magento\TestFramework\TestCase\AbstractCon ; $session = new \Magento\Object(array('messages' => $messagesCollection)); $request = new \Magento\TestFramework\Request( - $this->getMock('Magento\App\RouterListInterface', array(), array(), '', false) + $this->getMock('\Magento\App\Route\ConfigInterface', array(), array(), '', false) ); $response = new \Magento\TestFramework\Response(); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Newsletter/Queue/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Newsletter/Queue/Edit/FormTest.php index 73936e9674d5e61d288206e86259b2ac3f067cef..4bb4a1e8eab4bbae814454627090ff72b6a654a1 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Newsletter/Queue/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Newsletter/Queue/Edit/FormTest.php @@ -39,11 +39,11 @@ class FormTest extends \PHPUnit_Framework_TestCase public function testPrepareForm() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) + ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ->setDefaultDesignTheme(); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Adminhtml\Block\Newsletter\Queue\Edit\Form'); $prepareFormMethod = new \ReflectionMethod( diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Report/Filter/FormTest.php b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Report/Filter/FormTest.php index 6315c59eb76296ad3ba1678ea145f7ace3af29ef..09b6fb1b156822272e66a43c7dfc718332eab527 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Report/Filter/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Report/Filter/FormTest.php @@ -39,7 +39,7 @@ class FormTest extends \PHPUnit_Framework_TestCase public function testPrepareForm() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) + ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ->setDefaultDesignTheme(); $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Layout'); $block = $layout->addBlock('Magento\Adminhtml\Block\Report\Filter\Form'); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/EditTest.php b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/EditTest.php index 37d1681c4d13f3858a95d1ca1f813418c839ff0a..26b386e828ea2e32335209b6d7cf0e01c657de63 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Category/EditTest.php @@ -46,7 +46,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Catalog\Category\Edit */ diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/EditTest.php b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/EditTest.php index eee7225b498dff85f223c938286cd4f1b0cf877f..ffc55ce4164ff1d5074877a5357dcfbb388437dc 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Catalog/Product/EditTest.php @@ -46,7 +46,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Catalog\Product\Edit */ diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/EditTest.php b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/EditTest.php index d6f30792cee33df19f89aeac282dea99903f870d..e94788bda49cede7edbaaf41b88d01501a3cc714 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/Cms/Page/EditTest.php @@ -46,7 +46,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Cms\Page\Edit */ diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/EditTest.php b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/EditTest.php index d0a33097768c0a2c86f13313dfe9e209ea6dc914..824174ab13cf1415389c3a322fff7e101999a0c3 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Urlrewrite/EditTest.php @@ -47,7 +47,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); /** @var $block \Magento\Adminhtml\Block\Urlrewrite\Edit */ diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/ContainerTest.php b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/ContainerTest.php index bba5ceb5c6c8d88e9dcb01ec76ed995cba48be72..954f1167a2615a1170e0b00bd88374e525363d6b 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/ContainerTest.php +++ b/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Widget/ContainerTest.php @@ -76,7 +76,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); /** @var $block \Magento\Adminhtml\Block\Widget\Container */ $block = $layout->createBlock('Magento\Adminhtml\Block\Widget\Container', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/App/FrontControllerTest.php b/dev/tests/integration/testsuite/Magento/App/FrontControllerTest.php index b707dcb22139bb332084efd739d4c4d9f8884e1b..ae6a6e862ac716917c112d8e6ad4b50a3547f73d 100644 --- a/dev/tests/integration/testsuite/Magento/App/FrontControllerTest.php +++ b/dev/tests/integration/testsuite/Magento/App/FrontControllerTest.php @@ -28,6 +28,7 @@ namespace Magento\App; /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @magentoAppArea frontend */ class FrontControllerTest extends \PHPUnit_Framework_TestCase { @@ -47,16 +48,6 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase $this->_model = $this->_objectManager->create('Magento\App\FrontController'); } - public function testSetGetDefault() - { - $this->_model->setDefault('test', 'value'); - $this->assertEquals('value', $this->_model->getDefault('test')); - - $default = array('some_key' => 'some_value'); - $this->_model->setDefault($default); - $this->assertEquals($default, $this->_model->getDefault()); - } - public function testGetRequest() { $this->assertNull($this->_model->getRequest()); @@ -80,7 +71,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('Cant\'t test dispatch process without sending headers'); } $_SERVER['HTTP_HOST'] = 'localhost'; - $this->_objectManager->get('Magento\Config\Scope')->setCurrentScope('frontend'); + $this->_objectManager->get('Magento\App\State')->setAreaCode('frontend'); $request = $this->_objectManager->create('Magento\App\Request\Http'); /* empty action */ $request->setRequestUri('core/index/index'); diff --git a/dev/tests/integration/testsuite/Magento/Authorizenet/Block/Directpost/IframeTest.php b/dev/tests/integration/testsuite/Magento/Authorizenet/Block/Directpost/IframeTest.php index aaea940c9ba86c163f8f4966294dda351bdba044..bf6181af2ff36427e7f8a5c36311a8393f6a7dad 100644 --- a/dev/tests/integration/testsuite/Magento/Authorizenet/Block/Directpost/IframeTest.php +++ b/dev/tests/integration/testsuite/Magento/Authorizenet/Block/Directpost/IframeTest.php @@ -34,6 +34,7 @@ class IframeTest extends \PHPUnit_Framework_TestCase */ public function testToHtml() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $xssString = '</script><script>alert("XSS")</script>'; /** @var $block \Magento\Authorizenet\Block\Directpost\Iframe */ $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') diff --git a/dev/tests/integration/testsuite/Magento/Backend/App/Router/DefaultRouterTest.php b/dev/tests/integration/testsuite/Magento/Backend/App/Router/DefaultRouterTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4834b92d96268ab4b4c19d83718055837e7db3fd --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Backend/App/Router/DefaultRouterTest.php @@ -0,0 +1,76 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Backend + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Backend\App\Router; + +/** + * @magentoAppArea adminhtml + */ +class DefaultRouterTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Backend\App\Router\DefaultRouter + */ + protected $_model; + + protected function setUp() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_model = $objectManager->create('Magento\Backend\App\Router\DefaultRouter'); + } + + public function testRouterCanProcessRequestsWithProperPathInfo() + { + $request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $request->expects($this->once()) + ->method('getPathInfo') + ->will($this->returnValue('backend/admin/dashboard')); + + $this->assertInstanceOf('Magento\Backend\Controller\Adminhtml\Dashboard', $this->_model->match($request)); + } + + /** + * @param string $module + * @param string $controller + * @param string $className + * + * @dataProvider getControllerClassNameDataProvider + */ + public function testGetControllerClassName($module, $controller, $className) + { + $this->assertEquals($className, $this->_model->getControllerClassName($module, $controller)); + } + + public function getControllerClassNameDataProvider() + { + return array( + array('Magento_Adminhtml', 'index', 'Magento\Adminhtml\Controller\Index'), + array('Magento_Index', 'process', 'Magento\Index\Controller\Adminhtml\Process'), + array('Magento_Index_Adminhtml', 'process', 'Magento\Index\Controller\Adminhtml\Process'), + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Account/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Account/Edit/FormTest.php similarity index 95% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Account/Edit/FormTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/System/Account/Edit/FormTest.php index c1f0d7263fd6cc0e7bc65a95a0621f635ea9361a..ad973a34da66315723e8239936367e5bee8cfe1f 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Account/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Account/Edit/FormTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Account\Edit; +namespace Magento\Backend\Block\System\Account\Edit; /** * @magentoAppArea adminhtml @@ -45,8 +45,8 @@ class FormTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var \Magento\Adminhtml\Block\System\Account\Edit\Form */ - $block = $layout->createBlock('Magento\Adminhtml\Block\System\Account\Edit\Form'); + /** @var \Magento\Backend\Block\System\Account\Edit\Form */ + $block = $layout->createBlock('Magento\Backend\Block\System\Account\Edit\Form'); $block->toHtml(); $form = $block->getForm(); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php index 7988f069caff107c6325a93bcfb985d0f16e8ab7..a6edb1c751e439a645842d292d7be8b68d0331a6 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php @@ -38,14 +38,14 @@ class FormTest extends \PHPUnit_Framework_TestCase protected $_objectManager; /** - * @var \Magento\Data\Form\Factory + * @var \Magento\Data\FormFactory */ protected $_formFactory; protected function setUp() { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_formFactory = $this->_objectManager->create('Magento\Data\Form\Factory'); + $this->_formFactory = $this->_objectManager->create('Magento\Data\FormFactory'); } public function testDependenceHtml() @@ -54,7 +54,7 @@ class FormTest extends \PHPUnit_Framework_TestCase $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Layout', array('area' => 'adminhtml')); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $block \Magento\Backend\Block\System\Config\Form */ $block = $layout->createBlock('Magento\Backend\Block\System\Config\Form', 'block'); @@ -81,7 +81,7 @@ class FormTest extends \PHPUnit_Framework_TestCase { $this->markTestIncomplete('MAGETWO-9058'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $form = $this->_formFactory->create(); $fieldset = $form->addFieldset($section->getId() . '_' . $group->getId(), array()); @@ -135,7 +135,7 @@ class FormTest extends \PHPUnit_Framework_TestCase { $this->markTestIncomplete('MAGETWO-9058'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $form = $this->_formFactory->create(); $fieldset = $form->addFieldset($section->getId() . '_' . $group->getId(), array()); @@ -166,11 +166,14 @@ class FormTest extends \PHPUnit_Framework_TestCase )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadAreaPart(\Magento\Core\Model\App\Area::AREA_ADMINHTML, \Magento\Core\Model\App\Area::PART_CONFIG); + ->loadAreaPart( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + \Magento\Core\Model\App\Area::PART_CONFIG + ); - $configMock = $this->getMock('Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false, false); + $configMock = $this->getMock('Magento\Module\Dir\Reader', array(), array(), '', false, false); $configMock->expects($this->any())->method('getConfigurationFiles') ->will($this->returnValue(array(__DIR__ . '/_files/test_section_config.xml'))); $configMock->expects($this->any())->method('getModuleDir') diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Design/Edit/Tab/GeneralTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php similarity index 84% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Design/Edit/Tab/GeneralTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php index be96f0e31b8aa01c66a72bd3b7864795631c2ebd..99d28e355ba1111973ec6c8cf63c28c06db94c61 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Design/Edit/Tab/GeneralTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Design\Edit\Tab; +namespace Magento\Backend\Block\System\Design\Edit\Tab; /** - * Test class for \Magento\Adminhtml\Block\System\Design\Edit\Tab\General + * Test class for \Magento\Backend\Block\System\Design\Edit\Tab\General * @magentoAppArea adminhtml */ class GeneralTest extends \PHPUnit_Framework_TestCase @@ -40,14 +40,14 @@ class GeneralTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) + ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ->setDefaultDesignTheme(); $objectManager->get('Magento\Core\Model\Registry') ->register('design', $objectManager ->create('Magento\Core\Model\Design')); $layout = $objectManager ->create('Magento\Core\Model\Layout'); - $block = $layout->addBlock('Magento\Adminhtml\Block\System\Design\Edit\Tab\General'); + $block = $layout->addBlock('Magento\Backend\Block\System\Design\Edit\Tab\General'); $prepareFormMethod = new \ReflectionMethod( - 'Magento\Adminhtml\Block\System\Design\Edit\Tab\General', '_prepareForm' + 'Magento\Backend\Block\System\Design\Edit\Tab\General', '_prepareForm' ); $prepareFormMethod->setAccessible(true); $prepareFormMethod->invoke($block); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/DeleteTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php similarity index 88% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/DeleteTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php index 0fe5ae4b2260d5e801709c303889ec211e24754c..c0e087dfbd5c9e406ec2394932c42d5cfa8183ec 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/DeleteTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Store; +namespace Magento\Backend\Block\System\Store; /** * @magentoAppArea adminhtml @@ -36,8 +36,8 @@ class DeleteTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var $block \Magento\Adminhtml\Block\System\Store\Delete */ - $block = $layout->createBlock('Magento\Adminhtml\Block\System\Store\Delete', 'block'); + /** @var $block \Magento\Backend\Block\System\Store\Delete */ + $block = $layout->createBlock('Magento\Backend\Block\System\Store\Delete', 'block'); $dataObject = new \Magento\Object; $form = $block->getChildBlock('form'); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/Edit/Form/GroupTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php similarity index 92% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/Edit/Form/GroupTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php index 341cfae72b6e799f63fd5f33010088ffbbc750b3..42f0abcfc610907a7cb7231c4c86facb711dfb65 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/Edit/Form/GroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Store\Edit\Form; +namespace Magento\Backend\Block\System\Store\Edit\Form; /** * @magentoAppIsolation enabled @@ -34,7 +34,7 @@ namespace Magento\Adminhtml\Block\System\Store\Edit\Form; class GroupTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Adminhtml\Block\System\Store\Edit\Form\Group + * @var \Magento\Backend\Block\System\Store\Edit\Form\Group */ protected $_block; @@ -57,7 +57,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\Core\Model\Layout */ $layout = $objectManager->get('Magento\View\LayoutInterface'); - $this->_block = $layout->createBlock('Magento\Adminhtml\Block\System\Store\Edit\Form\Group'); + $this->_block = $layout->createBlock('Magento\Backend\Block\System\Store\Edit\Form\Group'); $this->_block->toHtml(); } diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/Edit/Form/StoreTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php similarity index 92% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/Edit/Form/StoreTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php index 017c46e267e8ff31de8d9c4955c6b9b9c2f93f0b..8b7bbfefce830742bb25f5232ff58d5629ca5e2c 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/Edit/Form/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Store\Edit\Form; +namespace Magento\Backend\Block\System\Store\Edit\Form; /** * @magentoAppIsolation enabled @@ -34,7 +34,7 @@ namespace Magento\Adminhtml\Block\System\Store\Edit\Form; class StoreTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Adminhtml\Block\System\Store\Edit\Form\Store + * @var \Magento\Backend\Block\System\Store\Edit\Form\Store */ protected $_block; @@ -57,7 +57,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\Core\Model\Layout */ $layout = $objectManager->get('Magento\View\LayoutInterface'); - $this->_block = $layout->createBlock('Magento\Adminhtml\Block\System\Store\Edit\Form\Store'); + $this->_block = $layout->createBlock('Magento\Backend\Block\System\Store\Edit\Form\Store'); $this->_block->toHtml(); } diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/Edit/Form/WebsiteTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php similarity index 92% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/Edit/Form/WebsiteTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php index 3a61acaa2633e3ef562b83eab5c1a711ee3a41f9..ed8d5098c72d62ff83fd3750f01195e29569535e 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/Edit/Form/WebsiteTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Store\Edit\Form; +namespace Magento\Backend\Block\System\Store\Edit\Form; /** * @magentoAppIsolation enabled @@ -34,7 +34,7 @@ namespace Magento\Adminhtml\Block\System\Store\Edit\Form; class WebsiteTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Adminhtml\Block\System\Store\Edit\Form\Website + * @var \Magento\Backend\Block\System\Store\Edit\Form\Website */ protected $_block; @@ -56,7 +56,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\Core\Model\Layout */ $layout = $objectManager->get('Magento\View\LayoutInterface'); - $this->_block = $layout->createBlock('Magento\Adminhtml\Block\System\Store\Edit\Form\Website'); + $this->_block = $layout->createBlock('Magento\Backend\Block\System\Store\Edit\Form\Website'); $this->_block->toHtml(); } diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php similarity index 81% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/EditTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php index 7a6422efe79704981e0fe3a1ef748f75f33407f6..323b4fcbe6b8404e95545ebc6fc42135d5f0237e 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Store/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Store; +namespace Magento\Backend\Block\System\Store; /** * @magentoAppArea adminhtml @@ -65,9 +65,9 @@ class EditTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var $block \Magento\Adminhtml\Block\System\Store\Edit */ - $block = $layout->createBlock('Magento\Adminhtml\Block\System\Store\Edit', 'block'); - $block->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + /** @var $block \Magento\Backend\Block\System\Store\Edit */ + $block = $layout->createBlock('Magento\Backend\Block\System\Store\Edit', 'block'); + $block->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->assertInstanceOf($expected, $block->getChildBlock('form')); } @@ -82,25 +82,25 @@ class EditTest extends \PHPUnit_Framework_TestCase array( 'store_type' => 'website', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Website') + ->create('Magento\Core\Model\Website') ), - 'Magento\Adminhtml\Block\System\Store\Edit\Form\Website' + 'Magento\Backend\Block\System\Store\Edit\Form\Website' ), array( array( 'store_type' => 'group', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Store\Group') + ->create('Magento\Core\Model\Store\Group') ), - 'Magento\Adminhtml\Block\System\Store\Edit\Form\Group' + 'Magento\Backend\Block\System\Store\Edit\Form\Group' ), array( array( 'store_type' => 'store', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Store') + ->create('Magento\Core\Model\Store') ), - 'Magento\Adminhtml\Block\System\Store\Edit\Form\Store' + 'Magento\Backend\Block\System\Store\Edit\Form\Store' ) ); } @@ -116,9 +116,9 @@ class EditTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var $block \Magento\Adminhtml\Block\System\Store\Edit */ - $block = $layout->createBlock('Magento\Adminhtml\Block\System\Store\Edit', 'block'); - $block->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + /** @var $block \Magento\Backend\Block\System\Store\Edit */ + $block = $layout->createBlock('Magento\Backend\Block\System\Store\Edit', 'block'); + $block->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->assertEquals($expected, $block->getHeaderText()); } @@ -133,7 +133,7 @@ class EditTest extends \PHPUnit_Framework_TestCase array( 'store_type' => 'website', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Website'), + ->create('Magento\Core\Model\Website'), 'store_action' => 'add' ), 'New Web Site' @@ -142,7 +142,7 @@ class EditTest extends \PHPUnit_Framework_TestCase array( 'store_type' => 'website', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Website'), + ->create('Magento\Core\Model\Website'), 'store_action' => 'edit' ), 'Edit Web Site' @@ -151,7 +151,7 @@ class EditTest extends \PHPUnit_Framework_TestCase array( 'store_type' => 'group', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Store\Group'), + ->create('Magento\Core\Model\Store\Group'), 'store_action' => 'add' ), 'New Store' @@ -160,7 +160,7 @@ class EditTest extends \PHPUnit_Framework_TestCase array( 'store_type' => 'group', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Store\Group'), + ->create('Magento\Core\Model\Store\Group'), 'store_action' => 'edit' ), 'Edit Store' @@ -169,7 +169,7 @@ class EditTest extends \PHPUnit_Framework_TestCase array( 'store_type' => 'store', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Store'), + ->create('Magento\Core\Model\Store'), 'store_action' => 'add' ), 'New Store View' @@ -178,7 +178,7 @@ class EditTest extends \PHPUnit_Framework_TestCase array( 'store_type' => 'store', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Store'), + ->create('Magento\Core\Model\Store'), 'store_action' => 'edit' ), 'Edit Store View' diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Variable/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Variable/EditTest.php similarity index 93% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Variable/EditTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Block/System/Variable/EditTest.php index 08e8402de4eda1776bbdbcc1b9cc5943223acf81..b90c83a5b9504f1b84655f0048fa781c56afd30a 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/System/Variable/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Variable/EditTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Variable; +namespace Magento\Backend\Block\System\Variable; /** * @magentoAppArea adminhtml @@ -54,7 +54,7 @@ class EditTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\App\RequestInterface') ->setParam('variable_id', $variable->getId()); $block = $objectManager->get('Magento\View\LayoutInterface') - ->createBlock('Magento\Adminhtml\Block\System\Variable\Edit', 'variable'); + ->createBlock('Magento\Backend\Block\System\Variable\Edit', 'variable'); $this->assertArrayHasKey('variable-delete_button', $block->getLayout()->getAllBlocks()); } } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php index 29982f371d0a70551628da72442d816f0beeb9a5..2d9b82a3e385423fa280f2055bfbf958b5ec34f2 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php @@ -41,7 +41,7 @@ class FormTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) + ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ->setDefaultDesignTheme(); $layout = $objectManager->create('Magento\Core\Model\Layout'); $formBlock = $layout->addBlock('Magento\Backend\Block\Widget\Form'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php index f014623bc3d330e04cffc061c0945dae564ddb9f..0d2c1e42f8446b614e7c34e6ec87cdae727c6a2a 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php @@ -69,7 +69,7 @@ class MassactionTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store', - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::THEMES => __DIR__ . '/../../_files/design' ), )); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/WidgetTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/WidgetTest.php index ce0b8056b5628e21bfa6d8cc0add729958713fe5..d13f1e9104220dcdff440eb1ff3fc01bbe91c9b2 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/WidgetTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/WidgetTest.php @@ -41,7 +41,7 @@ class WidgetTest extends \PHPUnit_Framework_TestCase { $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); $layout->getUpdate()->load(); $layout->generateXml()->generateElements(); @@ -63,7 +63,7 @@ class WidgetTest extends \PHPUnit_Framework_TestCase { $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); $layout->getUpdate()->load(); $layout->generateXml()->generateElements(); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php index 2a2ea26601447b02c3ce2cce71012f46fb125f38..0094d6f7cacbfcb4746648fd3a3b9c998871ff69 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php @@ -23,7 +23,7 @@ */ /** @var $registration \Magento\Core\Model\Theme\Registration */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadAreaPart(\Magento\Core\Model\App\Area::AREA_ADMINHTML, \Magento\Core\Model\App\Area::PART_CONFIG); + ->loadAreaPart(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \Magento\Core\Model\App\Area::PART_CONFIG); $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Registration'); $registration->register( diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/AbstractActionTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/AbstractActionTest.php index 3e4f5236571562a1a4735c7de865058a51ae6926..144358a0e02f28c8c13de4bda6c8e232ad5c0680 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/AbstractActionTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/AbstractActionTest.php @@ -18,9 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Backend - * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -35,13 +32,12 @@ class AbstractActionTest extends \Magento\Backend\Utility\Controller { /** * Check redirection to startup page for logged user - * @magentoConfigFixture global/areas/adminhtml/frontName backend * @magentoConfigFixture current_store admin/security/use_form_key 1 */ public function testPreDispatchWithEmptyUrlRedirectsToStartupPage() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->dispatch('backend'); /** @var $backendUrlModel \Magento\Backend\Model\Url */ $backendUrlModel = diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/DashboardTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/DashboardTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3e1004c73a4a7f656fce682bba133832a12774a1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/DashboardTest.php @@ -0,0 +1,43 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Adminhtml + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Backend\Controller\Adminhtml; + +/** + * @magentoAppArea adminhtml + */ +class DashboardTest extends \Magento\Backend\Utility\Controller +{ + public function testAjaxBlockAction() + { + $this->getRequest()->setParam('block', 'tab_orders'); + $this->dispatch('backend/admin/dashboard/ajaxBlock'); + + $actual = $this->getResponse()->getBody(); + $this->assertContains('dashboard-diagram', $actual); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/System/AccountTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/AccountTest.php similarity index 89% rename from dev/tests/integration/testsuite/Magento/Adminhtml/System/AccountTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/AccountTest.php index 5bb128b7be3d473ad13608d22cf1e8e644e0ea1c..1e739f420a9d5a51825f8b39f03971c87e6624d2 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/System/AccountTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/AccountTest.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\System; +namespace Magento\Backend\Controller\Adminhtml\System; /** * @magentoAppArea adminhtml @@ -51,9 +51,11 @@ class AccountTest extends \Magento\Backend\Utility\Controller $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\User\Model\User')->load($userId); $this->assertNotEquals($oldPassword, $user->getPassword()); + + + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->assertTrue( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Helper\Data') - ->validateHash($password, $user->getPassword()) + $objectManager->get('Magento\Encryption\EncryptorInterface')->validateHash($password, $user->getPassword()) ); } } diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Controller/System/DesignTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/DesignTest.php similarity index 96% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Controller/System/DesignTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/DesignTest.php index f3a6d012a54c86c059e4f6e6b3d39becbe12ed44..ccd6839cefc72e5d1a7e979282e482fc9bc59227 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Controller/System/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/DesignTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller\System; +namespace Magento\Backend\Controller\Adminhtml\System; /** * @magentoAppArea adminhtml diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Controller/System/StoreTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/StoreTest.php similarity index 96% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Controller/System/StoreTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/StoreTest.php index 05fabc071be41e1803b5d8066b1bb45e3730948d..cad3f0142007fc6f87191b5eae286d41318734ca 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Controller/System/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/StoreTest.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller\System; +namespace Magento\Backend\Controller\Adminhtml\System; /** * @magentoAppArea adminhtml diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Controller/System/VariableTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/VariableTest.php similarity index 96% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Controller/System/VariableTest.php rename to dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/VariableTest.php index 77e5301153a7cfead3eedb70e01f68a5a24e0458..6bbb5070461866e836b28c06a3ee4b14bf772dfd 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Controller/System/VariableTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/VariableTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller\System; +namespace Magento\Backend\Controller\Adminhtml\System; /** * @magentoAppArea adminhtml diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Router/DefaultRouterTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Router/DefaultRouterTest.php deleted file mode 100644 index 0913771b6b17f2be20cd0fd52e8aae376646f518..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Router/DefaultRouterTest.php +++ /dev/null @@ -1,153 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Backend - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Backend\Controller\Router; - -/** - * @magentoAppArea adminhtml - */ -class DefaultRouterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Backend\Controller\Router\DefaultRouter - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_frontMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_routeConfigMock; - - protected function setUp() - { - parent::setUp(); - - $this->_routeConfigMock = $this->getMock('Magento\Core\Model\Route\Config', array(), array(), '', false); - $options = array( - 'areaCode' => \Magento\Core\Model\App\Area::AREA_ADMINHTML, - 'baseController' => 'Magento\Backend\Controller\AbstractAction', - 'routeConfig' => $this->_routeConfigMock - ); - $this->_frontMock = $this->getMock('Magento\App\FrontController', array(), array(), '', false); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Backend\Controller\Router\DefaultRouter', $options); - $this->_model->setFront($this->_frontMock); - } - - public function testRouterCannotProcessRequestsWithWrongFrontName() - { - $request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); - $request->expects($this->once()) - ->method('getPathInfo') - ->will($this->returnValue('frontend/admin/dashboard')); - $this->_frontMock->expects($this->never()) - ->method('setDefault'); - $this->_model->match($request); - } - - public function testRouterCanProcessRequestsWithProperFrontName() - { - $request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); - $request->expects($this->once()) - ->method('getPathInfo') - ->will($this->returnValue('backend/admin/dashboard')); - $this->_frontMock->expects($this->once()) - ->method('setDefault'); - - $adminRoute = array( - 'adminhtml' => array( - 'id' => 'adminhtml', - 'frontName' => 'admin', - 'modules' => array( - 'Magento_Adminhtml' - ) - ) - ); - - $this->_routeConfigMock->expects($this->once()) - ->method('getRoutes') - ->will($this->returnValue($adminRoute)); - $this->_model->match($request); - } - - - /** - * @covers \Magento\Backend\Controller\Router\DefaultRouter::fetchDefault - */ - public function testFetchDefault() - { - $default = array( - 'area' => '', - 'module' => 'admin', - 'controller' => 'index', - 'action' => 'index' - ); - $routes = array( - 'adminhtml' => array( - 'id' => 'adminhtml', - 'frontName' => 'admin', - 'modules' => array() - ), - 'key1' => array('frontName' => 'something'), - ); - - $this->_routeConfigMock->expects($this->once())->method('getRoutes') - ->will($this->returnValue($routes)); - - $this->_frontMock->expects($this->once()) - ->method('setDefault') - ->with($this->equalTo($default)); - $this->_model->fetchDefault(); - } - - /** - * @param string $module - * @param string $controller - * @param string $className - * - * @covers \Magento\Backend\Controller\Router\DefaultRouter::getControllerClassName - * @dataProvider getControllerClassNameDataProvider - */ - public function testGetControllerClassName($module, $controller, $className) - { - $this->assertEquals($className, $this->_model->getControllerClassName($module, $controller)); - } - - public function getControllerClassNameDataProvider() - { - return array( - array('Magento_Adminhtml', 'index', 'Magento\Adminhtml\Controller\Index'), - array('Magento_Index', 'process', 'Magento\Index\Controller\Adminhtml\Process'), - array('Magento_Index_Adminhtml', 'process', 'Magento\Index\Controller\Adminhtml\Process'), - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Backend/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Backend/Helper/DataTest.php index 2e3ec9dc9a70853db4db0be4fd0d75b5cf68510e..b2c7dbd3fb585cbf4573c4430a44a1db5397950f 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Helper/DataTest.php @@ -45,7 +45,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function setUp() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Backend\Helper\Data'); } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/Auth/SessionTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/Auth/SessionTest.php index 8faa5176f4e47686c594852c1162cddc5842b1af..416d41d18300c9e58d7eb345034e0dbb2ec0d48c 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/Auth/SessionTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/Auth/SessionTest.php @@ -46,7 +46,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase { parent::setUp(); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->_auth = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Backend\Model\Auth'); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php index 956faa5e9129f37ff60321faf3a4d02c07f4b980..61dc2c70390873df2325e36d1fd3642b1add1213 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php @@ -44,7 +44,7 @@ class AuthTest extends \PHPUnit_Framework_TestCase parent::setUp(); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Backend\Model\Auth'); } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/ConfigTest.php index 858d7cc4f602f7b0dd76117d8c61fb87858eeb1b..98eb62221c750cc833ee31c13ffe970d43621264 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/ConfigTest.php @@ -42,7 +42,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testSaveWithSingleStoreModeEnabled($groups) { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $_configDataObject \Magento\Backend\Model\Config */ $_configDataObject = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Backend\Model\Config'); @@ -90,22 +90,22 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ public function testSave($section, $groups, $expected) { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $_configDataObject \Magento\Backend\Model\Config */ - $_configDataObject = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Backend\Model\Config'); + $_configDataObject = $objectManager->create('Magento\Backend\Model\Config'); $_configDataObject->setSection($section) ->setWebsite('base') ->setGroups($groups) ->save(); foreach ($expected as $group => $expectedData) { - $_configDataObject = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Backend\Model\Config'); + $_configDataObject = $objectManager->create('Magento\Backend\Model\Config'); $_configData = $_configDataObject->setSection($group)->setWebsite('base') ->load(); if (array_key_exists('payment/payflow_link/pwd', $_configData)) { $_configData['payment/payflow_link/pwd'] = - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Helper\Data') + $objectManager->get('Magento\Encryption\EncryptorInterface') ->decrypt($_configData['payment/payflow_link/pwd']); } $this->assertEquals($expectedData, $_configData); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php index 23a16e9b6afc1595a6d2edbfe6228eec34fb6815..b1a7e61453b97dce2b4543fbe8f37cf58ab6dfae 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php @@ -43,11 +43,11 @@ class MenuTest extends \PHPUnit_Framework_TestCase { parent::setUp(); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Backend\Model\Auth'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); } public function testMenuItemManipulation() diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/SessionTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/SessionTest.php index a9422343c714ab804c002d3d993c8fc72b851c87..a29709441b881e2dc18889c9310c4204f5e7dacc 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/SessionTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/SessionTest.php @@ -39,7 +39,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase if (array_key_exists('adminhtml', $_SESSION)) { unset($_SESSION['adminhtml']); } - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Backend\Model\Session', array($logger)); $this->assertArrayHasKey('adminhtml', $_SESSION); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php index 43bd2212de6bcf70f6cf2bd40d62765186d9c169..fb19483a94a3b65f96952e129d56d8d84992dcd4 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/UrlTest.php @@ -118,25 +118,28 @@ class UrlTest extends \PHPUnit_Framework_TestCase */ public function getSecretKeyDataProvider() { - /** @var $helper \Magento\Core\Helper\Data */ - $helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Helper\Data'); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + /** @var $encryptor \Magento\Encryption\EncryptorInterface */ + $encryptor = $objectManager->get('Magento\Encryption\EncryptorInterface'); + return array( array('', '', '', - $helper->getHash('default_router' . 'default_controller' . 'default_action' . 'salt')), + $encryptor->getHash('default_router' . 'default_controller' . 'default_action' . 'salt')), array('', '', 'action', - $helper->getHash('default_router' . 'default_controller' . 'action' . 'salt')), + $encryptor->getHash('default_router' . 'default_controller' . 'action' . 'salt')), array('', 'controller', '', - $helper->getHash('default_router' . 'controller' . 'default_action' . 'salt')), + $encryptor->getHash('default_router' . 'controller' . 'default_action' . 'salt')), array('', 'controller', 'action', - $helper->getHash('default_router' . 'controller' . 'action' . 'salt')), + $encryptor->getHash('default_router' . 'controller' . 'action' . 'salt')), array('adminhtml', '', '', - $helper->getHash('adminhtml' . 'default_controller' . 'default_action' . 'salt')), + $encryptor->getHash('adminhtml' . 'default_controller' . 'default_action' . 'salt')), array('adminhtml', '', 'action', - $helper->getHash('adminhtml' . 'default_controller' . 'action' . 'salt')), + $encryptor->getHash('adminhtml' . 'default_controller' . 'action' . 'salt')), array('adminhtml', 'controller', '', - $helper->getHash('adminhtml' . 'controller' . 'default_action' . 'salt')), + $encryptor->getHash('adminhtml' . 'controller' . 'default_action' . 'salt')), array('adminhtml', 'controller', 'action', - $helper->getHash('adminhtml' . 'controller' . 'action' . 'salt')), + $encryptor->getHash('adminhtml' . 'controller' . 'action' . 'salt')), ); } @@ -145,9 +148,12 @@ class UrlTest extends \PHPUnit_Framework_TestCase */ public function testGetSecretKeyForwarded() { - /** @var $helper \Magento\Core\Helper\Data */ - $helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Helper\Data'); - /** @var $request \Magento\App\RequestInterface */ + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + /** @var $encryptor \Magento\Encryption\EncryptorInterface */ + $encryptor = $objectManager->get('Magento\Encryption\EncryptorInterface'); + + /** @var $request \Magento\App\Request\Http */ $request = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\App\RequestInterface'); $request->setControllerName('controller')->setActionName('action'); @@ -156,7 +162,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Session') ->setData('_form_key', 'salt'); $this->assertEquals( - $helper->getHash('controller' . 'action' . 'salt'), + $encryptor->getHash('controller' . 'action' . 'salt'), $this->_model->getSecretKey() ); } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php index f8404edc8cc3981504e35ac36e91ded0a76afce3..752df3e8119a03ad65e2ccfad4145448e1b2be3d 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php @@ -35,12 +35,12 @@ class GridTest */ public function testToHtmlHasOnClick() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); $block = $layout->createBlock( 'Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option\Search\Grid', diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/SearchTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/SearchTest.php index 62d35083fc1ab09498525057948c37f6e0999c1b..569b42a70031f64ed0a6f80ed5e2f8a3ac876e96 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/SearchTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/SearchTest.php @@ -32,20 +32,16 @@ class SearchTest { /** * @magentoAppIsolation enabled + * @magentoAppArea adminhtml */ public function testToHtmlHasIndex() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML); - /** @var $layout \Magento\View\LayoutInterface */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) - ); + $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Layout'); $block = $layout->createBlock( 'Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option\Search', - 'block2'); + 'block2' + ); $indexValue = 'magento_index_set_to_test'; $block->setIndex($indexValue); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php index 0e2d65578140d01c044ee7e6fa11bf307449a861..1e52d510c4264f1aaa1fc43ab2c065640b2aa696 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php @@ -39,20 +39,18 @@ class TabsTest extends \PHPUnit_Framework_TestCase public function testPrepareLayout() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\App\State')->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) ->setDefaultDesignTheme(); - $objectManager->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); /** @var $product \Magento\Catalog\Model\Product */ $product = $objectManager->create('Magento\Catalog\Model\Product'); $product->load(1); // fixture $objectManager->get('Magento\Core\Model\Registry')->register('product', $product); + $objectManager->get('Magento\App\State')->setAreaCode('nonexisting'); /** @var $layout \Magento\Core\Model\Layout */ $layout = $objectManager->get('Magento\View\LayoutInterface'); $layout->addBlock('Magento\Core\Block\Text', 'head'); - $layout->setArea('nonexisting'); // prevent block templates rendering /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs */ $block = $layout->createBlock('Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs'); $this->assertArrayHasKey(0, $block->getTabsIds()); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php index 5c77706f60c1f1427a5a609f75394d91889ed1a3..5f2b882c628aa9c6974e3b79a783d93d5d02178b 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php @@ -33,14 +33,14 @@ class CategoryTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); $block = $objectManager->create('Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Category', array('layout' => $layout)); - /** @var $formFactory \Magento\Data\Form\Factory */ - $formFactory = $objectManager->get('Magento\Data\Form\Factory'); + /** @var $formFactory \Magento\Data\FormFactory */ + $formFactory = $objectManager->get('Magento\Data\FormFactory'); $form = $formFactory->create(); $block->setForm($form); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php index e7c81f2ed0a92fa4f3a71f018e9c9361f0c2235d..fbd7d3c2fc4631b8ee8eb028bfb0555ab820b0ec 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php @@ -35,14 +35,14 @@ class WeightTest extends \PHPUnit_Framework_TestCase protected $_objectManager; /** - * @var \Magento\Data\Form\Factory + * @var \Magento\Data\FormFactory */ protected $_formFactory; protected function setUp() { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_formFactory = $this->_objectManager->create('Magento\Data\Form\Factory'); + $this->_formFactory = $this->_objectManager->create('Magento\Data\FormFactory'); } /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php index a516c1ad474e5b4c1985a144ede2f5f8ca2d3b72..18b340085b1cd0a8f8ba902dfc77cfb2ae887955 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php @@ -65,6 +65,8 @@ class AbstractTest extends \PHPUnit_Framework_TestCase self::$_isStubClass = true; } + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode('frontend'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') ->setDefaultDesignTheme(); $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListTest.php index 31f73cb1a5da8f5c0ba40f30127b909c45fa546a..2d907c48d0b81e3f6708c005b2bf47c16ccc9573 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListTest.php @@ -41,6 +41,8 @@ class ListTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode('frontend'); $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') ->createBlock('Magento\Catalog\Block\Product\ListProduct'); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php index cdf29e5a04e0e0230f72f2ca6201631981706a66..18eb7e0b6a453fa940d856d444d6a935487bb72f 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php @@ -41,10 +41,10 @@ class NewTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') ->createBlock('Magento\Catalog\Block\Product\NewProduct'); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); } public function testGetCacheKeyInfo() diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php index 5e867a346db533c422147afc12a50ba233d75094..1b40e69e5ea07568b3dafc46f1077f6f5a6aceee 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php @@ -37,7 +37,7 @@ class CrosssellTest extends \PHPUnit_Framework_TestCase public function testAll() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Product'); $product->load(2); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php index 58fe415949b255c6b84c49c42d19caaf0d6330be..2bc79c50f9c2cd3facd8a90becdab639ba742be5 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php @@ -37,7 +37,7 @@ class RelatedTest extends \PHPUnit_Framework_TestCase public function testAll() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Product'); $product->load(2); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php index 11bf6b89e181211d7b15d355bcc694b93cbc66a6..81d34678ca8850cd0c5a23a96912a27d80337f93 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php @@ -40,21 +40,30 @@ class AttributeTest extends \Magento\Backend\Utility\Controller */ public function testSaveActionRedirectsSuccessfully() { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $session \Magento\Adminhtml\Model\Session */ - $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Adminhtml\Model\Session'); + $session = $objectManager->get('Magento\Adminhtml\Model\Session'); $session->setProductIds(array(1)); $this->dispatch('backend/catalog/product_action_attribute/save/store/0'); $this->assertEquals(302, $this->getResponse()->getHttpResponseCode()); - $expectedUrl = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Url')-> - getUrl('backend/catalog/product/index'); + /** @var \Magento\Backend\Model\Url $urlBuilder */ + $urlBuilder = $objectManager->get('Magento\UrlInterface'); + + /** @var \Magento\Catalog\Helper\Product\Edit\Action\Attribute $attributeHelper */ + $attributeHelper = $objectManager->get('Magento\Catalog\Helper\Product\Edit\Action\Attribute'); + $expectedUrl = $urlBuilder->getUrl( + 'catalog/product/index', array('store' => $attributeHelper->getSelectedStoreId())) + ; $isRedirectPresent = false; foreach ($this->getResponse()->getHeaders() as $header) { if ($header['name'] === 'Location' && strpos($header['value'], $expectedUrl) === 0) { $isRedirectPresent = true; } } + $this->assertTrue($isRedirectPresent); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php index d5f3db009211b282648c5eb5948dbd9a76ef388f..125977e64faa864e79fb6aa1142d3cc62a14f6ee 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php @@ -118,7 +118,7 @@ class AttributeTest extends \Magento\Backend\Utility\Controller /** @var \Magento\Core\Model\Translate $translate */ $translate = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Translate'); - $translate->init(\Magento\Backend\Helper\Data::BACKEND_AREA_CODE, null); + $translate->init(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, null); return $translate->translate(array($string)); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php index e20e58ab553791bf0e8a97ee5156061131d1028d..811f23658c1d8fdecdf4c9a7536484d88932730d 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php @@ -139,8 +139,10 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController /** @var $visitor \Magento\Log\Model\Visitor */ $visitor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Log\Model\Visitor'); + /** @var \Magento\Stdlib\DateTime $dateTime */ + $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('\Magento\Stdlib\DateTime'); $visitor->setSessionId(md5(time()) . md5(microtime())) - ->setLastVisitAt(now()) + ->setLastVisitAt($dateTime->now()) ->save(); /** @var $item \Magento\Catalog\Model\Product\Compare\Item */ $item = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() @@ -157,8 +159,12 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController /** @var $visitor \Magento\Log\Model\Visitor */ $visitor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Log\Model\Visitor'); + + /** @var \Magento\Stdlib\DateTime $dateTime */ + $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('\Magento\Stdlib\DateTime'); + $visitor->setSessionId(md5(time()) . md5(microtime())) - ->setLastVisitAt(now()) + ->setLastVisitAt($dateTime->now()) ->save(); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Log\Model\Visitor') @@ -172,8 +178,10 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController /** @var $visitor \Magento\Log\Model\Visitor */ $visitor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Log\Model\Visitor'); + /** @var \Magento\Stdlib\DateTime $dateTime */ + $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('\Magento\Stdlib\DateTime'); $visitor->setSessionId(md5(time()) . md5(microtime())) - ->setLastVisitAt(now()) + ->setLastVisitAt($dateTime->now()) ->save(); /** @var $item \Magento\Catalog\Model\Product\Compare\Item */ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php index fe57266a56d9919968326452dfe3f1b135d47ba8..7cd53a74488a797801164706a8e2b248b0e28769 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php @@ -29,6 +29,9 @@ namespace Magento\Catalog\Helper\Product; require \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir')->getDir() . '/app/code/Magento/Catalog/Controller/Product.php'; +/** + * @magentoAppArea frontend + */ class ViewTest extends \PHPUnit_Framework_TestCase { /** @@ -44,6 +47,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase protected function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\App\State')->setAreaCode('frontend'); $objectManager->get('Magento\View\DesignInterface') ->setDefaultDesignTheme(); $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() @@ -80,6 +84,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase /** * @magentoAppIsolation enabled + * @magentoAppArea frontend */ public function testInitProductLayout() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php index f9eb4bdb75774a9bcfa423033169f0f77f048b9a..b43c9dc898840ec05a96fbbe471c5f2919e0b98d 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ProductTest.php @@ -36,6 +36,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode('frontend'); $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Catalog\Helper\Product'); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php index 2c9284efa47c954baec49444c4b7755790155b28..a679348afae33aa5469f355097e3d4a998fa8c65 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php @@ -48,12 +48,10 @@ class CategoryImageTest extends \PHPUnit_Framework_TestCase protected function setUp() { /** @var $configModel \Magento\Core\Model\Config */ - $configModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Config'); $this->_oldLogActive = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getConfig('dev/log/active'); $this->_oldExceptionFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getConfig('dev/log/exception_file'); - $this->_oldWriterModel = (string)$configModel->getNode('global/log/core/writer_model'); } protected function tearDown() @@ -66,9 +64,6 @@ class CategoryImageTest extends \PHPUnit_Framework_TestCase ->getStore()->setConfig('dev/log/exception_file', $this->_oldExceptionFile); $this->_oldExceptionFile = null; - /** @var $configModel \Magento\Core\Model\Config */ - $configModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Config'); - $configModel->setNode('global/log/core/writer_model', $this->_oldWriterModel); $this->_oldWriterModel = null; /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest/StubZendLogWriterStreamTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest/StubZendLogWriterStreamTest.php index 7557a2b487e78a242e7aa3308b099db7e81c61fe..a0803b2b9ffde625642a180a77a53959a4966e14 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest/StubZendLogWriterStreamTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest/StubZendLogWriterStreamTest.php @@ -31,12 +31,6 @@ namespace Magento\Catalog\Model\Category\CategoryImageTest; ->setConfig('dev/log/active', 1); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() ->setConfig('dev/log/exception_file', 'save_category_without_image.log'); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Config') - ->setNode( - 'global/log/core/writer_model', - 'Magento\Catalog\Model\Category\CategoryImageTest\StubZendLogWriterStreamTest' -); class StubZendLogWriterStreamTest extends \Zend_Log_Writer_Stream { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php index 95e7c7668f59278d6726f68317ce5912435adb60..18bf376162d755f432cdc73987bd40dba97312b0 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php @@ -67,6 +67,9 @@ class ItemTest extends \PHPUnit_Framework_TestCase $model->getFilter(); } + /** + * @magentoAppArea frontend + */ public function testGetUrl() { /** @var $objectManager \Magento\TestFramework\ObjectManager */ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php index 6a41d51983d3a675b6c64c31ac693fa95339686a..0c60a6add66075f29c5daf9788ede574689a461a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php @@ -46,7 +46,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $fileStorageDb = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); $registry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $this->_model = $this->getMockForAbstractClass('Magento\Catalog\Model\Product\Type\AbstractType', array($productFactory, $catalogProductOption, $eavConfig, $catalogProductType, $eventManager, $coreData, $fileStorageDb, $filesystem, $registry, $logger) @@ -267,6 +267,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase */ public function testBeforeSave() { + $this->markTestIncomplete('MAGETWO-9199'); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Product'); @@ -274,7 +275,6 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $product->setData('links_purchased_separately', 'value'); // this attribute is applicable only for downloadable $this->_model->beforeSave($product); $this->assertTrue($product->canAffectOptions()); - $this->markTestIncomplete('MAGETWO-9199'); $this->assertFalse($product->hasData('links_purchased_separately')); } diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php similarity index 83% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/MainTest.php rename to dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php index 68eead7ccb7efeac117de3b153835400d1d7e1be..754a5d632758746b61c2f6e96af83c0cfdb57824 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Promo/Catalog/Edit/Tab/MainTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab; +namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab; /** - * Test class for \Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab\Main + * Test class for \Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Main * * @magentoAppArea adminhtml */ @@ -42,15 +42,15 @@ class MainTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) + ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ->setDefaultDesignTheme(); $rule = $objectManager->create('Magento\CatalogRule\Model\Rule'); $objectManager->get('Magento\Core\Model\Registry')->register('current_promo_catalog_rule', $rule); - $block = $objectManager->create('Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab\Main'); + $block = $objectManager->create('Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Main'); $block->setLayout($objectManager->create('Magento\Core\Model\Layout')); $prepareFormMethod = new \ReflectionMethod( - 'Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab\Main', '_prepareForm' + 'Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Main', '_prepareForm' ); $prepareFormMethod->setAccessible(true); $prepareFormMethod->invoke($block); diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Helper/DataTest.php index e4b02bc65d40ae660ad692114badab601cb2c7ae..f82c7743863ef9937bebf488530932441bd598db 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Helper/DataTest.php @@ -66,23 +66,23 @@ class DataTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\TestFramework\ObjectManager $objectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $mock \Magento\CatalogSearch\Helper\Data */ - $mock = $this->getMock( - 'Magento\CatalogSearch\Helper\Data', - array('getQueryText'), - array( - $objectManager->get('Magento\Core\Helper\Context'), - $objectManager->get('Magento\Core\Helper\String'), - $objectManager->get('Magento\Core\Model\Store\ConfigInterface'), - $objectManager->get('Magento\CatalogSearch\Model\QueryFactory'), + + /** @var \Magento\CatalogSearch\Helper\Data $catalogSearchHelper */ + $catalogSearchHelper = $this->getMock('Magento\CatalogSearch\Helper\Data', array('getQueryText'), array( + $objectManager->get('Magento\Core\Helper\Context'), + $objectManager->get('Magento\Stdlib\String'), + $objectManager->get('Magento\Core\Model\Store\ConfigInterface'), + $objectManager->get('Magento\CatalogSearch\Model\QueryFactory'), + $objectManager->get('Magento\Escaper'), + $objectManager->get('Magento\Filter\FilterManager'), )); - $mock->expects($this->any()) + $catalogSearchHelper->expects($this->any()) ->method('getQueryText') ->will($this->returnValue('five <words> here <being> tested')); - $mock->checkNotes(); + $catalogSearchHelper->checkNotes(); - $notes = implode($mock->getNoteMessages()); + $notes = implode($catalogSearchHelper->getNoteMessages()); $this->assertContains('<being>', $notes); $this->assertNotContains('<being>', $notes); } diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php index 051a43102612e4b9292f7dc6933f1b5aa799e822..9d1e611900de4420d7887b4b094e4a3605276054 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php @@ -40,7 +40,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase protected function setUp() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') ->createBlock('Magento\Checkout\Block\Cart\Item\Renderer'); /** @var $item \Magento\Sales\Model\Quote\Item */ diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php index 83c2fc2d0f5d51e1910b42b8896c22d920bbc312..408dbe22a080800c72473abae7b42068e9afa7a3 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php @@ -32,6 +32,8 @@ class SidebarTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode('frontend'); $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') ->createBlock('Magento\Checkout\Block\Cart\Sidebar'); } diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Block/Multishipping/OverviewTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Block/Multishipping/OverviewTest.php index 2c4e961180f297c2ead4d214a50e3e2015fc5abd..fd467f89a5bb548ee22fb5fab2cf2d688ffda7fc 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Block/Multishipping/OverviewTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Block/Multishipping/OverviewTest.php @@ -34,29 +34,32 @@ class OverviewTest extends \PHPUnit_Framework_TestCase */ protected $_block; + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); - $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_objectManager->get('Magento\Core\Model\App') + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $this->_block = $this->_objectManager->get('Magento\View\LayoutInterface') ->createBlock('Magento\Checkout\Block\Multishipping\Overview'); } public function testGetRowItemHtml() { /** @var $item \Magento\Sales\Model\Quote\Item */ - $item = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Sales\Model\Quote\Item'); + $item = $this->_objectManager->create('Magento\Sales\Model\Quote\Item'); /** @var $product \Magento\Catalog\Model\Product */ - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Product'); + $product = $this->_objectManager->create('Magento\Catalog\Model\Product'); $product->load(1); $item->setProduct($product); /** @var $quote \Magento\Sales\Model\Quote */ - $quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Sales\Model\Quote'); + $quote = $this->_objectManager->create('Magento\Sales\Model\Quote'); $item->setQuote($quote); // assure that default renderer was obtained - $this->assertSelectCount('strong.product.name a', 1, $this->_block->getRowItemHtml($item)); + $this->assertSelectCount('.product.name a', 1, $this->_block->getRowItemHtml($item)); } } diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Controller/MultishippingTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Controller/MultishippingTest.php index 9c3f98e3f5d3c9679248ef97eb1205850d7792b1..ba37eafd22a63c02ca89b2d2dba05e5a9784d520 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Controller/MultishippingTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Controller/MultishippingTest.php @@ -50,7 +50,7 @@ class MultishippingTest extends \Magento\TestFramework\TestCase\AbstractControll $quote->load('test01', 'reserved_order_id'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Checkout\Model\Session') ->setQuoteId($quote->getId()); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); /** @var $session \Magento\Customer\Model\Session */ $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Customer\Model\Session', array($logger)); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/DesignTest.php b/dev/tests/integration/testsuite/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/DesignTest.php similarity index 81% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/DesignTest.php rename to dev/tests/integration/testsuite/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/DesignTest.php index f065f2a10bc08c84e4557a71b4fab5ad33a6e6a2..f201241fd9ab97eecd82936ac8d3da07befea26a 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/DesignTest.php @@ -19,16 +19,16 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Cms * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Cms\Page\Edit\Tab; +namespace Magento\Cms\Block\Adminhtml\Page\Edit\Tab; /** - * Test class for \Magento\Adminhtml\Block\Cms\Page\Edit\Tab\Design + * Test class for \Magento\Cms\Block\Adminhtml\Page\Edit\Tab\Design * @magentoAppArea adminhtml */ class DesignTest extends \PHPUnit_Framework_TestCase @@ -41,16 +41,16 @@ class DesignTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) + ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ->setDefaultDesignTheme(); $objectManager->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager->get('Magento\Core\Model\Registry') ->register('cms_page', $objectManager->create('Magento\Cms\Model\Page')); - $block = $objectManager->create('Magento\Adminhtml\Block\Cms\Page\Edit\Tab\Design'); + $block = $objectManager->create('Magento\Cms\Block\Adminhtml\Page\Edit\Tab\Design'); $prepareFormMethod = new \ReflectionMethod( - 'Magento\Adminhtml\Block\Cms\Page\Edit\Tab\Design', '_prepareForm'); + 'Magento\Cms\Block\Adminhtml\Page\Edit\Tab\Design', '_prepareForm'); $prepareFormMethod->setAccessible(true); $prepareFormMethod->invoke($block); diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php index b756d44aefce7799b3f6dc3af3b3c4439655b112..7452d870143e94576906a19ceed76596c123ac09 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php @@ -49,7 +49,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\UrlInterface'), \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Config\Primary'), + ->get('Magento\App\StateInterface'), \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Cms\Model\PageFactory'), \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/Cms/Helper/PageTest.php b/dev/tests/integration/testsuite/Magento/Cms/Helper/PageTest.php index f22ea85345363128af5f16a9f6b51e6b3098af8e..493db4c80bf4f008439724787a5989334481e1dc 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Helper/PageTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Helper/PageTest.php @@ -27,6 +27,9 @@ namespace Magento\Cms\Helper; +/** + * @magentoAppArea frontend + */ class PageTest extends \PHPUnit_Framework_TestCase { /** @@ -37,6 +40,7 @@ class PageTest extends \PHPUnit_Framework_TestCase { /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\App\State')->setAreaCode('frontend'); $arguments = array( 'request' => $objectManager->get('Magento\TestFramework\Request'), 'response' => $objectManager->get('Magento\TestFramework\Response') diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php index 5a630002cccc9063c3e57b55ef598646420c04a5..398f3aa6e80cfb258010cb75569a4e0942dc209f 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php @@ -40,7 +40,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected function setUp() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Cms\Model\Wysiwyg\Config'); } diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php index 2f4ed6d7b13c2926fbdc9df2e8eff30a3dda006f..7e6c86b00e20298cdca636e1dacd84b5833c46dc 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php @@ -54,8 +54,10 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ public function testGetFilesCollection() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setDesignTheme('magento_basic', 'adminhtml'); + ->setDesignTheme('magento_basic'); /** @var $model \Magento\Cms\Model\Wysiwyg\Images\Storage */ $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Cms\Model\Wysiwyg\Images\Storage'); diff --git a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespaceInterceptor.php b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespaceInterceptor.php index d79650b8d746d91d090242e1e583018ebb8211e0..44ad5f06da505c126bfd03987548b6c60178ff16 100644 --- a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespaceInterceptor.php +++ b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespaceInterceptor.php @@ -159,7 +159,7 @@ class SourceClassWithNamespaceInterceptor extends \Magento\Code\GeneratorTest\So */ public function __wakeup() { - $this->_objectManager = \Magento\Core\Model\ObjectManager::getInstance(); + $this->_objectManager = \Magento\App\ObjectManager::getInstance(); $this->_pluginList = $this->_objectManager->get('Magento\Interception\PluginList'); } diff --git a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespaceProxy.php b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespaceProxy.php index 8565650f9a794821fa99a119d8717c6af45a1c22..71a8dc91c0006708257bc6d995c9849dc9087874 100644 --- a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespaceProxy.php +++ b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespaceProxy.php @@ -85,7 +85,7 @@ class SourceClassWithNamespaceProxy extends \Magento\Code\GeneratorTest\SourceCl */ public function __wakeup() { - $this->_objectManager = \Magento\Core\Model\ObjectManager::getInstance(); + $this->_objectManager = \Magento\App\ObjectManager::getInstance(); } /** diff --git a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespaceInterceptor.php b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespaceInterceptor.php index 6c1ff0fee4344e98a724821a6b88dd3de05a4648..50b5e903829115ebef02c2962703c7e71cea5fab 100644 --- a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespaceInterceptor.php +++ b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespaceInterceptor.php @@ -160,7 +160,7 @@ class SourceClassWithoutNamespaceInterceptor */ public function __wakeup() { - $this->_objectManager = \Magento\Core\Model\ObjectManager::getInstance(); + $this->_objectManager = \Magento\App\ObjectManager::getInstance(); $this->_pluginList = $this->_objectManager->get('Magento\Interception\PluginList'); } diff --git a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespaceProxy.php b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespaceProxy.php index deffee0fc682ae294bba687c1e5a59f2f0b0fc36..c0c12bd4480632aeaec6c99f1ddfa95f3ad2c400 100644 --- a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespaceProxy.php +++ b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespaceProxy.php @@ -86,7 +86,7 @@ class SourceClassWithoutNamespaceProxy */ public function __wakeup() { - $this->_objectManager = \Magento\Core\Model\ObjectManager::getInstance(); + $this->_objectManager = \Magento\App\ObjectManager::getInstance(); } /** diff --git a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceInterfaceWithoutNamespaceInterceptor.php b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceInterfaceWithoutNamespaceInterceptor.php index f70798964b96a25ac1b113dd8e12182c389ced92..d6afae74241e8f364479c57b653f08bbacb917d0 100644 --- a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceInterfaceWithoutNamespaceInterceptor.php +++ b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceInterfaceWithoutNamespaceInterceptor.php @@ -160,7 +160,7 @@ class SourceInterfaceWithoutNamespaceInterceptor */ public function __wakeup() { - $this->_objectManager = \Magento\Core\Model\ObjectManager::getInstance(); + $this->_objectManager = \Magento\App\ObjectManager::getInstance(); $this->_pluginList = $this->_objectManager->get('Magento\Interception\PluginList'); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Controller/Varien/Router/BaseTest.php b/dev/tests/integration/testsuite/Magento/Core/App/Router/BaseTest.php similarity index 63% rename from dev/tests/integration/testsuite/Magento/Core/Controller/Varien/Router/BaseTest.php rename to dev/tests/integration/testsuite/Magento/Core/App/Router/BaseTest.php index 88abd65823443f102e3d251c5b44340106b8d753..bd09b17b7d9ff6d51e209f9e9fdb0a693caf106e 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Controller/Varien/Router/BaseTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/App/Router/BaseTest.php @@ -25,40 +25,25 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Controller\Varien\Router; +namespace Magento\Core\App\Router; class BaseTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Controller\Varien\Router\Base + * @var \Magento\Core\App\Router\Base */ protected $_model; protected function setUp() { - $options = array( - 'areaCode' => 'frontend', - 'baseController' => 'Magento\Core\Controller\Front\Action', - 'routerId' => 'standard' - ); + $options = array('routerId' => 'standard'); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Controller\Varien\Router\Base', $options); - $this->_model->setFront(\Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\App\FrontController')); - } - - public function testFetchDefault() - { - $default = array( - 'module' => 'core', - 'controller' => 'index', - 'action' => 'index' - ); - $this->assertEmpty($this->_model->getFront()->getDefault()); - $this->_model->fetchDefault(); - $this->assertEquals($default, $this->_model->getFront()->getDefault()); + ->create('Magento\Core\App\Router\Base', $options); } + /** + * @magentoAppArea frontend + */ public function testMatch() { if (!\Magento\TestFramework\Helper\Bootstrap::canTestHeaders()) { @@ -81,18 +66,6 @@ class BaseTest extends \PHPUnit_Framework_TestCase $this->assertNull($this->_model->match($request)); } - /** - * @covers \Magento\Core\Controller\Varien\Router\Base::getModulesByFrontName - * @covers \Magento\Core\Controller\Varien\Router\Base::getRouteByFrontName - * @covers \Magento\Core\Controller\Varien\Router\Base::getFrontNameByRoute - */ - public function testGetters() - { - $this->assertEquals(array('Magento_Catalog'), $this->_model->getModulesByFrontName('catalog')); - $this->assertEquals('cms', $this->_model->getRouteByFrontName('cms')); - $this->assertEquals('cms', $this->_model->getFrontNameByRoute('cms')); - } - public function testGetControllerClassName() { $this->assertEquals( diff --git a/dev/tests/integration/testsuite/Magento/Core/Block/AbstractBlockTest.php b/dev/tests/integration/testsuite/Magento/Core/Block/AbstractBlockTest.php index 24802c11f914ed3726931069c8ca84756cf61b96..a1d815996c4da0a990f06c376bfd28e3584d3714 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Block/AbstractBlockTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Block/AbstractBlockTest.php @@ -46,6 +46,7 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') ->setDefaultDesignTheme(); $this->_block = $this->getMockForAbstractClass('Magento\Core\Block\AbstractBlock', array( @@ -628,10 +629,10 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase $this->assertEquals($url, $this->_block->escapeUrl($url)); } - public function testJsQuoteEscape() + public function testEscapeJsQuote() { $script = "var s = 'text';"; - $this->assertEquals('var s = \\\'text\\\';', $this->_block->jsQuoteEscape($script)); + $this->assertEquals('var s = \\\'text\\\';', $this->_block->escapeJsQuote($script)); } public function testGetCacheKeyInfo() diff --git a/dev/tests/integration/testsuite/Magento/Core/Block/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Core/Block/TemplateTest.php index 22246796fc221f74c4090cb3bfd4995a389b040c..4681b04644e8877a9696d3ac5cadcf4fb2235c52 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Block/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Block/TemplateTest.php @@ -59,11 +59,12 @@ class TemplateTest extends \PHPUnit_Framework_TestCase public function testGetArea() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $this->assertEquals('frontend', $this->_block->getArea()); - $this->_block->setLayout(\Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Layout', array('area' => 'some_area'))); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('some_area'); $this->assertEquals('some_area', $this->_block->getArea()); - $this->_block->setArea('another_area'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode('another_area'); $this->assertEquals('another_area', $this->_block->getArea()); } @@ -74,6 +75,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testToHtml() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('any area'); $this->assertEmpty($this->_block->toHtml()); $this->_block->setTemplate(uniqid('invalid_filename.phtml')); $this->assertEmpty($this->_block->toHtml()); diff --git a/dev/tests/integration/testsuite/Magento/Core/Controller/Varien/ActionTest.php b/dev/tests/integration/testsuite/Magento/Core/Controller/Varien/ActionTest.php index bb082db8b1ba17ed23ac17132d793f0d8e1a4ebf..88a17f1d8b0268e624b7d1a0db7bbfa050f64981 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Controller/Varien/ActionTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Controller/Varien/ActionTest.php @@ -27,6 +27,9 @@ namespace Magento\Core\Controller\Varien; +/** + * @magentoAppArea frontend + */ class ActionTest extends \PHPUnit_Framework_TestCase { /** @@ -42,8 +45,9 @@ class ActionTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + $this->_objectManager->get('Magento\App\State')->setAreaCode(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->_objectManager->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_FRONTEND) ->setDefaultDesignTheme(); /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); @@ -54,7 +58,6 @@ class ActionTest extends \PHPUnit_Framework_TestCase 'response' => $this->_objectManager->get('Magento\TestFramework\Response'), ); $this->_objectManager->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_FRONTEND) ->setDefaultDesignTheme(); $context = $this->_objectManager->create('Magento\Core\Controller\Varien\Action\Context', $arguments); $this->_object = $this->getMockForAbstractClass( @@ -297,10 +300,12 @@ class ActionTest extends \PHPUnit_Framework_TestCase { $themes = array('frontend' => 'magento_blank', 'adminhtml' => 'magento_backend', 'install' => 'magento_basic'); $design = $this->_objectManager->create('Magento\Core\Model\View\Design', array('themes' => $themes)); + $app = $this->_objectManager->create('Magento\Core\Model\App'); $this->_objectManager->addSharedInstance($design, 'Magento\Core\Model\View\Design'); + $this->_objectManager->addSharedInstance($app, 'Magento\Core\Model\App'); + $this->_objectManager->addSharedInstance($app, 'Magento\TestFramework\App'); + $app->loadArea($expectedArea); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadArea($expectedArea); /** @var $controller \Magento\Core\Controller\Varien\Action */ $context = $this->_objectManager->create($context, array( 'response' => $this->_objectManager->get('Magento\TestFramework\Response') diff --git a/dev/tests/integration/testsuite/Magento/Core/Helper/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Core/Helper/AbstractTest.php index 81e9d473281311d6b9c6609005d6b90d53666e88..8b054883ef3f6524b34ae630429312115ff959b3 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Helper/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Helper/AbstractTest.php @@ -55,73 +55,6 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $this->assertTrue($this->_helper->isModuleOutputEnabled()); } - /** - * @dataProvider escapeHtmlDataProvider - */ - public function testEscapeHtml($data, $expected) - { - $actual = $this->_helper->escapeHtml($data); - $this->assertEquals($expected, $actual); - } - - /** - * @return array - */ - public function escapeHtmlDataProvider() - { - return array( - 'array data' => array( - 'data' => array('one', '<two>three</two>'), - 'expected' => array('one', '<two>three</two>') - ), - 'string data conversion' => array( - 'data' => '<two>three</two>', - 'expected' => '<two>three</two>' - ), - 'string data no conversion' => array( - 'data' => 'one', - 'expected' => 'one' - ) - ); - } - - public function testStripTags() - { - $this->assertEquals('three', $this->_helper->stripTags('<two>three</two>')); - } - - /** - * @covers \Magento\Core\Helper\AbstractHelper::escapeUrl - */ - public function testEscapeUrl() - { - $data = '<two>"three</two>'; - $expected = '<two>"three</two>'; - $this->assertEquals($expected, $this->_helper->escapeUrl($data)); - } - - public function testJsQuoteEscape() - { - $data = array("Don't do that.", 'lost_key' => "Can't do that."); - $expected = array("Don\\'t do that.", "Can\\'t do that."); - $this->assertEquals($expected, $this->_helper->jsQuoteEscape($data)); - $this->assertEquals($expected[0], $this->_helper->jsQuoteEscape($data[0])); - } - - /** - * @covers \Magento\Core\Helper\AbstractHelper::quoteEscape - */ - public function testQuoteEscape() - { - $data = "Text with 'single' and \"double\" quotes"; - $expected = array( - "Text with 'single' and "double" quotes", - "Text with \\'single\\' and \\"double\\" quotes", - ); - $this->assertEquals($expected[0], $this->_helper->quoteEscape($data)); - $this->assertEquals($expected[1], $this->_helper->quoteEscape($data, true)); - } - public function testUrlEncodeDecode() { $data = uniqid(); diff --git a/dev/tests/integration/testsuite/Magento/Core/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Core/Helper/DataTest.php index 2cb5a59f70487eebb51336060572f54a5c926dba..229ac663ec3278063127e846930e383d5ce71bdd 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Helper/DataTest.php @@ -57,11 +57,6 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_dateTime->setTimezone(new \DateTimeZone(self::DATE_TIMEZONE)); } - public function testGetEncryptor() - { - $this->assertInstanceOf('Magento\Core\Model\Encryption', $this->_helper->getEncryptor()); - } - public function testCurrency() { $price = 10.00; @@ -107,40 +102,6 @@ class DataTest extends \PHPUnit_Framework_TestCase ); } - public function testEncryptDecrypt() - { - $initial = md5(uniqid()); - $encrypted = $this->_helper->encrypt($initial); - $this->assertNotEquals($initial, $encrypted); - $this->assertEquals($initial, $this->_helper->decrypt($encrypted)); - } - - public function testValidateKey() - { - $validKey = md5(uniqid()); - $this->assertInstanceOf('Magento\Crypt', $this->_helper->validateKey($validKey)); - } - - public function testGetRandomString() - { - $string = $this->_helper->getRandomString(10); - $this->assertEquals(10, strlen($string)); - } - - public function testGetValidateHash() - { - $password = uniqid(); - $hash = $this->_helper->getHash($password); - - $this->assertTrue(is_string($hash)); - $this->assertTrue($this->_helper->validateHash($password, $hash)); - } - - public function testGetStoreId() - { - $this->assertTrue(is_numeric($this->_helper->getStoreId())); - } - /** * @magentoAppIsolation enabled */ @@ -155,7 +116,12 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testIsDevAllowedTrue() { - $_SERVER['REMOTE_ADDR'] = '192.168.0.1'; + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + /** @var \Magento\TestFramework\Request $request */ + $request = $objectManager->get('Magento\TestFramework\Request'); + $request->setServer(array('REMOTE_ADDR' => '192.168.0.1')); + $this->assertTrue($this->_helper->isDevAllowed()); } @@ -165,7 +131,12 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testIsDevAllowedFalse() { - $_SERVER['REMOTE_ADDR'] = '192.168.0.3'; + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + /** @var \Magento\TestFramework\Request $request */ + $request = $objectManager->get('Magento\TestFramework\Request'); + $request->setServer(array('REMOTE_ADDR' => '192.168.0.3')); + $this->assertFalse($this->_helper->isDevAllowed()); } @@ -246,56 +217,6 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->assertEquals($decoratedVo, $this->_helper->decorateArray($sample, '')); } - public function testAssocToXml() - { - $data = array( - 'one' => 1, - 'two' => array( - 'three' => 3, - 'four' => '4', - ), - ); - $result = $this->_helper->assocToXml($data); - $expectedResult = <<<XML -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<_><one>1</one><two><three>3</three><four>4</four></two></_> - -XML; - $this->assertInstanceOf('SimpleXMLElement', $result); - $this->assertEquals($expectedResult, $result->asXML()); - } - - /** - * @param array $array - * @param string $rootName - * @expectedException \Magento\Exception - * @dataProvider assocToXmlExceptionDataProvider - */ - public function testAssocToXmlException($array, $rootName = '_') - { - $this->_helper->assocToXml($array, $rootName); - } - - public function assocToXmlExceptionDataProvider() - { - return array( - array(array(), ''), - array(array(), 0), - array(array(1, 2, 3)), - array(array('root' => 1), 'root'), - ); - } - - public function testXmlToAssoc() - { - $xmlstr = <<<XML -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<_><one>1</one><two><three>3</three><four>4</four></two></_> -XML; - $result = $this->_helper->xmlToAssoc(new \SimpleXMLElement($xmlstr)); - $this->assertEquals(array('one' => '1', 'two' => array('three' => '3', 'four' => '4')), $result); - } - public function testJsonEncodeDecode() { $data = array('one' => 1, 'two' => 'two'); @@ -304,15 +225,6 @@ XML; $this->assertEquals($data, $this->_helper->jsonDecode($jsonData)); } - public function testUniqHash() - { - $hashOne = $this->_helper->uniqHash(); - $hashTwo = $this->_helper->uniqHash(); - $this->assertTrue(is_string($hashOne)); - $this->assertTrue(is_string($hashTwo)); - $this->assertNotEquals($hashOne, $hashTwo); - } - public function testGetDefaultCountry() { $this->assertEquals('US', $this->_helper->getDefaultCountry()); diff --git a/dev/tests/integration/testsuite/Magento/Core/Helper/HttpTest.php b/dev/tests/integration/testsuite/Magento/Core/Helper/HttpTest.php deleted file mode 100644 index 312bbd928e5220b9eee861c893125c06dd6b6003..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Helper/HttpTest.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Core\Helper; - -class HttpTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Helper\Http - */ - protected $_helper = null; - - protected function setUp() - { - $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Helper\Http'); - } - - public function testGetRemoteAddrHeaders() - { - $this->assertEquals(array(), $this->_helper->getRemoteAddrHeaders()); - } - - public function testGetRemoteAddr() - { - $this->assertEquals(false, $this->_helper->getRemoteAddr()); - } - - public function testGetServerAddr() - { - $this->assertEquals(false, $this->_helper->getServerAddr()); - } - - public function testGetHttpMethods() - { - $host = 'localhost'; - $this->assertEquals(false, $this->_helper->getHttpAcceptCharset()); - $this->assertEquals($host, $this->_helper->getHttpHost()); - $this->assertEquals(false, $this->_helper->getHttpReferer()); - $this->assertEquals(false, $this->_helper->getHttpAcceptLanguage()); - $this->assertEquals(false, $this->_helper->getHttpUserAgent()); - } - - public function testGetRequestUri() - { - $this->assertNull($this->_helper->getRequestUri()); - } - - public function testValidateIpAddr() - { - $this->assertTrue((bool)$this->_helper->validateIpAddr('127.0.0.1')); - $this->assertFalse((bool)$this->_helper->validateIpAddr('invalid')); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Helper/StringTest.php b/dev/tests/integration/testsuite/Magento/Core/Helper/StringTest.php deleted file mode 100644 index ef6f94f46c860b3ffb978831d37175e479b2916c..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Helper/StringTest.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Core\Helper; - -class StringTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Helper\String - */ - protected $_helper; - - protected function setUp() - { - $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Helper\String'); - } - - /** - * @covers \Magento\Core\Helper\String::truncate - * @covers \Magento\Core\Helper\String::strlen - * @covers \Magento\Core\Helper\String::substr - */ - public function testTruncate() - { - $string = '1234567890'; - $this->assertEquals('12...', $this->_helper->truncate($string, 5)); - - $words = '123 456 789'; - $remainder = ''; - $this->assertEquals('123...', $this->_helper->truncate($words, 8, '...', $remainder, false)); - } - - /** - * @covers \Magento\Core\Helper\String::splitInjection - * @covers \Magento\Core\Helper\String::strrev - */ - public function testSplitInjection() - { - $string = '1234567890'; - $this->assertEquals('1234 5678 90', $this->_helper->splitInjection($string, 4)); - } - - public function testStrSplit() - { - $this->assertEquals(array(), $this->_helper->strSplit('')); - $this->assertEquals(array('1', '2', '3', '4'), $this->_helper->strSplit('1234', 1)); - $this->assertEquals(array('1', '2', ' ', '3', '4'), $this->_helper->strSplit('12 34', 1, false, true)); - $this->assertEquals(array( - '12345', '123', '12345', '6789' - ), $this->_helper->strSplit('12345 123 123456789', 5, true, true)); - } - - /** - * Bug: $maxWordLength parameter has a misleading name. It limits qty of words in the result. - */ - public function testSplitWords() - { - $words = '123 123 45 789'; - $this->assertEquals(array('123', '123', '45'), $this->_helper->splitWords($words, false, 3)); - $this->assertEquals(array('123', '45'), $this->_helper->splitWords($words, true, 2)); - } - - public function testCleanString() - { - $string = '12345'; - $this->assertEquals($string, $this->_helper->cleanString($string)); - } - - public function testStrpos() - { - $this->assertEquals(1, $this->_helper->strpos('123', 2)); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php index 83b11e714320287232ec9ca15b4d3cc9628c6af1..41ad8075daec8096895a02289ff83a325b1679ed 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php @@ -42,6 +42,7 @@ class AreaTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); /** @var $_model \Magento\Core\Model\App\Area */ $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\App\Area', array('areaCode' => 'frontend')); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php index b2058b098ced1917fa47c265a7afccf3ab64268a..0b01389c52ebd7511f97cb51e8e6b72fbc799733 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php @@ -42,16 +42,17 @@ class EmulationTest extends \PHPUnit_Framework_TestCase { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\App\Emulation'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->get('Magento\View\DesignInterface'); $initialEnvInfo = $this->_model->startEnvironmentEmulation(1); $initialDesign = $initialEnvInfo->getInitialDesign(); - $this->assertEquals(\Magento\Core\Model\App\Area::AREA_ADMINHTML, $initialDesign['area']); - $this->assertEquals(\Magento\Core\Model\App\Area::AREA_FRONTEND, $design->getArea()); + $this->assertEquals(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, $initialDesign['area']); + $this->assertEquals(\Magento\Core\Model\App\Area::AREA_FRONTEND, $design->getDesignTheme()->getData('area')); $this->_model->stopEnvironmentEmulation($initialEnvInfo); - $this->assertEquals(\Magento\Core\Model\App\Area::AREA_ADMINHTML, $design->getArea()); + $this->assertEquals(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, $design->getArea()); } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php index 79a25264228d9655884a9de995bdfed77b4f43a5..5990ba818aa4544bd8633213a1d56d06b05ab971 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php @@ -202,7 +202,7 @@ class AppTest extends \PHPUnit_Framework_TestCase public function testGetCacheInstance() { $cache = $this->_mageModel->getCacheInstance(); - $this->assertInstanceOf('Magento\Core\Model\CacheInterface', $cache); + $this->assertInstanceOf('Magento\App\CacheInterface', $cache); $this->assertSame($cache, $this->_mageModel->getCacheInstance()); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/ConfigTest.php deleted file mode 100644 index 9ebd892ee59a276d27374d8a17466f40dec1fad2..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/ConfigTest.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php -/** - * Integration test for \Magento\Core\Model\Config - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Core\Model; - -/** - * First part of \Magento\Core\Model\Config testing: - * - general behaviour is tested - * - * @see \Magento\Core\Model\ConfigFactoryTest - * - * @SuppressWarnings(PHPMD.ExcessivePublicCount) - */ -class ConfigTest extends \PHPUnit_Framework_TestCase -{ - protected function setUp() - { - /** @var \Magento\Core\Model\Cache\StateInterface $cacheState */ - $cacheState = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Cache\StateInterface'); - $cacheState->setEnabled('config', false); - } - - public function testSetNode() - { - $model = $this->_createModel(); - /* some existing node should be used */ - $model->setNode('default/node/with/value', 'test'); - $this->assertEquals('test', (string) $model->getNode('default/node/with/value')); - } - - public function testDetermineOmittedNamespace() - { - $model = $this->_createModel(); - $this->assertEquals('cms', $model->determineOmittedNamespace('cms')); - $this->assertEquals('Magento_Cms', $model->determineOmittedNamespace('cms', true)); - $this->assertEquals('', $model->determineOmittedNamespace('nonexistent')); - $this->assertEquals('', $model->determineOmittedNamespace('nonexistent', true)); - } - - public function testGetModuleDir() - { - $model = $this->_createModel(); - foreach (array('etc', 'sql', 'data', 'i18n') as $type) { - $dir = $model->getModuleDir($type, 'Magento_Core'); - $this->assertStringEndsWith($type, $dir); - $this->assertContains('Magento' . DIRECTORY_SEPARATOR . 'Core', $dir); - } - $this->assertTrue(is_dir($this->_createModel()->getModuleDir('etc', 'Magento_Core'))); - } - - public function testGetStoresConfigByPath() - { - $model = $this->_createModel(); - - // default - $baseUrl = $model->getStoresConfigByPath('web/unsecure/base_url'); - $this->assertArrayHasKey(0, $baseUrl); - $this->assertArrayHasKey(1, $baseUrl); - - // $allowValues - $baseUrl = $model->getStoresConfigByPath('web/unsecure/base_url', array(uniqid())); - $this->assertEquals(array(), $baseUrl); - - // store code - $baseUrl = $model->getStoresConfigByPath('web/unsecure/base_url', array(), 'code'); - $this->assertArrayHasKey('default', $baseUrl); - $this->assertArrayHasKey('admin', $baseUrl); - - // store name - $baseUrl = $model->getStoresConfigByPath('web/unsecure/base_url', array(), 'name'); - $this->assertArrayHasKey('Default Store View', $baseUrl); - $this->assertArrayHasKey('Admin', $baseUrl); - } - - /** - * Instantiate \Magento\Core\Model\Config and initialize (load configuration) if needed - * - * @param array $arguments - * @return \Magento\Core\Model\Config - */ - protected function _createModel(array $arguments = array()) - { - /** @var $model \Magento\Core\Model\Config */ - $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Config', $arguments); - return $model; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php index b263985bdf9dc55614bab184d00cb4d2d6b7874e..cd31dbc6ee6dc0e0bd9616e2cb6582cbc7405569 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php @@ -48,13 +48,13 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ); $moduleList = $objectManager->create( - 'Magento\App\ModuleList', + 'Magento\Module\ModuleList', array( 'reader' => $objectManager->create( - 'Magento\App\Module\Declaration\Reader\Filesystem', + 'Magento\Module\Declaration\Reader\Filesystem', array( 'fileResolver' => $objectManager->create( - 'Magento\App\Module\Declaration\FileResolver', + 'Magento\Module\Declaration\FileResolver', array( 'applicationDirs' => $dirs ) @@ -65,9 +65,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\Core\Model\Config\Modules\Reader $moduleReader */ + /** @var \Magento\Module\Dir\Reader $moduleReader */ $moduleReader = $objectManager->create( - 'Magento\Core\Model\Config\Modules\Reader', + 'Magento\Module\Dir\Reader', array( 'moduleList' => $moduleList ) diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php index 046516e0864397fb8f9cfd4cba1cb76bcd0acab1..698235d7d0a9d43e51c71ecdbc3973bb81c86b29 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php @@ -53,8 +53,8 @@ class LayoutTest extends \Magento\TestFramework\TestCase\AbstractController protected function _loadServiceCallsConfig() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Core\Model\Config\Modules\Reader $moduleReader */ - $moduleReader = $objectManager->create('Magento\Core\Model\Config\Modules\Reader'); + /** @var \Magento\Module\Dir\Reader $moduleReader */ + $moduleReader = $objectManager->create('Magento\Module\Dir\Reader'); $moduleReader->setModuleDir('Magento_Catalog', 'etc', __DIR__ . '/LayoutTest/Magento/Catalog/etc'); /** @var \Magento\Core\Model\DataService\Config\Reader\Factory $dsCfgReaderFactory */ diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php index 36ca0d661f28f921fbb5acb6ab9409ccf536e3ce..30ca12b56b1386448d2076230c4ab464f891267a 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php @@ -51,6 +51,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase */ public function testChangeDesign() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\View\DesignInterface'); $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() @@ -119,7 +120,9 @@ class DesignTest extends \PHPUnit_Framework_TestCase */ public function testLoadChangeCache() { - $date = \Magento\Date::now(true); + /** @var \Magento\Stdlib\DateTime $dateTime */ + $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('\Magento\Stdlib\DateTime'); + $date = $dateTime->now(true); $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Core\Model\StoreManagerInterface')->getAnyStoreView()->getId(); // fixture design_change diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Email/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Email/Template/FilterTest.php index e57a2e380f9904f8d5250df126bc25d46f356018..cbd600c1de59cc5a532c3c8ca92f3e3188233621 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Email/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Email/Template/FilterTest.php @@ -42,6 +42,8 @@ class FilterTest extends \PHPUnit_Framework_TestCase /** * Isolation level has been raised in order to flush themes configuration in-memory cache + * + * @magentoAppArea frontend */ public function testViewDirective() { @@ -109,10 +111,14 @@ class FilterTest extends \PHPUnit_Framework_TestCase public function testLayoutDirective($area, $directiveParams, $expectedOutput) { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::THEMES => dirname(__DIR__) . '/_files/design' ) )); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Core\Model\Email\Template\Filter'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea($area); $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Resource\Theme\Collection'); @@ -127,7 +133,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase $objectManager->addSharedInstance($design, 'Magento\Core\Model\View\Design'); /** @var $layout \Magento\View\LayoutInterface */ - $layout = $objectManager->create('Magento\Core\Model\Layout', array('area' => $area)); + $layout = $objectManager->create('Magento\Core\Model\Layout'); $objectManager->addSharedInstance($layout, 'Magento\Core\Model\Layout'); $this->assertEquals($area, $layout->getArea()); $this->assertEquals( diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Email/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Email/TemplateTest.php index 2acf244ac57608247cf1a37c2276643770223c7b..d395696d08d2d57d971c0fe7df05ebf1322e29f9 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Email/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Email/TemplateTest.php @@ -63,6 +63,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Core\Model\Email\Template\Config'), )) ->getMock(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $this->_model->expects($this->any())->method('_getMail')->will($this->returnCallback(array($this, 'getMail'))); $this->_model->setSenderName('sender')->setSenderEmail('sender@example.com')->setTemplateSubject('Subject'); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Email/_files/themes.php b/dev/tests/integration/testsuite/Magento/Core/Model/Email/_files/themes.php index d251e714e90bc4e864d7d9d14abd932e1666e435..2d64c840203a5d16b810cda57712d235355558b7 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Email/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Email/_files/themes.php @@ -22,7 +22,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadAreaPart(\Magento\Core\Model\App\Area::AREA_ADMINHTML, \Magento\Core\Model\App\Area::PART_CONFIG); + ->loadAreaPart( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + \Magento\Core\Model\App\Area::PART_CONFIG + ); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( + 'preferences' => array( + 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' + ) +)); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Registration'); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/EntryPoint/HttpTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/EntryPoint/HttpTest.php deleted file mode 100644 index 6e379234c0326aa83e6ce5ad59669b8d8fe9b3e2..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/EntryPoint/HttpTest.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\EntryPoint; - -class HttpTest extends \PHPUnit_Framework_TestCase -{ - /** - * @magentoAppIsolation enabled - */ - public function testProcessRequestBootstrapException() - { - if (!\Magento\TestFramework\Helper\Bootstrap::canTestHeaders()) { - $this->markTestSkipped('Can\'t test entry point response without sending headers'); - } - - $config = $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false); - $objectManager = $this->getMock('Magento\ObjectManager'); - $objectManager->expects($this->any()) - ->method('get') - ->will($this->throwException(new \Magento\BootstrapException('exception_message'))); - - $config = $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false); - - - /** @var \Magento\Core\Model\EntryPoint\Http $model */ - $model = new \Magento\Core\Model\EntryPoint\Http($config, $objectManager); - ob_start(); - $model->processRequest(); - $content = ob_get_clean(); - - $headers = xdebug_get_headers(); - $this->assertContains('Content-Type: text/plain', $headers); - $this->assertEquals('exception_message', $content, 'The response must contain exception message, and only it'); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/ReaderTest.php index d5fb8fa0347d9534805c0e5a496a3e2868e15f4a..4aa04730111a1741a93abe38de2cfd1955ec03d0 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Fieldset/Config/ReaderTest.php @@ -49,31 +49,31 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\App\Module\Declaration\FileResolver $modulesDeclarations */ + /** @var \Magento\Module\Declaration\FileResolver $modulesDeclarations */ $modulesDeclarations = $objectManager->create( - 'Magento\App\Module\Declaration\FileResolver', array( + 'Magento\Module\Declaration\FileResolver', array( 'applicationDirs' => $dirs, ) ); - /** @var \Magento\App\Module\Declaration\Reader\Filesystem $filesystemReader */ + /** @var \Magento\Module\Declaration\Reader\Filesystem $filesystemReader */ $filesystemReader = $objectManager->create( - 'Magento\App\Module\Declaration\Reader\Filesystem', array( + 'Magento\Module\Declaration\Reader\Filesystem', array( 'fileResolver' => $modulesDeclarations, ) ); - /** @var \Magento\App\ModuleList $modulesList */ + /** @var \Magento\Module\ModuleList $modulesList */ $modulesList = $objectManager->create( - 'Magento\App\ModuleList', array( + 'Magento\Module\ModuleList', array( 'reader' => $filesystemReader, ) ); - /** @var \Magento\Core\Model\Config\Modules\Reader $moduleReader */ + /** @var \Magento\Module\Dir\Reader $moduleReader */ $moduleReader = $objectManager->create( - 'Magento\Core\Model\Config\Modules\Reader', array( + 'Magento\Module\Dir\Reader', array( 'moduleList' => $modulesList ) ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php index 6e518d9a7886936b66cc4ac5c408912cb5b4bd11..35bd88830c18acfd1ff5117641457cd64671eee4 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php @@ -53,15 +53,19 @@ class LayoutTest extends \PHPUnit_Framework_TestCase */ public function testConstructor(array $inputArguments, $expectedArea) { + if (isset($inputArguments['area'])) { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode($inputArguments['area']); + } $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Layout', $inputArguments); + ->create('Magento\Core\Model\Layout'); $this->assertEquals($expectedArea, $layout->getArea()); } public function constructorDataProvider() { return array( - 'default area' => array(array(), \Magento\View\DesignInterface::DEFAULT_AREA), + 'default area' => array(array(), null), 'frontend area' => array(array('area' => 'frontend'), 'frontend'), 'backend area' => array(array('area' => 'adminhtml'), 'adminhtml'), ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/LocaleTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/LocaleTest.php index 4b4471778a9a2b6b23353050e576c1d5c2992651..889573dd771f62490743f261ff693bcc2c3c60f8 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/LocaleTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/LocaleTest.php @@ -31,7 +31,7 @@ class LocaleTest extends \PHPUnit_Framework_TestCase { public function testGetLocale() { - $objectManager = \Magento\Core\Model\ObjectManager::getInstance(); + $objectManager = \Magento\App\ObjectManager::getInstance(); \Zend_Locale_Data::removeCache(); $this->assertNull(\Zend_Locale_Data::getCache()); $model = $objectManager->create('Magento\Core\Model\Locale', array('locale' => 'some_locale')); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Page/Asset/MergedTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Page/Asset/MergedTest.php index ac5cb3c194493972dde2a060834d3e963be985c1..823044611bfd5db78e97ca1390116c45fcfdde99 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Page/Asset/MergedTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Page/Asset/MergedTest.php @@ -59,10 +59,11 @@ class MergedTest extends \PHPUnit_Framework_TestCase protected function setUp() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::THEMES => realpath(__DIR__ . '/../../_files/design') ) )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') ->setDesignTheme('vendor_default'); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/CacheTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/CacheTest.php index 8facb40218fbc62bf1e0b001c8d891c1f698843e..32fc044111f33a9786b70887fffb47eed0da8c2b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/CacheTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/CacheTest.php @@ -49,7 +49,7 @@ class CacheTest extends \PHPUnit_Framework_TestCase public function testGetTable() { $this->_resourceMock = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource', array('tablePrefix' => 'prefix_') + 'Magento\App\Resource', array('tablePrefix' => 'prefix_') ); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php index df0c27ffa93249a3f7bdca30b5e13cf47ea5afb3..50efae98107c76ca084df02d5273d5791a2a7581 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php @@ -36,7 +36,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Resource'); + $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Resource'); $this->_model = $this->getMockForAbstractClass('Magento\Core\Model\Resource\Db\AbstractDb', array('resource' => $resource) ); @@ -47,7 +47,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $resourceProperty = new \ReflectionProperty(get_class($this->_model), '_resources'); $resourceProperty->setAccessible(true); - $this->assertInstanceOf('Magento\Core\Model\Resource', $resourceProperty->getValue($this->_model)); + $this->assertInstanceOf('Magento\App\Resource', $resourceProperty->getValue($this->_model)); } public function testSetMainTable() @@ -72,7 +72,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $tableNameOrig = 'core_website'; $tableSuffix = 'suffix'; $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource', array('tablePrefix' => 'prefix_') + 'Magento\App\Resource', array('tablePrefix' => 'prefix_') ); $model = $this->getMockForAbstractClass('Magento\Core\Model\Resource\Db\AbstractDb', diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/Collection/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/Collection/AbstractTest.php index 45bf587ab517b6791ef06585af2773e64a7e7307..413d20ff1a14d6fa8adfe8bc0fb1226c273effc5 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/Collection/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/Collection/AbstractTest.php @@ -34,7 +34,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase protected function setUp() { $resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Resource'); + ->get('Magento\App\Resource'); $resource = $this->getMockForAbstractClass('Magento\Core\Model\Resource\Db\AbstractDb', array($resourceModel), '', true, true, true, array('getMainTable', 'getIdFieldName') ); @@ -54,7 +54,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $entityFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Core\Model\EntityFactory'); $logger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Logger'); + ->get('Magento\Logger'); $this->_model = $this->getMockForAbstractClass( 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/ProfilerTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/ProfilerTest.php index 4f298b603cf090435ec6470f1cab5e2c76d71a53..0839db2fc68171cdcb7c401708145203fcc9336d 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/ProfilerTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/ProfilerTest.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Db; class ProfilerTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_model; @@ -52,7 +52,7 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Resource'); + ->create('Magento\App\Resource'); } /** @@ -61,7 +61,7 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase protected function _getConnectionRead() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $localConfig = $objectManager->get('Magento\Core\Model\Config\Local'); + $localConfig = $objectManager->get('Magento\App\Config'); $connectionConfig = $localConfig->getConnection('default'); $connectionConfig['profiler'] = array( 'class' => 'Magento\Core\Model\Resource\Db\Profiler', @@ -85,8 +85,8 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase { $connection = $this->_getConnectionRead(); - /** @var \Magento\Core\Model\Resource $resource */ - $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Resource'); + /** @var \Magento\App\Resource $resource */ + $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Resource'); $testTableName = $resource->getTableName('core_resource'); $selectQuery = sprintf($selectQuery, $testTableName); @@ -142,8 +142,8 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase $this->fail("Expected exception didn't thrown!"); } - /** @var \Magento\Core\Model\Resource $resource */ - $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Resource'); + /** @var \Magento\App\Resource $resource */ + $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Resource'); $testTableName = $resource->getTableName('core_resource'); $connection->query('SELECT * FROM ' . $testTableName); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SessionTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SessionTest.php index 196e8f661535cf132312a290c83d0ee41ed21e59..0f7e4c17b41b528f0be069749eb85fe79782f65a 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SessionTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SessionTest.php @@ -97,8 +97,8 @@ class SessionTest extends \PHPUnit_Framework_TestCase $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->_model = $this->_objectManager->get('Magento\Core\Model\Resource\Session'); - /** @var $resource \Magento\Core\Model\Resource */ - $resource = $this->_objectManager->get('Magento\Core\Model\Resource'); + /** @var $resource \Magento\App\Resource */ + $resource = $this->_objectManager->get('Magento\App\Resource'); $this->_connection = $resource->getConnection('core_write'); $this->_sessionTable = $resource->getTableName('core_session'); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SetupTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SetupTest.php index 212d4cfcba02d3b56727ea1c8d78e9c9e94d8168..0a6e7b683d0714d1d9d908b77e7cb3a21237088b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SetupTest.php @@ -58,8 +58,8 @@ class SetupTest extends \PHPUnit_Framework_TestCase $this->_model->deleteTableRow('core_resource', 'code', 'adminnotification_setup'); $this->_model->getConnection()->dropTable($this->_model->getTable('adminnotification_inbox')); $this->_model->getConnection()->dropTable($this->_model->getTable('admin_system_messages')); - /** @var $updater \Magento\App\Updater */ - $updater = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Updater'); + /** @var $updater \Magento\Module\Updater */ + $updater = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Module\Updater'); try { $updater->updateScheme(); $updater->updateData(); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Theme/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Theme/CollectionTest.php index b97204f9297431c2c712333b332be2f2aefd8c6d..5b739d3f283f35647935c02b716d0a9cc0ebe2f5 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Theme/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Theme/CollectionTest.php @@ -29,6 +29,15 @@ namespace Magento\Core\Model\Resource\Theme; class CollectionTest extends \PHPUnit_Framework_TestCase { + public static function setUpBeforeClass() + { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( + 'preferences' => array( + 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' + ) + )); + } + /** * @return \Magento\Core\Model\Resource\Theme\Collection */ diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/ResourceTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/ResourceTest.php index 44cd3684f9e23346e3f9e683a10192d7f31d081d..73f2644877ea28e407f4e71e6134c8676541e6f6 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/ResourceTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/ResourceTest.php @@ -28,14 +28,14 @@ namespace Magento\Core\Model; class ResourceTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_model; protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Resource'); + ->create('Magento\App\Resource'); } public function testGetTableName() @@ -45,7 +45,7 @@ class ResourceTest extends \PHPUnit_Framework_TestCase $tableNameOrig = 'core_website'; $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Resource', array('tablePrefix' => 'prefix_')); + ->create('Magento\App\Resource', array('tablePrefix' => 'prefix_')); $tableName = $this->_model->getTableName(array($tableNameOrig, $tableSuffix)); $this->assertContains($tablePrefix, $tableName); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/RouterListTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/RouterListTest.php deleted file mode 100644 index 9ec1794ff60ec5a507d412f776a70fe36f6a8d76..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/RouterListTest.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Core\Model; - -class RouterListTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\App\RouterList - */ - protected $_model; - - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_model = $this->_objectManager->create('Magento\App\RouterList'); - } - - public function testGetRouterByRoute() - { - $this->assertInstanceOf( - 'Magento\Core\Controller\Varien\Router\Base', - $this->_model->getRouterByRoute('') - ); - $this->assertInstanceOf( - 'Magento\Core\Controller\Varien\Router\Base', - $this->_model->getRouterByRoute('checkout') - ); - $this->assertInstanceOf( - 'Magento\App\Router\DefaultRouter', - $this->_model->getRouterByRoute('test') - ); - } - - public function testGetRouterByFrontName() - { - $this->assertInstanceOf( - 'Magento\Core\Controller\Varien\Router\Base', - $this->_model->getRouterByFrontName('') - ); - $this->assertInstanceOf( - 'Magento\Core\Controller\Varien\Router\Base', - $this->_model->getRouterByFrontName('checkout') - ); - $this->assertInstanceOf( - 'Magento\App\Router\DefaultRouter', - $this->_model->getRouterByFrontName('test') - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php index 59d6bd77c83f1413a4ff2351316b6183ee686bfc..5171812e565ba7eaafa100369d741bc86c4c565f 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php @@ -24,13 +24,11 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\Session\AbstractSession; /** - * Test class for \Magento\Core\Model\Session\AbstractSession\Varien - * + * Test class for \Magento\Core\Model\Session\AbstractSession */ -namespace Magento\Core\Model\Session\AbstractSession; - class VarienTest extends \PHPUnit_Framework_TestCase { /** @@ -41,25 +39,21 @@ class VarienTest extends \PHPUnit_Framework_TestCase public function testSessionSaveMethod($saveMethod, $iniValue) { $this->markTestIncomplete('Bug MAGE-5487'); - // depending on configuration some values cannot be set as default save session handlers. // in such cases warnings will be generated by php and test will fail $origErrorRep = error_reporting(E_ALL ^ E_WARNING); $origSessionHandler = ini_set('session.save_handler', $iniValue); - if ($iniValue && (ini_get('session.save_handler') != $iniValue)) { ini_set('session.save_handler', $origSessionHandler); error_reporting($origErrorRep); $this->markTestSkipped("Can't set '$iniValue' as session save handler"); } - ini_set('session.save_handler', $origSessionHandler); - /** @var $configModel \Magento\Core\Model\Config */ $configModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Config'); - $configModel->setNode(\Magento\Core\Model\Session\AbstractSession::XML_NODE_SESSION_SAVE, $saveMethod); + $configModel->setNode(\Magento\Core\Model\Session\AbstractSession::PARAM_SESSION_SAVE_METHOD, $saveMethod); /** - * @var \Magento\Core\Model\Session\AbstractSession\Varien + * @var \Magento\Core\Model\Session\AbstractSession $model */ $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Session\AbstractSession'); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Store/GroupTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Store/GroupTest.php index c6e3dae9e0ba2bf66563770db518c253bc933548..15ac7ee69ac9dc90eaf7f0941f30794cdc57f327 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Store/GroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Store/GroupTest.php @@ -24,9 +24,10 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Core\Model\Store; +use Magento\TestFramework\Helper\Bootstrap; + class GroupTest extends \PHPUnit_Framework_TestCase { /** @@ -36,17 +37,34 @@ class GroupTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + $this->_model = Bootstrap::getObjectManager() ->create('Magento\Core\Model\Store\Group'); } public function testSetGetWebsite() { $this->assertFalse($this->_model->getWebsite()); - $website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + $website = Bootstrap::getObjectManager() ->get('Magento\Core\Model\StoreManagerInterface')->getWebsite(); $this->_model->setWebsite($website); $actualResult = $this->_model->getWebsite(); $this->assertSame($website, $actualResult); } + + /** + * Tests that getWebsite returns the default site when defaults are passed in for id + */ + public function testGetWebsiteDefault() + { + $this->assertFalse($this->_model->getWebsite()); + $website = Bootstrap::getObjectManager() + ->get('Magento\Core\Model\StoreManagerInterface')->getWebsite(); + $this->_model->setWebsite($website); + // Empty string should get treated like no parameter + $actualResult = $this->_model->getWebsite(''); + $this->assertSame($website, $actualResult); + // Null string should get treated like no parameter + $actualResult = $this->_model->getWebsite(null); + $this->assertSame($website, $actualResult); + } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php index 67a77b2f975f8ce2357366a78ecaaacd99a8633c..455237b2ef01063f3434920db7a588e134505b1b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php @@ -198,7 +198,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase public function testGetBaseUrlInPub() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Core\Model\App::PARAM_APP_URIS => array(\Magento\App\Dir::PUB => '') + \Magento\App\Dir::PARAM_APP_URIS => array(\Magento\App\Dir::PUB => '') )); $this->_model = $this->_getStoreModel(); $this->_model->load('default'); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/CollectionTest.php index 1ce3c36f9d430186e9fb97dbe821307fe9e41498..a200c71c846850c8a763fe747361ca86152d90ee 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/CollectionTest.php @@ -97,6 +97,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase * * @magentoAppIsolation enabled * @covers \Magento\Core\Model\Theme\Collection::hasTheme + * @magentoAppArea install */ public function testHasThemeInCollection() { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineParserTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineParserTest.php index 6b08c71c25187ba442fd1c4ad623cb9ebde074b4..69e10432dbabef004ca7647f058ecaf5a14636bc 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineParserTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineParserTest.php @@ -76,7 +76,7 @@ class InlineParserTest extends \PHPUnit_Framework_TestCase $model->delete(); } catch (\Exception $e) { $model->delete(); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Logger') + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Logger') ->logException($e); } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineTest.php index b75084f8017ef87e5edb27154f6fd7ab95568eb6..bcbe27e1c9e636c2f455ee647c9e2248f6f41c5f 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineTest.php @@ -41,6 +41,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') ->setDesignTheme('magento_demo'); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/TranslateTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/TranslateTest.php index ef3713a3ed361585f2d98b7fb6b1f80975935452..7ce39fe88c10c7ce5f10ea1c471df346179eb8ba 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/TranslateTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/TranslateTest.php @@ -79,8 +79,8 @@ class TranslateTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->addSharedInstance($this->_viewFileSystem, 'Magento\Core\Model\View\FileSystem'); - /** @var $moduleReader \Magento\Core\Model\Config\Modules\Reader */ - $moduleReader = $objectManager->get('Magento\Core\Model\Config\Modules\Reader'); + /** @var $moduleReader \Magento\Module\Dir\Reader */ + $moduleReader = $objectManager->get('Magento\Module\Dir\Reader'); $moduleReader->setModuleDir('Magento_Core', 'i18n', __DIR__ . '/_files/Magento/Core/i18n'); $moduleReader->setModuleDir('Magento_Catalog', 'i18n', __DIR__ . '/_files/Magento/Catalog/i18n'); @@ -95,6 +95,7 @@ class TranslateTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Core\Model\Store\Config'), $objectManager->get('Magento\Core\Model\ThemeFactory'), $objectManager->get('Magento\Core\Model\App'), + $objectManager->get('Magento\App\State'), array('frontend' => 'test_default') ) ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/UrlTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/UrlTest.php index 800f96742a4d862b962abf04df92456d6129ca9c..a6cc866d7242ea7eed413d7cb7b193ca8b0f3726 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/UrlTest.php @@ -255,10 +255,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase $this->_model->setRoutePath('catalog/product/view'); $this->_model->setRouteParams(array('id' => 50)); $this->assertEquals('catalog/product/view/id/50/', $this->_model->getRoutePath()); - - $this->_model->setRoutePath('adminhtml/system_config/edit'); - $this->_model->setRouteParams(array('section' => 'design', 'key' => '123')); - $this->assertEquals('admin/system_config/edit/section/design/key/123/', $this->_model->getRoutePath()); } public function testSetGetRouteName() diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php index 0c5c7bd0608e21249910fb2e2d3dd46ddbd1a3b9..884060e9ffb9139797dbe8620689553ec4e8ca95 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php @@ -88,6 +88,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase ->create('Magento\View\ConfigInterface'); $this->_viewUrl = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\View\Url'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); } /** @@ -98,10 +99,12 @@ class DesignTest extends \PHPUnit_Framework_TestCase protected function _emulateFixtureTheme($themePath = 'test_default') { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::THEMES => realpath(__DIR__ . '/../_files/design'), ), )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea('frontend'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\View\DesignInterface') ->setDesignTheme($themePath); @@ -117,13 +120,14 @@ class DesignTest extends \PHPUnit_Framework_TestCase public function testSetGetArea() { $this->assertEquals(\Magento\View\DesignInterface::DEFAULT_AREA, $this->_model->getArea()); - $this->_model->setArea('test'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('test'); $this->assertEquals('test', $this->_model->getArea()); } public function testSetDesignTheme() { - $this->_model->setDesignTheme('test_test', 'test'); + $this->_model->setDesignTheme('test_test'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('test'); $this->assertEquals('test', $this->_model->getArea()); $this->assertEquals(null, $this->_model->getDesignTheme()->getThemePath()); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/View/FileSystemTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/View/FileSystemTest.php index 4c13b98f80d8ace1ad48f304d75f61ae7aab1d91..0603d9f4bf0bbd9fad0f7e7d2036dc8dd1343397 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/View/FileSystemTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/View/FileSystemTest.php @@ -41,10 +41,11 @@ class FileSystemTest extends \PHPUnit_Framework_TestCase protected function setUp() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::THEMES => dirname(__DIR__) . '/_files/design' ) )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\View\FileSystem'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/View/PublicationTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/View/PublicationTest.php index bc58ac9245e1454f83f50a35e61b74879139118a..d2931f4e29b4ea55378951bd1880f64ae2bc7077 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/View/PublicationTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/View/PublicationTest.php @@ -51,6 +51,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $this->_viewService = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\View\Service'); $this->_fileSystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() @@ -332,7 +333,7 @@ class PublicationTest extends \PHPUnit_Framework_TestCase $cssViewFile, $designParams, $expectedCssFile, $expectedCssContent, $expectedRelatedFiles ) { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->_viewUrl->getViewFileUrl($cssViewFile, $designParams); $expectedCssFile = $this->_viewService->getPublicDir() . '/' . $expectedCssFile; @@ -439,10 +440,11 @@ class PublicationTest extends \PHPUnit_Framework_TestCase { $appInstallDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir(); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::THEMES => "$appInstallDir/media_for_change", ) )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\View\DesignInterface'); @@ -529,10 +531,11 @@ class PublicationTest extends \PHPUnit_Framework_TestCase { $appInstallDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir(); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::THEMES => "$appInstallDir/media_for_change", ) )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\View\DesignInterface'); @@ -576,10 +579,11 @@ class PublicationTest extends \PHPUnit_Framework_TestCase protected function _initTestTheme($allowDuplication = null) { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::THEMES => dirname(__DIR__) . '/_files/design/' ) )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); if ($allowDuplication !== null) { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); @@ -612,12 +616,12 @@ class PublicationTest extends \PHPUnit_Framework_TestCase public function testCssWithBase64Data() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::THEMES => dirname(__DIR__) . '/_files/design/' ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadAreaPart( - \Magento\Core\Model\App\Area::AREA_ADMINHTML, + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \Magento\Core\Model\App\Area::PART_CONFIG ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php index 1387852abec73616a34ff469648eb2a785c1a89a..513f228949e0d16a9aa4944b3eab5eb28ef9d6af 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php @@ -25,7 +25,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadAreaPart(\Magento\Core\Model\App\Area::AREA_ADMINHTML, \Magento\Core\Model\App\Area::PART_CONFIG); + ->loadAreaPart( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + \Magento\Core\Model\App\Area::PART_CONFIG + ); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( + 'preferences' => array( + 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' + ) +)); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Registration'); diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php b/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php index 519a410cce0a7a028be817ff044a70c143bf5dde..e69deca32d5b49c660608774cc9beabda9442126 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php +++ b/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php @@ -96,7 +96,7 @@ class Layout return array( 'processorFactory' => $objectManager->get('Magento\View\Layout\ProcessorFactory'), 'themeFactory' => $objectManager->get('Magento\Core\Model\Resource\Theme\CollectionFactory'), - 'logger' => $objectManager->get('Magento\Core\Model\Logger'), + 'logger' => $objectManager->get('Magento\Logger'), 'eventManager' => $objectManager->get('Magento\Event\ManagerInterface'), 'factoryHelper' => $objectManager->get('Magento\Core\Model\Factory\Helper'), 'coreData' => $objectManager->get('Magento\Core\Helper\Data'), @@ -107,6 +107,7 @@ class Layout 'scheduledStructure' => $objectManager->create('Magento\Core\Model\Layout\ScheduledStructure', array()), 'dataServiceGraph' => $objectManager->create('Magento\Core\Model\DataService\Graph', array()), 'coreStoreConfig' => $objectManager->create('Magento\Core\Model\Store\Config'), + 'appState' => $objectManager->get('Magento\App\State'), ); } } diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php b/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php index 51391e9e347794c26749b8407a427461746259b3..f5f5f650c2dbe8eb8af9d4ce68ce401bc0bb3861 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php @@ -28,7 +28,7 @@ /** @var $objectManager \Magento\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Core\Model\App') - ->loadAreaPart(\Magento\Core\Model\App\Area::AREA_ADMINHTML, \Magento\Core\Model\App\Area::PART_CONFIG); + ->loadAreaPart(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \Magento\Core\Model\App\Area::PART_CONFIG); /** @var $theme \Magento\View\Design\ThemeInterface */ $theme = $objectManager->create('Magento\View\Design\ThemeInterface'); $theme->setThemePath('test/test') diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php b/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php index 852c67147438df8724e98178f6a25ec49a95e5d8..b405537b41f7f78c5c2f3b8d39b4974e8e4935f6 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php @@ -25,7 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadAreaPart(\Magento\Core\Model\App\Area::AREA_ADMINHTML, \Magento\Core\Model\App\Area::PART_CONFIG); + ->loadAreaPart( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + \Magento\Core\Model\App\Area::PART_CONFIG + ); $designDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() . '/media_for_change'; $themeDir = $designDir . DIRECTORY_SEPARATOR . 'frontend/test_default'; $sourcePath = dirname(__DIR__) . '/Model/_files/design/frontend/test_publication/'; diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Customer/Edit/Tab/View/AccordionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php similarity index 86% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Customer/Edit/Tab/View/AccordionTest.php rename to dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php index dbc7d19495cedb2715764ab65b9c4bd0b4fa9fed..3f2dc373a9114adb83a1b319690472ec7ad6770c 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Customer/Edit/Tab/View/AccordionTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Customer\Edit\Tab\View; +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; /** * @magentoAppArea adminhtml @@ -33,7 +33,7 @@ namespace Magento\Adminhtml\Block\Customer\Edit\Tab\View; class AccordionTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Adminhtml\Block\Customer\Edit\Tab\View\Accordion + * @var \Magento\Customer\Block\Adminhtml\Edit\Tab\View\Accordion */ protected $_block; @@ -50,9 +50,9 @@ class AccordionTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\View\LayoutInterface */ $layout = $objectManager->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); - $this->_block = $layout->createBlock('Magento\Adminhtml\Block\Customer\Edit\Tab\View\Accordion'); + $this->_block = $layout->createBlock('Magento\Customer\Block\Adminhtml\Edit\Tab\View\Accordion'); } /** diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Customer/OnlineTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/OnlineTest.php similarity index 83% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Customer/OnlineTest.php rename to dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/OnlineTest.php index 7073646abc1d0d7c523180b7f7f2a3457299705c..71814e2f6603463a1570bc090fbfdd88a110c35d 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Customer/OnlineTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/OnlineTest.php @@ -26,7 +26,7 @@ */ -namespace Magento\Adminhtml\Block\Customer; +namespace Magento\Customer\Block\Adminhtml; /** * @magentoAppArea adminhtml @@ -41,10 +41,10 @@ class OnlineTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', - array('area' => \Magento\Core\Model\App\Area::AREA_ADMINHTML) + array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); - /** @var $block \Magento\Adminhtml\Block\Customer\Online */ - $block = $layout->createBlock('Magento\Adminhtml\Block\Customer\Online', 'block'); + /** @var $block \Magento\Customer\Block\Adminhtml\Online */ + $block = $layout->createBlock('Magento\Customer\Block\Adminhtml\Online', 'block'); $this->assertNotEmpty($block->getFilterFormHtml()); } } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php index 5023add4a8a955a41f997dc37fc884432a2769c1..402423f54349b2d0d06754ed861eb5ee4828d20c 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php @@ -34,7 +34,7 @@ class AccountTest extends \Magento\TestFramework\TestCase\AbstractController */ public function testIndexAction() { - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Customer\Model\Session', array($logger)); $session->login('customer@example.com', 'password'); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Controller/Customer/GroupTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php similarity index 90% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Controller/Customer/GroupTest.php rename to dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php index 141ca388ae8ded735203d03a4c8ea816de17aa33..a5c92a8a4c23bfa51794774dd5fb6ee73f0fbce8 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Controller/Customer/GroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php @@ -19,14 +19,14 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller\Customer; +namespace Magento\Customer\Controller\Adminhtml; /** * @magentoAppArea adminhtml @@ -53,7 +53,7 @@ class GroupTest extends \Magento\Backend\Utility\Controller public function testNewAction() { - $this->dispatch('backend/admin/customer_group/new'); + $this->dispatch('backend/customer/group/new'); $responseBody = $this->getResponse()->getBody(); $this->assertRegExp('/<h1 class\="title">\s*New Customer Group\s*<\/h1>/', $responseBody); } @@ -61,7 +61,7 @@ class GroupTest extends \Magento\Backend\Utility\Controller public function testDeleteActionExistingGroup() { $this->getRequest()->setParam('id', self::$_customerGroupId); - $this->dispatch('backend/admin/customer_group/delete'); + $this->dispatch('backend/customer/group/delete'); /** * Check that success message is set @@ -74,7 +74,7 @@ class GroupTest extends \Magento\Backend\Utility\Controller public function testDeleteActionNonExistingGroupId() { $this->getRequest()->setParam('id', 10000); - $this->dispatch('backend/admin/customer_group/delete'); + $this->dispatch('backend/customer/group/delete'); /** * Check that error message is set diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Controller/CustomerTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php similarity index 91% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Controller/CustomerTest.php rename to dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 7e5c7b4d15ae6ee5947caae9b17ae05503933ae7..f4854cbfc59b47050023e4123effab781406be11 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Controller/CustomerTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -19,18 +19,18 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Customer * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller; +namespace Magento\Customer\Controller\Adminhtml; /** * @magentoAppArea adminhtml */ -class CustomerTest extends \Magento\Backend\Utility\Controller +class IndexTest extends \Magento\Backend\Utility\Controller { /** * Base controller URL @@ -42,7 +42,7 @@ class CustomerTest extends \Magento\Backend\Utility\Controller protected function setUp() { parent::setUp(); - $this->_baseControllerUrl = 'http://localhost/index.php/backend/admin/customer/'; + $this->_baseControllerUrl = 'http://localhost/index.php/backend/customer/index/'; } protected function tearDown() @@ -64,7 +64,7 @@ class CustomerTest extends \Magento\Backend\Utility\Controller public function testSaveActionWithEmptyPostData() { $this->getRequest()->setPost(array()); - $this->dispatch('backend/admin/customer/save'); + $this->dispatch('backend/customer/index/save'); $this->assertRedirect($this->stringStartsWith($this->_baseControllerUrl)); } @@ -77,7 +77,7 @@ class CustomerTest extends \Magento\Backend\Utility\Controller ) ); $this->getRequest()->setPost($post); - $this->dispatch('backend/admin/customer/save'); + $this->dispatch('backend/customer/index/save'); /** * Check that errors was generated and set to session */ @@ -107,7 +107,7 @@ class CustomerTest extends \Magento\Backend\Utility\Controller 'address' => array('_item1' => array()), ); $this->getRequest()->setPost($post); - $this->dispatch('backend/admin/customer/save'); + $this->dispatch('backend/customer/index/save'); /** * Check that errors was generated and set to session */ @@ -125,6 +125,9 @@ class CustomerTest extends \Magento\Backend\Utility\Controller */ public function testSaveActionWithValidCustomerDataAndValidAddressData() { + /** @var $objectManager \Magento\TestFramework\ObjectManager */ + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $post = array( 'account' => array( 'middlename' => 'test middlename', @@ -150,7 +153,7 @@ class CustomerTest extends \Magento\Backend\Utility\Controller ); $this->getRequest()->setPost($post); $this->getRequest()->setParam('back', '1'); - $this->dispatch('backend/admin/customer/save'); + $this->dispatch('backend/customer/index/save'); /** * Check that errors was generated and set to session */ @@ -158,21 +161,18 @@ class CustomerTest extends \Magento\Backend\Utility\Controller /** * Check that customer data were set to session */ - $this->assertEmpty(\Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Backend\Model\Session')->getCustomerData()); + $this->assertEmpty($objectManager->get('Magento\Backend\Model\Session')->getCustomerData()); /** * Check that success message is set */ $this->assertSessionMessages($this->logicalNot($this->isEmpty()), \Magento\Core\Model\Message::SUCCESS); - /** @var $objectManager \Magento\TestFramework\ObjectManager */ - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** * Check that customer id set and addresses saved */ - $customer = $objectManager->get('Magento\Core\Model\Registry')->registry('current_customer'); + $registry = $objectManager->get('Magento\Core\Model\Registry'); + $customer = $registry->registry('current_customer'); $this->assertInstanceOf('Magento\Customer\Model\Customer', $customer); $this->assertCount(1, $customer->getAddressesCollection()); @@ -182,7 +182,7 @@ class CustomerTest extends \Magento\Backend\Utility\Controller } /** - * @magentoDataFixture Magento/Adminhtml/controllers/_files/customer_sample.php + * @magentoDataFixture Magento/Customer/_files/customer_sample.php */ public function testSaveActionExistingCustomerAndExistingAddressData() { @@ -233,7 +233,7 @@ class CustomerTest extends \Magento\Backend\Utility\Controller ); $this->getRequest()->setPost($post); $this->getRequest()->setParam('customer_id', 1); - $this->dispatch('backend/admin/customer/save'); + $this->dispatch('backend/customer/index/save'); /** * Check that success message is set */ @@ -273,7 +273,7 @@ class CustomerTest extends \Magento\Backend\Utility\Controller } /** - * @magentoDataFixture Magento/Adminhtml/controllers/_files/customer_sample.php + * @magentoDataFixture Magento/Customer/_files/customer_sample.php */ public function testSaveActionCoreException() { @@ -289,7 +289,7 @@ class CustomerTest extends \Magento\Backend\Utility\Controller ), ); $this->getRequest()->setPost($post); - $this->dispatch('backend/admin/customer/save'); + $this->dispatch('backend/customer/index/save'); /* * Check that error message is set */ diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/CustomerTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/CustomerTest.php index 34ad993945c4aec17c76b19720dbb980d09b059f..45d52fdca37a40d6e0619b9945cbbdfb2c2b1cb1 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Service/CustomerTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Service/CustomerTest.php @@ -52,6 +52,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->_customerFactory = $this->_objectManager->get('Magento\Customer\Model\CustomerFactory'); $this->_model = $this->_objectManager->create('Magento\Customer\Service\Customer'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); } protected function tearDown() @@ -77,6 +78,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase /** * @param array $customerData * @dataProvider createDataProvider + * @magentoAppArea adminhtml */ public function testCreate($customerData) { @@ -316,6 +318,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase * @param array $customerData * @magentoDataFixture Magento/Customer/_files/customer.php * @dataProvider updateDataProvider + * @magentoAppArea frontend */ public function testUpdate($customerData) { @@ -410,6 +413,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase /** * @magentoDataFixture Magento/Customer/_files/customer.php + * @appAreaCode adminhtml */ public function testAutoGeneratePassword() { diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/controllers/_files/customer_sample.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_sample.php similarity index 100% rename from dev/tests/integration/testsuite/Magento/Adminhtml/controllers/_files/customer_sample.php rename to dev/tests/integration/testsuite/Magento/Customer/_files/customer_sample.php diff --git a/dev/tests/integration/testsuite/Magento/DB/Adapter/Pdo/MysqlTest.php b/dev/tests/integration/testsuite/Magento/DB/Adapter/Pdo/MysqlTest.php index f87ca58475a5077b1822a50dddf38a0c46cfb5ca..ae950660caaa97e787b55ebedb897d32ee1b7b86 100644 --- a/dev/tests/integration/testsuite/Magento/DB/Adapter/Pdo/MysqlTest.php +++ b/dev/tests/integration/testsuite/Magento/DB/Adapter/Pdo/MysqlTest.php @@ -128,9 +128,9 @@ class MysqlTest extends \PHPUnit_Framework_TestCase protected function _getDbAdapter() { if (is_null($this->_dbAdapter)) { - /** @var $coreResource \Magento\Core\Model\Resource */ + /** @var $coreResource \Magento\App\Resource */ $coreResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Resource'); + ->get('Magento\App\Resource'); $this->_dbAdapter = $coreResource->getConnection('default_setup'); } return $this->_dbAdapter; diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Config/QuickStylesTest.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Config/QuickStylesTest.php index 1bf4d156f9b0a0cf89b1d9ad0513b468e9df6813..1652de5449417e9bc5f57a3b29545f8d1fd97420 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Config/QuickStylesTest.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Config/QuickStylesTest.php @@ -51,7 +51,8 @@ class QuickStylesTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->_design = $objectManager->get('Magento\View\DesignInterface'); - $this->_design->setDesignTheme('vendor_test', \Magento\View\DesignInterface::DEFAULT_AREA); + $objectManager->get('Magento\App\State')->setAreaCode(\Magento\View\DesignInterface::DEFAULT_AREA); + $this->_design->setDesignTheme('vendor_test'); $this->_viewFileSystem = $objectManager->get('Magento\Core\Model\View\FileSystem'); $quickStylesPath = $this->_viewFileSystem->getFilename('Magento_DesignEditor::controls/quick_styles.xml'); $this->assertFileExists($quickStylesPath); diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Editor/Tools/Controls/ConfigurationTest.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Editor/Tools/Controls/ConfigurationTest.php index 2a4ed51970fe5f7b99e4153696849f977473d61d..33addaaf0b02b13056e288c494602f39862ab22e 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Editor/Tools/Controls/ConfigurationTest.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Editor/Tools/Controls/ConfigurationTest.php @@ -44,10 +44,12 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode(\Magento\View\DesignInterface::DEFAULT_AREA); $this->_design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\DesignInterface' ); - $this->_design->setDesignTheme('vendor_test_child', \Magento\View\DesignInterface::DEFAULT_AREA); + $this->_design->setDesignTheme('vendor_test_child'); $this->_configFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\DesignEditor\Model\Editor\Tools\Controls\Factory' ); diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineVdeTest.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineVdeTest.php index 87132cac92034fc614918d3dd5ee79f2568e1790..3328b98984b5867926d4af974383babbd379b7d5 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineVdeTest.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineVdeTest.php @@ -46,6 +46,7 @@ class InlineVdeTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') ->setDesignTheme('magento_demo'); } diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php index 0a0686507960cd947fe5d05a8bacda92de3f7a5a..5f3bdbf315ded509fe89e8a6db0d7bf601fade5b 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php @@ -26,13 +26,13 @@ */ \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Core\Model\App::PARAM_APP_DIRS => array( + \Magento\App\Dir::PARAM_APP_DIRS => array( \Magento\App\Dir::THEMES => dirname(__DIR__) . '/design' ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadAreaPart(\Magento\Core\Model\App\Area::AREA_ADMINHTML, \Magento\Core\Model\App\Area::PART_CONFIG); + ->loadAreaPart(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \Magento\Core\Model\App\Area::PART_CONFIG); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/_files/design_editor_active.php b/dev/tests/integration/testsuite/Magento/DesignEditor/_files/design_editor_active.php index 714aa8d020a163b80d39656662a61d15a42f4846..e70674f16bd92abe3a9c24b5747c4fa8fbc00747 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/_files/design_editor_active.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/_files/design_editor_active.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') - ->setCurrentScope(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\DesignEditor\Model\Session'); /** @var $auth \Magento\Backend\Model\Auth */ diff --git a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php index f119bfe1110e84679bbfe9229e12c8abeee741a3..78ad066cc7aabd9a8bf0772551a85b456c7fad49 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php @@ -41,8 +41,9 @@ class AbstractTest /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) ->setDefaultDesignTheme(); $entityType = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config') ->getEntityType('customer'); @@ -54,7 +55,7 @@ class AbstractTest 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Main\AbstractMain', array( $objectManager->get('Magento\Core\Model\Registry'), - $objectManager->get('Magento\Data\Form\Factory'), + $objectManager->get('Magento\Data\FormFactory'), $objectManager->get('Magento\Core\Helper\Data'), $objectManager->get('Magento\Backend\Block\Template\Context'), $objectManager->get('Magento\Eav\Helper\Data'), diff --git a/dev/tests/integration/testsuite/Magento/Encryption/ModelTest.php b/dev/tests/integration/testsuite/Magento/Encryption/ModelTest.php new file mode 100644 index 0000000000000000000000000000000000000000..6788e3426161ed452919d073b6fa30861b09286b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Encryption/ModelTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Core + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Encryption; + +class ModelTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Encryption\Encryptor + */ + protected $_model; + + protected function setUp() + { + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Encryption\Encryptor'); + } + + public function testEncryptDecrypt() + { + $encryptor = $this->_model; + + $this->assertEquals('', $encryptor->decrypt($encryptor->encrypt(''))); + $this->assertEquals('test', $encryptor->decrypt($encryptor->encrypt('test'))); + } + + public function testEncryptDecrypt2() + { + $encryptor = $this->_model; + + $initial = md5(uniqid()); + $encrypted = $encryptor->encrypt($initial); + $this->assertNotEquals($initial, $encrypted); + $this->assertEquals($initial, $encryptor->decrypt($encrypted)); + } + + public function testValidateKey() + { + $validKey = md5(uniqid()); + $this->assertInstanceOf('Magento\Encryption\Crypt', $this->_model->validateKey($validKey)); + } + + public function testGetValidateHash() + { + $password = uniqid(); + $hash = $this->_model->getHash($password); + + $this->assertTrue(is_string($hash)); + $this->assertTrue($this->_model->validateHash($password, $hash)); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Adapter/LocalTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Adapter/LocalTest.php index 3b164197e4245d428aec876a98de23ca0452521b..a7324cddcdb0e9b7e79198fb4ced60414e9ca118 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Adapter/LocalTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/Adapter/LocalTest.php @@ -37,7 +37,7 @@ class LocalTest extends \PHPUnit_Framework_TestCase $this->_adapter = new \Magento\Filesystem\Adapter\Local(); \Magento\Io\File::rmdirRecursive(self::_getTmpDir()); - mkdir(self::_getTmpDir()); + mkdir(self::_getTmpDir(), 0777, true); } protected function tearDown() diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php b/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php index 1d6530c3fc8f2a32e33b44d52c3110cd7f784c5d..05c8916b2280874cbb9abc7d12f391525cb42a06 100644 --- a/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php +++ b/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php @@ -46,7 +46,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase public function testThumbnail() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Product'); $product->load(1); diff --git a/dev/tests/integration/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php b/dev/tests/integration/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..6e7c2720136ee930d45a19e0158dcd4681b39f1c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php @@ -0,0 +1,63 @@ +<?php +/** + * Integration test for \Magento\GoogleAdwords\Model\Validator\Factory + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\GoogleAdwords\Model\Validator; + +use Magento\TestFramework\Helper\Bootstrap; + +class FactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test creation of conversion id validator + * + * @magentoAppIsolation enabled + */ + public function testGetConversionIdValidator() + { + $conversionId = '123'; + + $objectManager = Bootstrap::getObjectManager(); + $factory = $objectManager->get('Magento\GoogleAdwords\Model\Validator\Factory'); + + $validator = $factory->createConversionIdValidator($conversionId); + $this->assertNotNull($validator, "Conversion ID Validator"); + } + + /** + * Test creation of conversion color validator + * + * @magentoAppIsolation enabled + */ + public function testGetConversionColorValidator() + { + $conversionColor = "FFFFFF"; + + $objectManager = Bootstrap::getObjectManager(); + $factory = $objectManager->get('Magento\GoogleAdwords\Model\Validator\Factory'); + + $validator = $factory->createColorValidator($conversionColor); + $this->assertNotNull($validator); + } +} diff --git a/dev/tests/integration/testsuite/Magento/HTTP/HeaderTest.php b/dev/tests/integration/testsuite/Magento/HTTP/HeaderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..98ddeb8436a05ed4d5d6736707b48ad0e3f7ff24 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/HTTP/HeaderTest.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. + * + * @category Magento + * @package Magento_Core + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\HTTP; + +class HeaderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\HTTP\Header + */ + protected $_header; + + protected function setUp() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_header = $objectManager->get('Magento\HTTP\Header'); + + /** @var \Magento\TestFramework\Request $request */ + $request = $objectManager->get('Magento\TestFramework\Request'); + $request->setServer(array('HTTP_HOST' => 'localhost')); + } + + public function testGetHttpHeaderMethods() + { + $host = 'localhost'; + $this->assertEquals($host, $this->_header->getHttpHost()); + $this->assertEquals(false, $this->_header->getHttpUserAgent()); + $this->assertEquals(false, $this->_header->getHttpAcceptLanguage()); + $this->assertEquals(false, $this->_header->getHttpAcceptCharset()); + $this->assertEquals(false, $this->_header->getHttpReferer()); + } + + public function testGetRequestUri() + { + $this->assertNull($this->_header->getRequestUri()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/EncryptionTest.php b/dev/tests/integration/testsuite/Magento/HTTP/PhpEnvironment/RemoteAddressTest.php similarity index 67% rename from dev/tests/integration/testsuite/Magento/Core/Model/EncryptionTest.php rename to dev/tests/integration/testsuite/Magento/HTTP/PhpEnvironment/RemoteAddressTest.php index 5304d09b776dfeb7590798a53f90114811d47056..20afee09a4c6ca60d9fbeddab29352d3a96486e3 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/EncryptionTest.php +++ b/dev/tests/integration/testsuite/Magento/HTTP/PhpEnvironment/RemoteAddressTest.php @@ -25,24 +25,23 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\HTTP\PhpEnvironment; -class EncryptionTest extends \PHPUnit_Framework_TestCase +class RemoteAddressTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Encryption + * @var \Magento\HTTP\PhpEnvironment\RemoteAddress */ - protected $_model; + protected $_helper; protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Encryption'); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_helper = $objectManager->get('Magento\HTTP\PhpEnvironment\RemoteAddress'); } - public function testEncryptDecrypt() + public function testGetRemoteAddress() { - $this->assertEquals('', $this->_model->decrypt($this->_model->encrypt(''))); - $this->assertEquals('test', $this->_model->decrypt($this->_model->encrypt('test'))); + $this->assertEquals(false, $this->_helper->getRemoteAddress()); } } diff --git a/dev/tests/integration/testsuite/Magento/HTTP/PhpEnvironment/ServerAddressTest.php b/dev/tests/integration/testsuite/Magento/HTTP/PhpEnvironment/ServerAddressTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4e1abce7a3dd4deb978eb391efc855f28acb7043 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/HTTP/PhpEnvironment/ServerAddressTest.php @@ -0,0 +1,47 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Core + * @subpackage integration_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\HTTP\PhpEnvironment; + +class ServerAddressTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\HTTP\PhpEnvironment\ServerAddress + */ + protected $_helper; + + protected function setUp() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_helper = $objectManager->get('Magento\HTTP\PhpEnvironment\ServerAddress'); + } + + public function testGetServerAddress() + { + $this->assertEquals(false, $this->_helper->getServerAddress()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php index 7cfd5bf603a86f5b0d4521ebc57658c9cd6b0005..cedf81aed0bd80563578d21b63c82fb803a151d2 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php @@ -38,8 +38,9 @@ class FilterTest */ public function testGetDateFromToHtmlWithValue() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) ->setDefaultDesignTheme(); $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\ImportExport\Block\Adminhtml\Export\Filter'); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php index eaaba9f299d6a8f97a31e1f4a2e1a4be9990f20c..988ad6aaf1405e9b7fed28f362e719dbe7f41cb8 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php @@ -160,7 +160,7 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase public function testImportData($behavior, $sourceFile, array $dataBefore, array $dataAfter, array $errors = array()) { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); // set entity adapter parameters $this->_entityAdapter->setParameters(array('behavior' => $behavior)); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php index b7283a4a8333bcb291b046521d8ea3d65d25645f..d1bd0eba036a3cdd7360759aefffa741518d39ce 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php @@ -234,12 +234,15 @@ class AddressTest extends \PHPUnit_Framework_TestCase $addressId = $objectManager->get('Magento\Core\Model\Resource\HelperPool')->get('Magento_ImportExport') ->getNextAutoincrement($tableName); + /** @var \Magento\Stdlib\DateTime $dateTime */ + $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('\Magento\Stdlib\DateTime'); + $entityData = array( 'entity_id' => $addressId, 'entity_type_id' => $addressModel->getEntityTypeId(), 'parent_id' => $customerId, - 'created_at' => now(), - 'updated_at' => now() + 'created_at' => $dateTime->now(), + 'updated_at' => $dateTime->now() ); // invoke _saveAddressEntities diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php index 76e5f8eec88ca0d3d88dce12b6bea044a6b9857f..3ca0617ace80df9287ec367e9a7e1e59e94d6a4c 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php @@ -125,7 +125,7 @@ class CustomerImportTest extends \PHPUnit_Framework_TestCase public function testDeleteData() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $source = new \Magento\ImportExport\Model\Import\Source\Csv(__DIR__ . '/_files/customers_to_import.csv'); /** @var $customerCollection \Magento\Customer\Model\Resource\Customer\Collection */ diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php index 1d929147adab62563913b1e723a875835fdb4532..80813fd9ea245486cbbfe63e2f97a8fbc3b9f0f2 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php @@ -47,11 +47,11 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** @var $model \Magento\ImportExport\Model\Import\AbstractEntity|\PHPUnit_Framework_MockObject_MockObject */ $model = $this->getMockForAbstractClass('Magento\ImportExport\Model\Import\AbstractEntity', array( $objectManager->get('Magento\Core\Helper\Data'), - $objectManager->get('Magento\Core\Helper\String'), + $objectManager->get('Magento\Stdlib\String'), $objectManager->get('Magento\Core\Model\Store\Config'), $objectManager->get('Magento\ImportExport\Model\ImportFactory'), $objectManager->get('Magento\ImportExport\Model\Resource\Helper'), - $objectManager->get('Magento\Core\Model\Resource'), + $objectManager->get('Magento\App\Resource'), )); $model->expects($this->any()) ->method('validateRow') diff --git a/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php b/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php index dac49101f15b5685601b97e4092faa668cbf787f..e5bf3d49d569429ee0ec8a2866f2a27798d53a7e 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php @@ -42,9 +42,11 @@ class AdminTest extends \PHPUnit_Framework_TestCase $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Install\Model\Session'); $session->setAdminData(array_merge($preserve, $omit)); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('install'); + /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Layout', array('area' => 'install')); + ->create('Magento\Core\Model\Layout'); /** @var $block \Magento\Install\Block\Admin */ $block = $layout->createBlock('Magento\Install\Block\Admin'); $output = $block->toHtml(); diff --git a/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php b/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php index b700881041b72d152590b280504868f1a28067ce..6a1db025300b0f16491646e40a74f4fd2cb3a6dd 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php @@ -66,7 +66,7 @@ class WizardTest extends \Magento\TestFramework\TestCase\AbstractController $appState = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State'); $appState->setInstallDate(false); $this->dispatch('install/wizard'); - $this->assertEquals(200, $this->getResponse()->getHttpResponseCode()); + $this->assertEquals(302, $this->getResponse()->getHttpResponseCode()); $appState->setInstallDate(date('r', strtotime('now'))); } @@ -78,7 +78,7 @@ class WizardTest extends \Magento\TestFramework\TestCase\AbstractController public function testPreDispatchImpossibleToRenderPage($action) { $params = self::$_params; - $params[\Magento\Core\Model\App::PARAM_APP_DIRS][\Magento\App\Dir::STATIC_VIEW] = self::$_tmpDir; + $params[\Magento\App\Dir::PARAM_APP_DIRS][\Magento\App\Dir::STATIC_VIEW] = self::$_tmpDir; \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize($params); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( 'preferences' => array( diff --git a/dev/tests/integration/testsuite/Magento/Install/IndexTest.php b/dev/tests/integration/testsuite/Magento/Install/IndexTest.php deleted file mode 100644 index f5f3eb492c7ece3410cc921cf7fba77a73c2ee3c..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Install/IndexTest.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Install; - -class IndexTest extends \Magento\TestFramework\TestCase\AbstractController -{ - public function testIndexAction() - { - $this->dispatch('install/index/index'); - $request = $this->getRequest(); - $this->assertEquals('begin', $request->getActionName()); - $this->assertEquals('wizard', $request->getControllerName()); - $this->assertEquals('install', $request->getModuleName()); - /** - * Make sure that preDispatch() didn't cleanup var directory (by asserting presence of anything there), - * because in integration testing environment the application is considered "installed" - */ - $this->assertFileExists( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') - ->getDir(\Magento\App\Dir::TMP) - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php index c39ea4fc6e4732d6201be8c98d521905f671597d..5b7b47922050a998a1243cc21230e9a2b55dd5d2 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php @@ -64,31 +64,31 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\App\Module\Declaration\FileResolver $modulesDeclarations */ + /** @var \Magento\Module\Declaration\FileResolver $modulesDeclarations */ $modulesDeclarations = $this->_objectManager->create( - 'Magento\App\Module\Declaration\FileResolver', array( + 'Magento\Module\Declaration\FileResolver', array( 'applicationDirs' => $dirs, ) ); - /** @var \Magento\App\Module\Declaration\Reader\Filesystem $filesystemReader */ + /** @var \Magento\Module\Declaration\Reader\Filesystem $filesystemReader */ $filesystemReader = $this->_objectManager->create( - 'Magento\App\Module\Declaration\Reader\Filesystem', array( + 'Magento\Module\Declaration\Reader\Filesystem', array( 'fileResolver' => $modulesDeclarations, ) ); - /** @var \Magento\App\ModuleList $modulesList */ + /** @var \Magento\Module\ModuleList $modulesList */ $modulesList = $this->_objectManager->create( - 'Magento\App\ModuleList', array( + 'Magento\Module\ModuleList', array( 'reader' => $filesystemReader, ) ); - /** @var \Magento\Core\Model\Config\Modules\Reader $moduleReader */ + /** @var \Magento\Module\Dir\Reader $moduleReader */ $moduleReader = $this->_objectManager->create( - 'Magento\Core\Model\Config\Modules\Reader', array( + 'Magento\Module\Dir\Reader', array( 'moduleList' => $modulesList ) ); diff --git a/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php b/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b5d777e7660482d41480c3cde1538f32c541f83c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * + */ +namespace Magento\Integration\Controller\Adminhtml; + +/** + * \Magento\Integration\Controller\Adminhtml\Integration + * + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + */ +class IntegrationTest extends \Magento\Backend\Utility\Controller +{ + /** @var \Magento\Integration\Model\Integration */ + private $_integration; + + protected function setUp() + { + parent::setUp(); + $this->_createDummyIntegration(); + } + + public function testIndexAction() + { + $this->dispatch('backend/admin/integration/index'); + $response = $this->getResponse()->getBody(); + + $this->assertContains('Integrations', $response); + $this->assertSelectCount('#integrationGrid', 1, $response); + } + + public function testNewAction() + { + $this->dispatch('backend/admin/integration/new'); + $response = $this->getResponse()->getBody(); + + $this->assertEquals('new', $this->getRequest()->getActionName()); + $this->assertContains('entry-edit form-inline', $response); + $this->assertContains('New Integration', $response); + $this->assertSelectCount('#integration_properties_base_fieldset', 1, $response); + } + + public function testEditAction() + { + $integrationId = $this->_integration->getId(); + $this->getRequest()->setParam('id', $integrationId); + $this->dispatch('backend/admin/integration/edit'); + $response = $this->getResponse()->getBody(); + $saveLink = 'integration/save/'; + + $this->assertContains('entry-edit form-inline', $response); + $this->assertContains('Edit "'. $this->_integration->getName() .'" Integration', $response); + $this->assertContains($saveLink, $response); + $this->assertSelectCount('#integration_properties_base_fieldset', 1, $response); + $this->assertSelectCount('#integration_edit_tabs_info_section_content', 1, $response); + } + + public function testSaveActionUpdateIntegration() + { + $integrationId = $this->_integration->getId(); + $integrationName = $this->_integration->getName(); + $this->getRequest()->setParam('id', $integrationId); + $url = 'http://magento.ll/endpoint_url'; + $this->getRequest()->setPost(array( + 'name' => $integrationName, + 'email' => 'test@magento.com', + 'authentication' => '1', + 'endpoint' => $url + )); + $this->dispatch('backend/admin/integration/save'); + $this->assertSessionMessages( + $this->equalTo(array("The integration '$integrationName' has been saved.")), + \Magento\Core\Model\Message::SUCCESS + ); + $this->assertRedirect($this->stringContains('backend/admin/integration/index/')); + } + + public function testSaveActionNewIntegration() + { + $url = 'http://magento.ll/endpoint_url'; + $integrationName = md5(rand()); + $this->getRequest()->setPost(array( + 'name' => $integrationName, + 'email' => 'test@magento.com', + 'authentication' => '1', + 'endpoint' => $url + )); + $this->dispatch('backend/admin/integration/save'); + + $this->assertSessionMessages( + $this->equalTo(array("The integration '$integrationName' has been saved.")), + \Magento\Core\Model\Message::SUCCESS + ); + $this->assertRedirect($this->stringContains('backend/admin/integration/index/')); + } + + /** + * Creates a dummy integration for use in dispatched methods under testing + */ + private function _createDummyIntegration() + { + /** @var $factory \Magento\Integration\Model\Integration\Factory */ + $factory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Integration\Model\Integration\Factory'); + $this->_integration = $factory->create() + ->setName(md5(rand())) + ->save(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php index 6ad448fdd328b4323719990f24979c3b3f06bbae..60c4b332401f74bad00b89b5aad2a016e967a2b0 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php @@ -46,9 +46,9 @@ class QueueTest extends \PHPUnit_Framework_TestCase /** @var $appEmulation \Magento\Core\Model\App\Emulation */ $appEmulation = $objectManager->create('Magento\Core\Model\App\Emulation', array('viewDesign' => $design)); $objectManager->addSharedInstance($appEmulation, 'Magento\Core\Model\App\Emulation'); - /** @var $app \Magento\Core\Model\App */ + /** @var $app \Magento\TestFramework\App */ $app = $objectManager->get('Magento\Core\Model\App'); - $app->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + $app->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); /** @var $collection \Magento\Core\Model\Resource\Theme\Collection */ $collection = $objectManager->create('Magento\Core\Model\Resource\Theme\Collection'); @@ -110,7 +110,7 @@ class QueueTest extends \PHPUnit_Framework_TestCase public function testSendPerSubscriberProblem() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $mail = $this->getMock('Zend_Mail', array('send'), array('utf-8')); $brokenMail = $this->getMock('Zend_Mail', array('send'), array('utf-8')); $errorMsg = md5(microtime()); diff --git a/dev/tests/integration/testsuite/Magento/ObjectManager/Config/Reader/DomTest.php b/dev/tests/integration/testsuite/Magento/ObjectManager/Config/Reader/DomTest.php index ee3ff8a2bee7a157e872e2e06163d51bbdae4c9e..e8ca88b8a8377d6ef2cc9c90c4f35f11a49e9b2f 100644 --- a/dev/tests/integration/testsuite/Magento/ObjectManager/Config/Reader/DomTest.php +++ b/dev/tests/integration/testsuite/Magento/ObjectManager/Config/Reader/DomTest.php @@ -36,7 +36,7 @@ class DomTest extends \PHPUnit_Framework_TestCase protected $_fileList; /** - * @var \Magento\Core\Model\Config\FileResolver\Primary + * @var \Magento\App\Config\FileResolver\Primary */ protected $_fileResolverMock; @@ -46,7 +46,7 @@ class DomTest extends \PHPUnit_Framework_TestCase protected $_mergedConfig; /** - * @var \Magento\Core\Model\Config\ValidationState + * @var \Magento\App\Config\ValidationState */ protected $_validationState; @@ -69,12 +69,12 @@ class DomTest extends \PHPUnit_Framework_TestCase ); $this->_fileResolverMock = $this->getMock( - 'Magento\Core\Model\Config\FileResolver\Primary', array(), array(), '', false + 'Magento\App\Config\FileResolver\Primary', array(), array(), '', false ); $this->_fileResolverMock->expects($this->once())->method('get')->will($this->returnValue($this->_fileList)); $this->_mapper = new \Magento\ObjectManager\Config\Mapper\Dom(); $this->_validationState = - new \Magento\Core\Model\Config\ValidationState(\Magento\App\State::MODE_DEFAULT); + new \Magento\App\Config\ValidationState(\Magento\App\State::MODE_DEFAULT); $this->_schemaLocator = new \Magento\ObjectManager\Config\SchemaLocator(); $this->_mergedConfig = new \DOMDocument(); diff --git a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_merged.xml b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_merged.xml index 0377b4244812099dc9ec724568a3b9acc69eb60f..e681e4c652e965b86789e041c30b584588f2dc06 100644 --- a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_merged.xml +++ b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_merged.xml @@ -24,11 +24,11 @@ */ --> <config> - <preference for="Magento\App\UpdaterInterface" type="Magento\App\UpdaterOne" /> - <preference for="Magento\App\UpdaterInterfaceTwo" type="Magento\App\UpdaterTwo"/> - <type name="Magento\Core\Model\Config\Loader\Local" shared="false"> + <preference for="Magento\Module\UpdaterInterface" type="Magento\Module\UpdaterOne" /> + <preference for="Magento\Module\UpdaterInterfaceTwo" type="Magento\Module\UpdaterTwo"/> + <type name="Magento\App\Config\Loader" shared="false"> <param name="customFile"> - <value type="argument">Magento\Core\Model\App::PARAM_CUSTOM_LOCAL_CONFIG</value> + <value type="argument">Magento\App\Config\Loader::PARAM_CUSTOM_FILE</value> </param> <param name="customConfig"> <instance shared="false" type="Magento\Core\Model\Config\Storage_Modules" /> @@ -50,9 +50,9 @@ </param> <plugin name="three" type="somePluginThree"/> </type> - <virtualType name="Magento\Core\Model\Config\Loader\LocalVirtual" type="Magento\Core\Model\Config\Loader\Local" shared="true"> + <virtualType name="Magento\App\Config\LoaderVirtual" type="Magento\App\Config\Loader\Local" shared="true"> <param name="customFile"> - <value type="argument">Magento\Core\Model\App::PARAM_CUSTOM_LOCAL_FILE</value> + <value type="argument">Magento\App\Config\Loader::PARAM_CUSTOM_FILE</value> </param> <param name="customConfig"> <instance type="Magento\Core\Model\Config\Storage_Modules" /> diff --git a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_one.xml b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_one.xml index 708a9c97c82ddba06f8daa4311c598509e7b26b6..c3e77c2b6b2ad9fcc9c9838fe5a75b56f06539fb 100644 --- a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_one.xml +++ b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_one.xml @@ -24,10 +24,10 @@ */ --> <config> - <preference for="Magento\App\UpdaterInterface" type="Magento\App\Updater" /> - <type name="Magento\Core\Model\Config\Loader\Local"> + <preference for="Magento\Module\UpdaterInterface" type="Magento\Module\Updater" /> + <type name="Magento\App\Config\Loader"> <param name="customFile"> - <value type="argument">Magento\Core\Model\App::PARAM_CUSTOM_LOCAL_FILE</value> + <value type="argument">Magento\App\Config\Loader::PARAM_CUSTOM_FILE</value> </param> <param name="customConfig"> <instance shared="true" type="Magento\Core\Model\Config\Storage_Modules" /> @@ -44,9 +44,9 @@ <plugin name="one" type="somePluginOne"/> <plugin name="two" type="somePluginTwo" sortOrder="15"/> </type> - <virtualType name="Magento\Core\Model\Config\Loader\LocalVirtual" type="Magento\Core\Model\Config\Loader\Local" shared="false"> + <virtualType name="Magento\App\Config\LoaderVirtual" type="Magento\App\Config\Loader\Local" shared="false"> <param name="customFile"> - <value type="argument">Magento\Core\Model\App::PARAM_CUSTOM_LOCAL_FILE</value> + <value type="argument">Magento\App\Config\Loader::PARAM_CUSTOM_FILE</value> </param> <param name="customConfig"> <instance type="Magento\Core\Model\Config\Storage_Modules" /> diff --git a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_two.xml b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_two.xml index 8e794956d1c2d811b085ac210d6013adcb84f773..66d7c5a84c9f91b03019f1c0ed02f8e05b05d180 100644 --- a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_two.xml +++ b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_two.xml @@ -24,11 +24,11 @@ */ --> <config> - <preference for="Magento\App\UpdaterInterfaceTwo" type="Magento\App\UpdaterTwo" /> - <preference for="Magento\App\UpdaterInterface" type="Magento\App\UpdaterOne" /> - <type name="Magento\Core\Model\Config\Loader\Local" shared="false"> + <preference for="Magento\Module\UpdaterInterfaceTwo" type="Magento\Module\UpdaterTwo" /> + <preference for="Magento\Module\UpdaterInterface" type="Magento\Module\UpdaterOne" /> + <type name="Magento\App\Config\Loader" shared="false"> <param name="customFile"> - <value type="argument">Magento\Core\Model\App::PARAM_CUSTOM_LOCAL_CONFIG</value> + <value type="argument">Magento\App\Config\Loader::PARAM_CUSTOM_FILE</value> </param> <param name="newParam"> <value>paramValue</value> @@ -48,7 +48,7 @@ <plugin name="two" type="somePluginTwo" sortOrder="20" disabled="true"/> <plugin name="one" sortOrder="800"/> </type> - <virtualType name="Magento\Core\Model\Config\Loader\LocalVirtual" shared="true"> + <virtualType name="Magento\App\Config\LoaderVirtual" shared="true"> <plugin name="three" type="somePluginThree"/> <plugin name="two" type="somePluginTwo" sortOrder="20" disabled="true"/> <plugin name="one" sortOrder="800"/> diff --git a/dev/tests/integration/testsuite/Magento/Page/Block/Html/BreadcrumbsTest.php b/dev/tests/integration/testsuite/Magento/Page/Block/Html/BreadcrumbsTest.php index d23b11357974643e5bdccb562534297c78bef06c..b3dfb0adca039cfaf9d8bb79b3d09714a16cbc85 100644 --- a/dev/tests/integration/testsuite/Magento/Page/Block/Html/BreadcrumbsTest.php +++ b/dev/tests/integration/testsuite/Magento/Page/Block/Html/BreadcrumbsTest.php @@ -36,6 +36,7 @@ class BreadcrumbsTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') ->createBlock('Magento\Page\Block\Html\Breadcrumbs'); } diff --git a/dev/tests/integration/testsuite/Magento/Page/Block/Html/FooterTest.php b/dev/tests/integration/testsuite/Magento/Page/Block/Html/FooterTest.php index d382f849c85cbb9052b766842475459c6ce0ff6d..9ddbce109756ba53a14cfdd5493ea27f361ae388 100644 --- a/dev/tests/integration/testsuite/Magento/Page/Block/Html/FooterTest.php +++ b/dev/tests/integration/testsuite/Magento/Page/Block/Html/FooterTest.php @@ -36,6 +36,7 @@ class FooterTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\View\DesignInterface'); $this->_theme = $design->setDefaultDesignTheme()->getDesignTheme(); diff --git a/dev/tests/integration/testsuite/Magento/Page/Block/Html/HeadTest.php b/dev/tests/integration/testsuite/Magento/Page/Block/Html/HeadTest.php index 18f69ad3c0bd6306f9d409e36ea4de7dd16b43a0..073c9867e536418bb5f1dff893fb65c4db3eba88 100644 --- a/dev/tests/integration/testsuite/Magento/Page/Block/Html/HeadTest.php +++ b/dev/tests/integration/testsuite/Magento/Page/Block/Html/HeadTest.php @@ -36,8 +36,10 @@ class HeadTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode('frontend'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setDesignTheme('magento_demo', 'frontend'); + ->setDesignTheme('magento_demo'); $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') ->createBlock('Magento\Page\Block\Html\Head'); } diff --git a/dev/tests/integration/testsuite/Magento/Page/Block/HtmlTest.php b/dev/tests/integration/testsuite/Magento/Page/Block/HtmlTest.php index 34e9c70d4c7543d8e60c0afbf7cab3a92ee07d8c..a881908c4d96e45c6e23fd79324c6ff156d8a9e6 100644 --- a/dev/tests/integration/testsuite/Magento/Page/Block/HtmlTest.php +++ b/dev/tests/integration/testsuite/Magento/Page/Block/HtmlTest.php @@ -30,8 +30,8 @@ namespace Magento\Page\Block; class HtmlTest extends \PHPUnit_Framework_TestCase { /** - * * @dataProvider getConfigValuesDataProvider + * @magentoAppArea frontend */ public function testGetPrintLogoUrl($configData, $returnValue) { @@ -43,17 +43,19 @@ class HtmlTest extends \PHPUnit_Framework_TestCase ->will($this->returnValueMap($configData)); $securityInfoMock = $this->getMock('Magento\Core\Model\Url\SecurityInfoInterface'); - $urlHelperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); + $codeData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $urlBuilder = $this->getMock( 'Magento\Core\Model\Url', array('getBaseUrl'), array( + $this->getMock('Magento\App\Route\ConfigInterface'), + $this->getMock('Magento\App\Request\Http', array(), array(), '', false), $securityInfoMock, $storeConfig, - $urlHelperMock, $this->getMock('Magento\Core\Model\App', array(), array(), '', false), $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false), $this->getMock('Magento\Core\Model\Session', array(), array(), '', false), + null, array() ) ); @@ -73,7 +75,7 @@ class HtmlTest extends \PHPUnit_Framework_TestCase ->create('Magento\Page\Block\Html', array( 'storeManager' => $storeManager, 'locale' => $locale, - 'urlHelperMock' => $urlHelperMock, + 'urlHelperMock' => $codeData, 'context' => $context )); diff --git a/dev/tests/integration/testsuite/Magento/Payment/Block/Catalog/Product/View/ProfileTest.php b/dev/tests/integration/testsuite/Magento/Payment/Block/Catalog/Product/View/ProfileTest.php index a694aee270b489a4d45bee7287a1147890520aee..bc9520232486177a078f5796066d4e8b95672358 100644 --- a/dev/tests/integration/testsuite/Magento/Payment/Block/Catalog/Product/View/ProfileTest.php +++ b/dev/tests/integration/testsuite/Magento/Payment/Block/Catalog/Product/View/ProfileTest.php @@ -39,6 +39,7 @@ class ProfileTest extends \PHPUnit_Framework_TestCase { /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\App\State')->setAreaCode('frontend'); $product = $objectManager->create('Magento\Catalog\Model\Product'); $product->setIsRecurring('1'); diff --git a/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php b/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php index 8a12488037ba61f454f1f228c28d82f70a7e9120..5047bf920a93e44dc9b9c44ce2a3c069ac3a81cb 100644 --- a/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php +++ b/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php @@ -35,6 +35,8 @@ class InfoTest extends \PHPUnit_Framework_TestCase */ public function testGetChildPdfAsArray() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); $block = $layout->createBlock('Magento\Payment\Block\Info', 'block'); @@ -46,8 +48,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase ->create('Magento\Payment\Model\Method\Banktransfer')); /** @var $childBank \Magento\Payment\Block\Info\Instructions */ $childBank = $layout->addBlock('Magento\Payment\Block\Info\Instructions', 'child.one', 'block'); - $childBank->setInfo($paymentInfoBank) - ->setArea('adminhtml'); + $childBank->setInfo($paymentInfoBank); $nonExpectedHtml = 'non-expected html'; $childHtml = $layout->addBlock('Magento\Core\Block\Text', 'child.html', 'block'); @@ -60,8 +61,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase ->create('Magento\Payment\Model\Method\Checkmo')); /** @var $childCheckmo \Magento\Payment\Block\Info\Checkmo */ $childCheckmo = $layout->addBlock('Magento\Payment\Block\Info\Checkmo', 'child.just.another', 'block'); - $childCheckmo->setInfo($paymentInfoCheckmo) - ->setArea('adminhtml'); + $childCheckmo->setInfo($paymentInfoCheckmo); $pdfArray = $block->getChildPdfAsArray(); diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php index bea4f722f165043fb82d71ab04c5346a7b8ae6d2..ba1df91a17620170c27fd6db111a832b712047ef 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php @@ -37,16 +37,16 @@ class VoidTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $eventManager = $objectManager->get('Magento\Event\ManagerInterface'); - $moduleList = $objectManager->get('Magento\App\ModuleListInterface'); + $moduleList = $objectManager->get('Magento\Module\ModuleListInterface'); $paymentData = $objectManager->get('Magento\Payment\Helper\Data'); $coreStoreConfig = $objectManager->get('Magento\Core\Model\Store\Config'); - $logger = $objectManager->get('Magento\Core\Model\Logger'); + $logger = $objectManager->get('Magento\Logger'); $logAdapterFactory = $objectManager->get('Magento\Core\Model\Log\AdapterFactory'); $locale = $objectManager->get('Magento\Core\Model\LocaleInterface'); $centinelService = $objectManager->get('Magento\Centinel\Model\Service'); $storeManager = $objectManager->get('Magento\Core\Model\StoreManagerInterface'); $configFactory = $objectManager->get('Magento\Paypal\Model\ConfigFactory'); - $coreData = $objectManager->get('Magento\Core\Helper\Data'); + $mathRandom = $objectManager->get('Magento\Math\Random'); /** @var $order \Magento\Sales\Model\Order */ $order = $objectManager->create('Magento\Sales\Model\Order'); @@ -63,9 +63,9 @@ class VoidTest extends \PHPUnit_Framework_TestCase $logAdapterFactory, $locale, $centinelService, - $coreData, $storeManager, - $configFactory + $configFactory, + $mathRandom )); $response = new \Magento\Object(array( diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php index c437f98bb761e4e0d85d2c0e7c6d5016f60d42f6..c33f89fe325b4745eb0dad95846d4de9ff801955 100644 --- a/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php @@ -46,7 +46,7 @@ class StockTest extends \PHPUnit_Framework_TestCase public function testThumbnail() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Product'); $product->load(1); diff --git a/dev/tests/integration/testsuite/Magento/Profiler/Driver/Standard/Output/FirebugTest.php b/dev/tests/integration/testsuite/Magento/Profiler/Driver/Standard/Output/FirebugTest.php index e010066c97897a0c8b4c86cb5b99baa92cee23d0..4c42595ec4b211679bb5b78f190e63dab78ad538 100644 --- a/dev/tests/integration/testsuite/Magento/Profiler/Driver/Standard/Output/FirebugTest.php +++ b/dev/tests/integration/testsuite/Magento/Profiler/Driver/Standard/Output/FirebugTest.php @@ -50,7 +50,7 @@ class FirebugTest extends \PHPUnit_Framework_TestCase ->method('canSendHeaders') ->will($this->returnValue(true)); - $this->_request = $this->getMock('\Magento\App\Request\Http', array('getHeader')); + $this->_request = $this->getMock('\Magento\App\Request\Http', array('getHeader'), array(), '', false); $this->_request ->expects($this->any()) ->method('getHeader') diff --git a/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueHandlerTest.php b/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueHandlerTest.php index 4b66fbd39955dab61c354359a877fad990819589..f21961ace82c117e7f38c9fdd549c55aded44952 100644 --- a/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueHandlerTest.php @@ -75,14 +75,14 @@ class QueueHandlerTest extends \PHPUnit_Framework_TestCase ->save(); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( - 'Magento\Core\Model\Config\Base' => array( + 'Magento\Webhook\Model\Config' => array( 'parameters' => array( 'sourceData' => __DIR__ . '/../_files/config.xml', ), ), 'Magento\Webhook\Model\Resource\Subscription' => array( 'parameters' => array( - 'config' => array('instance' => 'Magento\Core\Model\Config\Base'), + 'config' => array('instance' => 'Magento\Webhook\Model\Config'), ), ) )); diff --git a/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php b/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php index 4440c58d107b176c6a80dd08741c76614904b742..1c65ad9656b543212a2d761a066999490269d1ac 100644 --- a/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php +++ b/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php @@ -88,7 +88,9 @@ class CatalogTest extends \Magento\TestFramework\TestCase\AbstractController */ public function testAuthorizationFailed($action) { - $this->dispatch("rss/catalog/{$action}"); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Backend\Model\Url') + ->turnOffSecretKey(); + $this->dispatch("backend/rss/catalog/{$action}"); $this->assertHeaderPcre('Http/1.1', '/^401 Unauthorized$/'); } @@ -105,6 +107,7 @@ class CatalogTest extends \Magento\TestFramework\TestCase\AbstractController /** * @magentoDataFixture Magento/Catalog/_files/multiple_products.php + * @magentoConfigFixture admin_store cataloginventory/item_options/notify_stock_qty 75 * @magentoConfigFixture current_store cataloginventory/item_options/notify_stock_qty 75 */ public function testNotifyStockAction() @@ -114,7 +117,7 @@ class CatalogTest extends \Magento\TestFramework\TestCase\AbstractController ->get('Magento\CatalogInventory\Model\Resource\Stock') ->updateLowStockDate(); $this->_loginAdmin(); - $this->dispatch('rss/catalog/notifystock'); + $this->dispatch('backend/rss/catalog/notifystock'); $this->assertHeaderPcre('Content-Type', '/text\/xml/'); @@ -131,7 +134,7 @@ class CatalogTest extends \Magento\TestFramework\TestCase\AbstractController public function testReviewAction() { $this->_loginAdmin(); - $this->dispatch('rss/catalog/review'); + $this->dispatch('backend/rss/catalog/review'); $this->assertHeaderPcre('Content-Type', '/text\/xml/'); $body = $this->getResponse()->getBody(); $this->assertContains('"Simple Product 3"', $body); @@ -160,12 +163,15 @@ class CatalogTest extends \Magento\TestFramework\TestCase\AbstractController */ protected function _loginAdmin() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setArea('adminhtml') ->setDefaultDesignTheme(); $this->getRequest()->setServer(array( 'PHP_AUTH_USER' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, 'PHP_AUTH_PW' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Backend\Model\Url') + ->turnOffSecretKey(); } } diff --git a/dev/tests/integration/testsuite/Magento/Rss/Controller/OrderTest.php b/dev/tests/integration/testsuite/Magento/Rss/Controller/OrderTest.php index 9a8222c1bfef7d0df456a1b5813e7d1c3344543b..9b8d5897578a04d92de26c0bfd0daa0e2c62924a 100644 --- a/dev/tests/integration/testsuite/Magento/Rss/Controller/OrderTest.php +++ b/dev/tests/integration/testsuite/Magento/Rss/Controller/OrderTest.php @@ -35,7 +35,7 @@ class OrderTest extends \Magento\TestFramework\TestCase\AbstractController /** * Reuse URI for "new" action */ - const NEW_ORDER_URI = 'rss/order/new'; + const NEW_ORDER_URI = 'backend/rss/order/new'; public function testNewActionAuthorizationFailed() { diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php index 064a3c9053a9b9a6696671db33dfae641cac4975..71a29157c8625bb8ada1f70d5bf880ed6367e9f7 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php @@ -39,11 +39,13 @@ class AbstractTest public function testAddAttributesToForm() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $objectManager->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) ->setDefaultDesignTheme(); $arguments = array( - $objectManager->get('Magento\Data\Form\Factory'), + $objectManager->get('Magento\Data\FormFactory'), $objectManager->get('Magento\Adminhtml\Model\Session\Quote'), $objectManager->get('Magento\Sales\Model\AdminOrder\Create'), $objectManager->get('Magento\Core\Helper\Data'), @@ -58,8 +60,8 @@ class AbstractTest 'Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractForm', '_addAttributesToForm'); $method->setAccessible(true); - /** @var $formFactory \Magento\Data\Form\Factory */ - $formFactory = $objectManager->get('Magento\Data\Form\Factory'); + /** @var $formFactory \Magento\Data\FormFactory */ + $formFactory = $objectManager->get('Magento\Data\FormFactory'); $form = $formFactory->create(); $fieldset = $form->addFieldset('test_fieldset', array()); $arguments = array( diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php index ccce946491ad7575adc17582c726d86ef82cc87e..39ffb55e26970325e23922ff1c346c8a6ecf56e8 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php @@ -31,6 +31,9 @@ class TotalsTest extends \PHPUnit_Framework_TestCase { public function testToHtmlChildrenInitialized() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode('frontend'); + /** @var $layout \Magento\Core\Model\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); $block = $layout->createBlock('Magento\Sales\Block\Order\Totals', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Recurring/Profile/ViewTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Recurring/Profile/ViewTest.php index 332b7a3f68b6fd9134ca1478acacf7c70a2c3c27..25235c897c7896c2e96cc86c42e330b1852cc0d2 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Recurring/Profile/ViewTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Recurring/Profile/ViewTest.php @@ -69,6 +69,8 @@ class ViewTest extends \PHPUnit_Framework_TestCase public function testToHtmlPropagatesUrl() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode('frontend'); $this->_block->setShouldPrepareInfoTabs(true); $childOne = $this->_layout->addBlock('Magento\Core\Block\Text', 'child1', 'block'); $this->_layout->addToParentGroup('child1', 'info_tabs'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/AbstractTest.php index 38130aba78d46bd202fb3bcdd236d2f7753b893d..7a2565937e3a51a1f40ff95230d60ad8ed307f59 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/AbstractTest.php @@ -44,7 +44,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase public function testAfterCommitCallbackOrderGridNotInvoked() { - $adapter = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Resource') + $adapter = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Resource') ->getConnection('core_write'); $this->assertEquals(0, $adapter->getTransactionLevel(), 'This test must be outside a transaction.'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php index 37ae440eb8d4a06369d830b526e9728660be70bd..42d599bd8033503b84a10ccfc94859b97c234631 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php @@ -35,7 +35,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase public function testSendEmail() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Sales\Model\Order'); $order->loadByIncrementId('100000001'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php index 6d22d5be7163a6cd67a31f26de3244274a423c83..95c27cb4c24d4342710a0d4551c49d10cf3d4ff6 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php @@ -35,7 +35,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testSendEmail() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Sales\Model\Order'); $order->loadByIncrementId('100000001'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php index 95c63b8b1ace70aa8632c361107e886758745e96..bab0e2df477ca6d05b454d80e3c9038a1657d42c 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php @@ -35,7 +35,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testSendNewOrderEmail() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Sales\Model\Order'); $order->loadByIncrementId('100000001'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php index de8f40cf9c2cd2bdb8b41205ff045d5cd77ee577..8c97f8305e5142338dcaf1462acf9705dbec5bef 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php @@ -34,6 +34,8 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase */ public function testSendEmail() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode('frontend'); $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Sales\Model\Order'); $order->loadByIncrementId('100000001'); @@ -47,7 +49,6 @@ class ShipmentTest extends \PHPUnit_Framework_TestCase $paymentInfoBlock = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Payment\Helper\Data') ->getInfoBlock($payment); - $paymentInfoBlock->setArea('invalid-area'); $payment->setBlockMock($paymentInfoBlock); $this->assertEmpty($shipment->getEmailSent()); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php index b9c645176faafeeca7e30e45868b463af1a2ac4b..dd08c848d798df9eb7c1224bdfbc995f0abce225 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php @@ -26,7 +26,7 @@ */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML); + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php index 1178165b55991ccdd14566c43d4531e0efd89d16..d37c7ca2370f198c6f29f7af435e4e63b25fd696 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php @@ -27,7 +27,7 @@ /** @var \Magento\Core\Model\App $app */ $app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); -$app->loadArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML); +$app->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $addressData = include(__DIR__ . '/address_data.php'); diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/LabelsTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/LabelsTest.php similarity index 83% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/LabelsTest.php rename to dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/LabelsTest.php index 5486fb59eed37b805722baff14956b78389b7c8b..753de15b74261bd613f7ac10f133bebaa12fc186 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/LabelsTest.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/LabelsTest.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab; /** * @magentoAppArea adminhtml @@ -32,9 +32,9 @@ class LabelsTest extends \PHPUnit_Framework_TestCase public function testConstruct() { $this->assertInstanceOf( - 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Labels', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Labels', \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') - ->createBlock('Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Labels') + ->createBlock('Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Labels') ); } } diff --git a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php similarity index 83% rename from dev/tests/integration/testsuite/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/MainTest.php rename to dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php index c68ca6b29a4f68e92b5583a0d8ac7ae3c1e1a113..b6244cc3f4479ad435b23f850854b2943a8870cc 100644 --- a/dev/tests/integration/testsuite/Magento/Adminhtml/Block/Promo/Quote/Edit/Tab/MainTest.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php @@ -25,10 +25,10 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\Promo\Quote\Edit\Tab; +namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab; /** - * Test class for \Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Main + * Test class for \Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Main * * @magentoAppArea adminhtml */ @@ -41,15 +41,15 @@ class MainTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_ADMINHTML) + ->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ->setDefaultDesignTheme(); $objectManager->get('Magento\Core\Model\Registry') ->register('current_promo_quote_rule', $objectManager->create('Magento\SalesRule\Model\Rule')); $layout = $objectManager->create('Magento\Core\Model\Layout'); - $block = $layout->addBlock('Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Main'); + $block = $layout->addBlock('Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Main'); $prepareFormMethod = new \ReflectionMethod( - 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Main', '_prepareForm' + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Main', '_prepareForm' ); $prepareFormMethod->setAccessible(true); $prepareFormMethod->invoke($block); diff --git a/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php b/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php index 0b4b9ec283a0b83492ab90ef1b4e2b6815dd435c..0dce8062b2c01729d5333f4a8b2c26537400faf0 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php @@ -35,9 +35,10 @@ class ImportExportTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') - ->createBlock('Magento\Tax\Block\Adminhtml\Rate\ImportExport') - ->setArea('adminhtml'); + ->createBlock('Magento\Tax\Block\Adminhtml\Rate\ImportExport'); } protected function tearDown() diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RuleTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RuleTest.php index a5c302711d9db04d45144c8b2ccc5dbc886adb95..7ecc37a211780c3043a82409c85c77cf67463aa9 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RuleTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RuleTest.php @@ -182,7 +182,7 @@ class RuleTest extends \PHPUnit_Framework_TestCase array( $this->_objectManager->create('Magento\Core\Model\Context'), $this->_objectManager->get('Magento\Core\Model\Registry'), - $this->_objectManager->create('Magento\Tax\Model\ClassModel\Factory'), + $this->_objectManager->get('Magento\Tax\Model\TaxClass\Factory'), ), '', true diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php index 3f6658e2e72c69c2d983e75aadb9ef17304861cc..31b429c674859d3dabf75cbfe2b2005e4f0f4103 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/LayoutTest.php @@ -38,6 +38,15 @@ class LayoutTest extends \PHPUnit_Framework_TestCase */ protected static $_cachedFiles = array(); + public static function setUpBeforeClass() + { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( + 'preferences' => array( + 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' + ) + )); + } + public static function tearDownAfterClass() { self::$_cachedFiles = array(); // Free memory diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/TemplateFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/TemplateFilesTest.php index 15919e048c9a6b82c6590eb37d60e8f6077ed14e..15611f079d80f2dc770d208e5fe551dbe8e602b1 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/TemplateFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Widget/TemplateFilesTest.php @@ -29,6 +29,11 @@ namespace Magento\Test\Integrity\Magento\Widget; class TemplateFilesTest extends \PHPUnit_Framework_TestCase { + public static function setUpBeforeClass() + { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); + } + /** * Check if all the declared widget templates actually exist * diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php index 475422704112c95a8d04b545ce9f4cf514e65b02..cd24b6615e8348a4813d81f329b3523ec9ca1d69 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php @@ -129,7 +129,7 @@ class BlockInstantiationTest extends \Magento\TestFramework\TestCase\AbstractInt $area = 'adminhtml'; } \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadAreaPart( - \Magento\Core\Model\App\Area::AREA_ADMINHTML, + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \Magento\Core\Model\App\Area::PART_CONFIG ); $templateBlocks[$module . ', ' . $blockClass . ', ' . $area] diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CacheFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CacheFilesTest.php index 340efd957868dc31524da73f7af867497d5b6854..23f6c9bf67e25a4f5cf8c2f2755a1c8633e68196 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CacheFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CacheFilesTest.php @@ -34,9 +34,9 @@ class CacheFilesTest extends \PHPUnit_Framework_TestCase $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); $validationStateMock->expects($this->any())->method('isValidated')->will($this->returnValue(true)); - /** @var \Magento\Core\Model\Config\Modules\Reader $moduleReader */ + /** @var \Magento\Module\Dir\Reader $moduleReader */ $moduleReader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Config\Modules\Reader'); + ->get('Magento\Module\Dir\Reader'); $schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . DIRECTORY_SEPARATOR . 'cache.xsd'; /** @var \Magento\Core\Model\Cache\Config\Reader $reader */ diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CrontabConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CrontabConfigFilesTest.php index c03cc4ac8a96deb067957d86fae6f60b7aea510e..4ffbf63c5ba2d465e4e6901acfae462a588777bd 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CrontabConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/CrontabConfigFilesTest.php @@ -27,7 +27,7 @@ class CrontabConfigFilesTest extends \PHPUnit_Framework_TestCase { /** * attributes represent merging rules - * copied from original class \Magento\Core\Model\Route\Config\Reader + * copied from original class \Magento\App\Route\Config\Reader * * @var array */ diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php index 93120b72be97910495fe4d36875d08056da1a138..809f544adc7dc99b42a6f22cf14b69fa9b902c53 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php @@ -54,9 +54,9 @@ class DiConfigFilesTest extends \PHPUnit_Framework_TestCase array_unshift(self::$_primaryFiles, $dir->getDir(\Magento\App\Dir::APP) . DS . 'etc' . DS . 'di.xml'); //init module global configs - /** @var $modulesReader \Magento\Core\Model\Config\Modules\Reader */ + /** @var $modulesReader \Magento\Module\Dir\Reader */ $modulesReader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Config\Modules\Reader'); + ->get('Magento\Module\Dir\Reader'); self::$_moduleGlobalFiles = $modulesReader->getConfigurationFiles('di.xml'); //init module area configs diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php index a7fd29fc21044f77030d7b7a5944ea130ccfa67f..8a520c5966d713e054afe787c970f5ae36bc29ba 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/MenuConfigFilesTest.php @@ -37,7 +37,7 @@ class MenuConfigFilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { $moduleReader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Config\Modules\Reader'); + ->create('Magento\Module\Dir\Reader'); $schemaFile = $moduleReader->getModuleDir('etc', 'Magento_Backend') . DIRECTORY_SEPARATOR . 'menu.xsd'; $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Backend\Model\Menu\Config\Reader', diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php index d366ddbc64f5da8031647f267d2ce9dbc0b15e6f..cdf8e7082b7339ce3736f65a394f31ebb664c82f 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php @@ -26,7 +26,7 @@ namespace Magento\Test\Integrity\Modular; class ResourcesConfigFilesTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Config\Reader + * @var \Magento\App\Resource\Config\Reader */ protected $_model; @@ -44,10 +44,10 @@ class ResourcesConfigFilesTest extends \PHPUnit_Framework_TestCase $validationStateMock->expects($this->any()) ->method('isValidated') ->will($this->returnValue(true)); - $localConfigMock = $this->getMock('Magento\Core\Model\Config\Local', array(), array(), '', false); + $localConfigMock = $this->getMock('Magento\App\Config', array(), array(), '', false); $localConfigMock->expects($this->any())->method('getConfiguration')->will($this->returnValue(array())); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_model = $objectManager->create('Magento\Core\Model\Resource\Config\Reader', array( + $this->_model = $objectManager->create('Magento\App\Resource\Config\Reader', array( 'fileResolver' => $fileResolverMock, 'validationState' => $validationStateMock, 'localConfig' => $localConfigMock, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php index a5fb045958b00c7cb0a50e560d0afd53ad5df420..8e2f746f8ab4c5804ff28fc32c8640e0b83f7d31 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php @@ -28,7 +28,7 @@ class RouteConfigFilesTest extends \PHPUnit_Framework_TestCase { /** * attributes represent merging rules - * copied from original class \Magento\Core\Model\Route\Config\Reader + * copied from original class \Magento\App\Route\Config\Reader * @var array */ protected $_idAttributes = array( @@ -55,8 +55,8 @@ class RouteConfigFilesTest extends \PHPUnit_Framework_TestCase { global $magentoBaseDir; - $this->_schemaFile = $magentoBaseDir . '/app/code/Magento/Core/etc/routes.xsd'; - $this->_mergedSchemaFile = $magentoBaseDir . '/app/code/Magento/Core/etc/routes_merged.xsd'; + $this->_schemaFile = $magentoBaseDir . '/lib/Magento/App/etc/routes.xsd'; + $this->_mergedSchemaFile = $magentoBaseDir . '/lib/Magento/App/etc/routes_merged.xsd'; } public function testRouteConfigsValidation() diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SalesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SalesConfigFilesTest.php index 01cb37e91f66d883daf891cdf888649cd122de68..2e1deb45038be7945534438c4e849d9a166ac22b 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SalesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SalesConfigFilesTest.php @@ -27,7 +27,7 @@ class SalesConfigFilesTest extends \PHPUnit_Framework_TestCase { /** * attributes represent merging rules - * copied from original namespace Magento\Core\Model\Route\Config; + * copied from original namespace Magento\App\Route\Config; * * class Reader * diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php index 9b357baf9ccd84530bd01be91c815e3b6ad9d480..38f274ad2a5da03848f9f7862b13437bc5a5bba2 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php @@ -45,7 +45,7 @@ class SystemConfigFilesTest extends \PHPUnit_Framework_TestCase $fileList = glob($modulesDir . '/*/*/etc/adminhtml/system.xml'); $configMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array('getConfigurationFiles', 'getModuleDir'), + 'Magento\Module\Dir\Reader', array('getConfigurationFiles', 'getModuleDir'), array(), '', false ); $configMock->expects($this->any()) diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php index dbdd2f44aa592123e6d310071d96c57b58d8d94b..d66217d727868f8ff7cee5c665072d94838ffca5 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php @@ -94,12 +94,14 @@ class TemplateFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrit } \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadAreaPart( - \Magento\Core\Model\App\Area::AREA_ADMINHTML, + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \Magento\Core\Model\App\Area::PART_CONFIG ); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Config\ScopeInterface') ->setCurrentScope($area); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode($area); $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create($blockClass); $template = $block->getTemplate(); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/UsaConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/UsaConfigFilesTest.php index 6a40895fee7a25cf4657d0b77c87d4cc17a6bf4b..0424806a0a5066e149609c96567216b5bc2c296f 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/UsaConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/UsaConfigFilesTest.php @@ -35,7 +35,7 @@ class UsaConfigFilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { $moduleReader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Config\Modules\Reader'); + ->create('Magento\Module\Dir\Reader'); $schemaFile = $moduleReader->getModuleDir('etc', 'Magento_Backend') . '/system.xsd'; $this->_reader = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create( diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php index 845e1bc274cf04a6783a32af3cd2c53f118bf7c2..ced8f3c0bf09266cc7505906b610c39137237b70 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php @@ -55,7 +55,7 @@ class ViewConfigFilesTest extends \PHPUnit_Framework_TestCase { $result = array(); $files = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Config\Modules\Reader') + ->get('Magento\Module\Dir\Reader') ->getConfigurationFiles('view.xml'); foreach ($files as $file) { $result[] = array($file); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php index fed053e38e4316d3d067487884da747c8a586868..b12cc636431c54acb04418e1afe74685cf290758 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php @@ -38,9 +38,10 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity * @param string $file */ function ($application, $file) { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea($application); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\View\DesignInterface') - ->setArea($application) ->setDefaultDesignTheme(); $result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Core\Model\View\FileSystem') @@ -59,10 +60,11 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity public function viewFilesFromModulesViewDataProvider() { $files = array(); - /** @var $configModel \Magento\Core\Model\Config */ - $configModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Config'); + /** @var $configModelReader \Magento\Module\Dir\Reader */ + $configModelReader = + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Module\Dir\Reader'); foreach ($this->_getEnabledModules() as $moduleName) { - $moduleViewDir = $configModel->getModuleDir('view', $moduleName); + $moduleViewDir = $configModelReader->getModuleDir('view', $moduleName); if (!is_dir($moduleViewDir)) { continue; } @@ -141,9 +143,10 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity * @param string $file */ function ($application, $file) { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode($application); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\View\DesignInterface') - ->setArea($application) ->setDefaultDesignTheme(); $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Core\Model\View\FileSystem'); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/skip_blocks_ce.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/skip_blocks_ce.php index 5c04054be34a1c323fa0a07ca603db75d38e6dba..81587abdd3b63060f14072e0a330f0c96ba27e78 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/skip_blocks_ce.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/skip_blocks_ce.php @@ -27,15 +27,15 @@ */ return array( // Blocks with abstract constructor arguments - 'Magento\Adminhtml\Block\System\Email\Template', - 'Magento\Adminhtml\Block\System\Email\Template\Edit', + 'Magento\Backend\Block\System\Email\Template', + 'Magento\Backend\Block\System\Email\Template\Edit', 'Magento\Backend\Block\System\Config\Edit', 'Magento\Backend\Block\System\Config\Form', 'Magento\Backend\Block\System\Config\Tabs', 'Magento\Review\Block\Form', // Fails because of bug in \Magento\Webapi\Model\Acl\Loader\Resource\ConfigReader constructor - 'Magento\Adminhtml\Block\Cms\Page', - 'Magento\Adminhtml\Block\Cms\Page\Edit', + 'Magento\Cms\Block\Adminhtml\Page', + 'Magento\Cms\Block\Adminhtml\Page\Edit', 'Magento\Sales\Block\Adminhtml\Order', 'Magento\Oauth\Block\Adminhtml\Oauth\Consumer', 'Magento\Oauth\Block\Adminhtml\Oauth\Consumer\Grid', diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php index c5557a9e8598481c1c110e1513a31cd50bf8b4ba..eac70152e228982832ac1fcee54eb29e25709f69 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php @@ -31,6 +31,11 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity { public function testViewFilesFromThemes() { + \Magento\TestFramework\Helper\Bootstrap::getObjectmanager()->configure(array( + 'preferences' => array( + 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' + ) + )); $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); $invoker( /** diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php index 0e9a42648db3f38a5434246c1576647da590bb63..f55e8fe1dd116cd5cce8c958d7f3b16d635ee7cc 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/ViewFileReferenceTest.php @@ -63,6 +63,11 @@ class ViewFileReferenceTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->configure(array( + 'preferences' => array( + 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' + ) + )); /** @var $fallbackFactory \Magento\View\Design\Fallback\Factory */ $fallbackFactory = $objectManager->get('Magento\View\Design\Fallback\Factory'); diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php index 7da025aab514949850edc4d0c20a662514c8d180..1a2ee090279367ff84e4135367b0dc0bec2bd37e 100644 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/AuthTest.php @@ -112,13 +112,17 @@ class AuthTest extends \Magento\Backend\Utility\Controller */ public function testResetPasswordPostAction() { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var $user \Magento\User\Model\User */ - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\User\Model\User')->loadByUsername('dummy_username'); + $user = $objectManager->create('Magento\User\Model\User'); + $user->loadByUsername('dummy_username'); $this->assertNotEmpty($user->getId(), 'Broken fixture'); - $resetPasswordToken = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\User\Helper\Data') - ->generateResetPasswordLinkToken(); + + /** @var \Magento\User\Helper\Data $helper */ + $helper = $objectManager->get('Magento\User\Helper\Data'); + + $resetPasswordToken = $helper->generateResetPasswordLinkToken(); $user->changeResetPasswordLinkToken($resetPasswordToken); $user->save(); @@ -132,18 +136,17 @@ class AuthTest extends \Magento\Backend\Utility\Controller $this->dispatch('backend/admin/auth/resetpasswordpost'); - $this->assertRedirect($this->equalTo( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Backend\Helper\Data') - ->getHomePageUrl() - )); + /** @var \Magento\Backend\Helper\Data $backendHelper */ + $backendHelper = $objectManager->get('Magento\Backend\Helper\Data'); + $this->assertRedirect($this->equalTo($backendHelper->getHomePageUrl())); /** @var $user \Magento\User\Model\User */ - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\User\Model\User')->loadByUsername('dummy_username'); - $this->assertTrue( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Helper\Data') - ->validateHash($newDummyPassword, $user->getPassword()) - ); + $user = $objectManager->create('Magento\User\Model\User'); + $user->loadByUsername('dummy_username'); + + /** @var \Magento\Encryption\EncryptorInterface $encryptor */ + $encryptor = $objectManager->get('Magento\Encryption\EncryptorInterface'); + $this->assertTrue($encryptor->validateHash($newDummyPassword, $user->getPassword())); } /** @@ -158,10 +161,13 @@ class AuthTest extends \Magento\Backend\Utility\Controller $this->assertSessionMessages( $this->equalTo(array('Your password reset link has expired.')), \Magento\Core\Model\Message::ERROR ); - $this->assertRedirect($this->equalTo( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Backend\Helper\Data') - ->getHomePageUrl() - )); + + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + /** @var \Magento\Backend\Helper\Data $backendHelper */ + $backendHelper = $objectManager->get('Magento\Backend\Helper\Data'); + + $this->assertRedirect($this->equalTo($backendHelper->getHomePageUrl())); } /** @@ -171,13 +177,16 @@ class AuthTest extends \Magento\Backend\Utility\Controller */ public function testResetPasswordPostActionWithInvalidPassword() { - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\User\Model\User')->loadByUsername('dummy_username'); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + $user = $objectManager->create('Magento\User\Model\User'); + $user->loadByUsername('dummy_username'); $resetPasswordToken = null; if ($user->getId()) { - $resetPasswordToken = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\User\Helper\Data') - ->generateResetPasswordLinkToken(); + /** @var \Magento\User\Helper\Data $userHelper */ + $userHelper = $objectManager->get('Magento\User\Helper\Data'); + + $resetPasswordToken = $userHelper->generateResetPasswordLinkToken(); $user->changeResetPasswordLinkToken($resetPasswordToken); $user->save(); } diff --git a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php index 9d5094a37960fa582cde36863329fcbdc895c55e..dd5778a2705751a2a4ba00f7a47da07da0fff08b 100644 --- a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php @@ -37,6 +37,11 @@ class UserTest extends \PHPUnit_Framework_TestCase */ protected $_model; + /** + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + /** * @var \Magento\User\Model\Role */ @@ -46,6 +51,8 @@ class UserTest extends \PHPUnit_Framework_TestCase { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\User\Model\User'); + $this->_dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Stdlib\DateTime'); } /** @@ -408,10 +415,10 @@ class UserTest extends \PHPUnit_Framework_TestCase $this->_model->save(); $this->_model->loadByUsername(\Magento\TestFramework\Bootstrap::ADMIN_NAME); $this->assertFalse($this->_model->isResetPasswordLinkTokenExpired()); - $this->_model->setRpTokenCreatedAt(\Magento\Date::formatDate(time() - 60 * 60 * 24 * 10 + 10)); + $this->_model->setRpTokenCreatedAt($this->_dateTime->formatDate(time() - 60 * 60 * 24 * 10 + 10)); $this->assertFalse($this->_model->isResetPasswordLinkTokenExpired()); - $this->_model->setRpTokenCreatedAt(\Magento\Date::formatDate(time() - 60 * 60 * 24 * 10 - 10)); + $this->_model->setRpTokenCreatedAt($this->_dateTime->formatDate(time() - 60 * 60 * 24 * 10 - 10)); $this->assertTrue($this->_model->isResetPasswordLinkTokenExpired()); } diff --git a/dev/tests/integration/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php b/dev/tests/integration/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php index fff9ea875e7716c72e5aa5f4bda963fe3c673ebe..6672096747972f9e5a6b7c7081816281a85bfffe 100644 --- a/dev/tests/integration/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php @@ -104,6 +104,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase */ public function testGetFile($file, $area, $themePath, $module, $expectedFilename) { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode($area); $model = $this->_buildModel($area, $themePath, null); $themeModel = $this->_getThemeModel($area, $themePath); @@ -161,6 +162,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase */ public function testGetI18nCsvFile($area, $themePath, $locale, $expectedFilename) { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode($area); $model = $this->_buildModel($area, $themePath, $locale); $themeModel = $this->_getThemeModel($area, $themePath); @@ -207,7 +209,8 @@ class FallbackTest extends \PHPUnit_Framework_TestCase */ public function testGetViewFile($file, $area, $themePath, $locale, $module, $expectedFilename) { - $model = $this->_buildModel($area, $themePath, $locale); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode($area); + $model = $this->_buildModel(); $themeModel = $this->_getThemeModel($area, $themePath); $expectedFilename = str_replace('/', DIRECTORY_SEPARATOR, $expectedFilename); diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/AbstractFormTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/AbstractFormTest.php index 9cc4f1a13e5d91f103be8c988f7d9899a1f14dee..59c2f2a6ceeef6e29859db58c212a4d381fbb506 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/AbstractFormTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/AbstractFormTest.php @@ -93,6 +93,8 @@ abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase public function testPrepareForm() { // TODO: Move to unit tests after MAGETWO-4015 complete. + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->assertEmpty($this->_block->getForm()); $this->_urlBuilder->expects($this->once()) diff --git a/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php b/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ad41c7f9eeb14613bdfccb72f5979b035bb22c03 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Test services for name collisions. + * + * Let we have two service interfaces called Foo\Bar\Service\SomeBazV1Interface and Foo\Bar\Service\Some\BazV1Interface. + * Given current name generation logic both are going to be translated to BarSomeBazV1. This test checks such things + * are not going to happen. + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Webapi; + +class ServiceNameCollisionTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test there are no collisions between service names. + * + * @see \Magento\Webapi\Model\Soap\Config::getServiceName() + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + */ + public function testServiceNameCollisions() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Webapi\Model\Soap\Config $soapConfig */ + $soapConfig = $objectManager->get('Magento\Webapi\Model\Soap\Config'); + /** @var \Magento\Webapi\Model\Config $webapiConfig */ + $webapiConfig = $objectManager->get('Magento\Webapi\Model\Config'); + $serviceNames = array(); + + foreach ($webapiConfig->getServices() as $serviceClassName => $serviceData) { + $newServiceName = $soapConfig->getServiceName($serviceClassName); + $this->assertFalse(in_array($newServiceName, $serviceNames)); + $serviceNames[] = $newServiceName; + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/ObserverTest.php index 2c04c28a52af6be2e41e94dcdf05c614ddf3cb2c..81a74d6d19eadd2ec5b288af90834ebfef5b0403 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Webhook/Model/ObserverTest.php @@ -101,9 +101,6 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_subscriptionFactory->create()->load($this->_subscription->getId())->getStatus()); } - /** - * @magentoConfigFixture global/webhook/webhooks/test/hook/label 'Test Hook' - */ public function testAfterWebapiUserChange() { //setup @@ -121,9 +118,6 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_subscriptionFactory->create()->load($this->_subscription->getId())->getStatus()); } - /** - * @magentoConfigFixture global/webhook/webhooks/test/hook/label 'Test Hook' - */ public function testAfterWebapiRoleChange() { //setup diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php index bc59a86a86f56ae3d295367309f4647d90aafb9e..a6c7f94727a91242ef37915fcafe6b06af8df67a 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php @@ -145,8 +145,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $data = $collection->getData(); $this->assertEquals(2, count($data)); - /** @var \Magento\Core\Model\Resource $resource */ - $resource = $this->_objectManager->create('Magento\Core\Model\Resource'); + /** @var \Magento\App\Resource $resource */ + $resource = $this->_objectManager->create('Magento\App\Resource'); $connection = $resource->getConnection('core_write'); /** @var \Magento\Webhook\Model\Resource\Event\Collection $collection2 */ diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/EventTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/EventTest.php index 66c7cdb0aa8187a115bd4cd22dcb67b3c3045bff..f8e36902b16420a2d0cac232d5e093102d760f06 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/EventTest.php +++ b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/EventTest.php @@ -38,7 +38,7 @@ class EventTest extends \PHPUnit_Framework_TestCase public function testInit() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $resource = $objectManager->create('Magento\Core\Model\Resource', array('tablePrefix' => 'prefix_')); + $resource = $objectManager->create('Magento\App\Resource', array('tablePrefix' => 'prefix_')); /** @var \Magento\Webhook\Model\Resource\Event $eventResource */ $eventResource = $objectManager->create('Magento\Webhook\Model\Resource\Event', array('resource' => $resource)); diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php index 1f57c66ad4c98cee66bec6fd906c05c0c17124ca..92a13800d449d54e3e06ff248b5da4f6dd7c6d91 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php @@ -144,8 +144,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $data = $collection->getData(); $this->assertEquals(2, count($data)); - /** @var \Magento\Core\Model\Resource $resource */ - $resource = $this->_objectManager->create('Magento\Core\Model\Resource'); + /** @var \Magento\App\Resource $resource */ + $resource = $this->_objectManager->create('Magento\App\Resource'); $connection = $resource->getConnection('core_write'); /** @var \Magento\Webhook\Model\Resource\Job\Collection $collection2 */ diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/JobTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/JobTest.php index 2cba6e970fecee04ca20b53d81a01325b23e5067..a62e45d765452dd19d89e69d4d31fd0d6fdd626c 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/JobTest.php +++ b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/JobTest.php @@ -35,7 +35,7 @@ class JobTest extends \PHPUnit_Framework_TestCase public function testInit() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $resource = $objectManager->create('Magento\Core\Model\Resource', array('tablePrefix' => 'prefix_')); + $resource = $objectManager->create('Magento\App\Resource', array('tablePrefix' => 'prefix_')); /** @var \Magento\Webhook\Model\Resource\Job $jobResource */ $jobResource = $objectManager->create('Magento\Webhook\Model\Resource\Job', array('resource' => $resource)); diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php index b80ecc6a601f56c524a61c185bae0668c42032c9..53d56afb0324bba0f7875f3fdb7e6bbdf1b06e61 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php @@ -76,11 +76,19 @@ class CollectionTest extends \PHPUnit_Framework_TestCase protected function setUp() { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->_subscriptions = array(); - $configModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Config'); - $configModel->setNode('global/webhook/webhooks/listeners/one/label', 'One Listener'); - $configModel->setNode('global/webhook/webhooks/listeners/two/label', 'Two Listeners'); - $configModel->setNode('global/webhook/webhooks/listeners/three/label', 'Three Listeners'); + + $configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false, false); + $webHooks = array( + 'listeners' => array( + 'one' => array('label' => 'One Listener'), + 'two' => array('label' => 'Two Listeners'), + 'three' => array('label' => 'Three Listeners'), + ) + ); + $configMock->expects($this->any())->method('getWebhooks')->will($this->returnValue($webHooks)); + $objectManager->addSharedInstance($configMock, 'Magento\Webhook\Model\Config'); /** @var \Magento\Webhook\Model\Subscription $subscription */ $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php index 6fc8337ff13a48674464cb866a426568b4451571..2f0fdf786741efa223df1ff2f33aeaf26800b906 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php @@ -108,78 +108,28 @@ class CollectionTest extends \PHPUnit_Framework_TestCase protected function _createSubscriptionConfig() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $dirs = $objectManager->create( - 'Magento\App\Dir', - array( - 'baseDir' => BP, - 'dirs' => array( - \Magento\App\Dir::MODULES => __DIR__ . '/_files', - \Magento\App\Dir::CONFIG => __DIR__ . '/_files', - ), - ) - ); - $moduleList = $objectManager->create('Magento\App\ModuleList', array( - 'reader' => $objectManager->create('Magento\App\Module\Declaration\Reader\Filesystem', - array( - 'fileResolver' => $objectManager->create( - 'Magento\App\Module\Declaration\FileResolver', - array( - 'applicationDirs' => $dirs - ) - ) - ) + $configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false, false); + $subscriptions = array( + 'subscription_alias' => array( + 'name' => 'Test subscriber', + 'endpoint_url' => 'http://mage.loc/mage-twitter-integration/web/index.php/endpoint', + 'topics' => array( + 'customer' => array( + 'created' => '', + 'updated' => '', + 'deleted' => '', + ), + 'order' => array( + 'created' + ), + ), ), - 'cache' => $this->getMock('Magento\Config\CacheInterface') - )); - - /** @var \Magento\Core\Model\Config\Modules\Reader $moduleReader */ - $moduleReader = $objectManager->create('Magento\Core\Model\Config\Modules\Reader', array( - 'moduleList' => $moduleList - )); - $moduleReader->setModuleDir('Acme_Subscriber', 'etc', __DIR__ . '/_files/Acme/Subscriber/etc'); - - /** @var \Magento\Core\Model\Config\Loader $modulesLoader */ - $modulesLoader = $objectManager->create( - 'Magento\Core\Model\Config\Loader', array( - 'fileReader' => $moduleReader - )); - - $config = new \Magento\Core\Model\Config\Base('<config />'); - $modulesLoader->load($config); - - /** - * Mock is used to disable caching, as far as Integration Tests Framework loads main - * modules configuration first and it gets cached - * - * @var \PHPUnit_Framework_MockObject_MockObject $cache - */ - $cache = $this->getMock('Magento\Core\Model\Config\Cache', - array('load', 'save', 'clean', 'getSection'), - array(), '', false); - - $cache->expects($this->any()) - ->method('load') - ->will($this->returnValue(false)); - - /** @var \Magento\Core\Model\Config\Storage $storage */ - $storage = $objectManager->create( - 'Magento\Core\Model\Config\Storage', array( - 'loader' => $modulesLoader, - 'cache' => $cache - ) ); + $configMock->expects($this->any())->method('getSubscriptions')->will($this->returnValue($subscriptions)); - /** @var \Magento\Core\Model\Config $mageConfig */ - $mageConfig = $objectManager->create('Magento\Core\Model\Config', array( - 'storage' => $storage, - 'moduleReader' => $moduleReader, - 'moduleList' => $moduleList - )); - - /** @var \Magento\Webhook\Model\Subscription\Config $config */ return $objectManager->create('Magento\Webhook\Model\Subscription\Config', array( - 'mageConfig' => $mageConfig + 'config' => $configMock )); } @@ -188,11 +138,16 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->_subscriptions = array(); - /** @var $configModel \Magento\Core\Model\Config */ - $configModel = $objectManager->get('Magento\Core\Model\Config'); - $configModel->setNode('global/webhook/webhooks/listeners/one/label', 'One Listener'); - $configModel->setNode('global/webhook/webhooks/listeners/two/label', 'Two Listeners'); - $configModel->setNode('global/webhook/webhooks/listeners/three/label', 'Three Listeners'); + $configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false, false); + $webHooks = array( + 'listeners' => array( + 'one' => array('label' => 'One Listener'), + 'two' => array('label' => 'Two Listeners'), + 'three' => array('label' => 'Three Listeners'), + ) + ); + $configMock->expects($this->any())->method('getWebhooks')->will($this->returnValue($webHooks)); + $objectManager->addSharedInstance($configMock, 'Magento\Webhook\Model\Config'); /** @var \Magento\Webhook\Model\Subscription $subscription */ $subscription = $objectManager->create('Magento\Webhook\Model\Subscription'); diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/_files/Acme/Subscriber/etc/config.xml b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/_files/Acme/Subscriber/etc/config.xml deleted file mode 100644 index a6f62841d7eec9820be7a20bff7191d96cdfba1e..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/_files/Acme/Subscriber/etc/config.xml +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <global> - <webhook> - <subscriptions> - <subscription_alias> - <name>Test subscriber</name> - <endpoint_url>http://mage.loc/mage-twitter-integration/web/index.php/endpoint</endpoint_url> - <topics> - <customer> - <created/> - <updated/> - <deleted/> - </customer> - <order> - <created/> - </order> - </topics> - </subscription_alias> - </subscriptions> - </webhook> - </global> -</config> diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php index efc370ce964c03b5c16bb84c6356695bf24ca5c1..cf221137e83f6fcc403377dff5f1a70f8892d01c 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php @@ -56,70 +56,30 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $dirs = $this->_objectManager->create( - 'Magento\App\Dir', - array( - 'baseDir' => BP, - 'dirs' => array( - \Magento\App\Dir::MODULES => __DIR__ . '/_files', - \Magento\App\Dir::CONFIG => __DIR__ . '/_files' + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + $configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false, false); + $subscriptions = array( + 'subscription_alias' => array( + 'name' => 'Test subscriber', + 'endpoint_url' => 'http://mage.loc/mage-twitter-integration/web/index.php/endpoint', + 'topics' => array( + 'customer' => array( + 'created' => '', + 'updated' => '', + 'deleted' => '', + ), + 'order' => array( + 'created' + ), ), - ) + ), ); + $configMock->expects($this->any())->method('getSubscriptions')->will($this->returnValue($subscriptions)); - $fileResolver = $this->_objectManager->create( - 'Magento\App\Module\Declaration\FileResolver', array('applicationDirs' => $dirs) - ); - $filesystemReader = $this->_objectManager->create('Magento\App\Module\Declaration\Reader\Filesystem', - array('fileResolver' => $fileResolver) - ); - $moduleList = $this->_objectManager->create( - 'Magento\App\ModuleList', - array('reader' => $filesystemReader, 'cache' => $this->getMock('Magento\Config\CacheInterface')) - ); - - /** - * Mock is used to disable caching, as far as Integration Tests Framework loads main - * modules configuration first and it gets cached - * - * @var \PHPUnit_Framework_MockObject_MockObject $cache - */ - $cache = $this->getMock('Magento\Core\Model\Config\Cache', array('load', 'save', 'clean', 'getSection'), - array(), '', false); - - $cache->expects($this->any()) - ->method('load') - ->will($this->returnValue(false)); - - /** @var \Magento\Core\Model\Config\Modules\Reader $moduleReader */ - $moduleReader = $this->_objectManager->create( - 'Magento\Core\Model\Config\Modules\Reader', array( - 'moduleList' => $moduleList - ) - ); - $moduleReader->setModuleDir('Acme_Subscriber', 'etc', __DIR__ . '/_files/Acme/Subscriber/etc'); - - $loader = $this->_objectManager->create( - 'Magento\Core\Model\Config\Loader', - array('fileReader' => $moduleReader) - ); - /** @var \Magento\Core\Model\Config\Storage $storage */ - $storage = $this->_objectManager->create( - 'Magento\Core\Model\Config\Storage', array( - 'loader' => $loader, - 'cache' => $cache - ) - ); - - $mageConfig = $this->_objectManager->create( - 'Magento\Core\Model\Config', - array('storage' => $storage, 'moduleReader' => $moduleReader) - ); - - /** @var \Magento\Webhook\Model\Subscription\Config $config */ - $this->_config = $this->_objectManager->create('Magento\Webhook\Model\Subscription\Config', - array('mageConfig' => $mageConfig) - ); + $this->_config = $objectManager->create('Magento\Webhook\Model\Subscription\Config', array( + 'config' => $configMock + )); } public function testReadingConfig() diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/_files/Acme/Subscriber/etc/config.xml b/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/_files/Acme/Subscriber/etc/config.xml deleted file mode 100644 index a6f62841d7eec9820be7a20bff7191d96cdfba1e..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/_files/Acme/Subscriber/etc/config.xml +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <global> - <webhook> - <subscriptions> - <subscription_alias> - <name>Test subscriber</name> - <endpoint_url>http://mage.loc/mage-twitter-integration/web/index.php/endpoint</endpoint_url> - <topics> - <customer> - <created/> - <updated/> - <deleted/> - </customer> - <order> - <created/> - </order> - </topics> - </subscription_alias> - </subscriptions> - </webhook> - </global> -</config> diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/SubscriptionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/SubscriptionTest.php index 8969db676ef19ba96f5dcfe619056e3437b819d7..152321cca9b79593016d200215c346f23c06637e 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/SubscriptionTest.php +++ b/dev/tests/integration/testsuite/Magento/Webhook/Model/SubscriptionTest.php @@ -79,10 +79,16 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase $aclCache->clean(); // add new hooks for the tests - /** @var $configModel \Magento\Core\Model\Config */ - $configModel = $this->_objectManager->get('Magento\Core\Model\Config'); - $configModel->setNode('global/webhook/webhooks/test/hook/label', 'Test Hook'); - $configModel->setNode('global/webhook/webhooks/test/two/label', 'Test Hook Two'); + + $configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false, false); + $webHooks = array( + 'test' => array( + 'hook' => array('label' => 'Test Hook'), + 'two' => array('label' => 'Test Hook Two'), + ) + ); + $configMock->expects($this->any())->method('getWebhooks')->will($this->returnValue($webHooks)); + $this->_objectManager->addSharedInstance($configMock, 'Magento\Webhook\Model\Config'); } protected function tearDown() diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php index c697145cb2e65d475fdc570f5e330ed050ea1a35..31f0b44c5d72717028ce1d5c1c7ec29af58f5379 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php @@ -44,11 +44,14 @@ class LayoutTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $layoutUtility = new \Magento\Core\Utility\Layout($this); + $appState = $objectManager->get('Magento\App\State'); + $appState->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $args = array( 'context' => $objectManager->get('Magento\Core\Block\Template\Context'), 'layoutProcessorFactory' => $this->getMock('Magento\View\Layout\ProcessorFactory', array(), array(), '', false), 'themesFactory' => $objectManager->get('Magento\Core\Model\Resource\Theme\CollectionFactory'), + 'appState' => $appState, 'data' => array( 'name' => 'page_type', 'id' => 'page_types_select', diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/LayoutTest.php index 44f9d4479f5fe0e0e60acce748aa7343c3aab182..e527e8dbed56ecad67f14e02f9ca2568f886ab77 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/LayoutTest.php @@ -61,8 +61,9 @@ class LayoutTest extends \PHPUnit_Framework_TestCase */ public function testGetLayoutsChooser() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode(\Magento\Core\Model\App\Area::AREA_FRONTEND); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_FRONTEND) ->setDefaultDesignTheme(); $actualHtml = $this->_block->getLayoutsChooser(); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Controller/Adminhtml/Widget/InstanceTest.php b/dev/tests/integration/testsuite/Magento/Widget/Controller/Adminhtml/Widget/InstanceTest.php index b0d76255a953358cb6249b886791e60d30398c9b..a7f7ad1e36e9400c2b977d12bdacbee5e1a10c63 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Controller/Adminhtml/Widget/InstanceTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Controller/Adminhtml/Widget/InstanceTest.php @@ -52,7 +52,8 @@ class InstanceTest extends \Magento\Backend\Utility\Controller public function testEditAction() { $this->dispatch('backend/admin/widget_instance/edit'); - $this->assertContains('<option value="cms_page_link" selected="selected">', + $this->assertContains( + '<option value="cms_page_link" selected="selected">', $this->getResponse()->getBody() ); } diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php index 6fbf093347585419bb88418af4921f55383857b0..e91dfb2f41bc158a119b6bee76f7213696da7e22 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php @@ -52,31 +52,31 @@ class DataTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\App\Module\Declaration\FileResolver $modulesDeclarations */ + /** @var \Magento\Module\Declaration\FileResolver $modulesDeclarations */ $modulesDeclarations = $objectManager->create( - 'Magento\App\Module\Declaration\FileResolver', array( + 'Magento\Module\Declaration\FileResolver', array( 'applicationDirs' => $dirs, ) ); - /** @var \Magento\App\Module\Declaration\Reader\Filesystem $filesystemReader */ + /** @var \Magento\Module\Declaration\Reader\Filesystem $filesystemReader */ $filesystemReader = $objectManager->create( - 'Magento\App\Module\Declaration\Reader\Filesystem', array( + 'Magento\Module\Declaration\Reader\Filesystem', array( 'fileResolver' => $modulesDeclarations, ) ); - /** @var \Magento\App\ModuleList $modulesList */ + /** @var \Magento\Module\ModuleList $modulesList */ $modulesList = $objectManager->create( - 'Magento\App\ModuleList', array( + 'Magento\Module\ModuleList', array( 'reader' => $filesystemReader, ) ); - /** @var \Magento\Core\Model\Config\Modules\Reader $moduleReader */ + /** @var \Magento\Module\Dir\Reader $moduleReader */ $moduleReader = $objectManager->create( - 'Magento\Core\Model\Config\Modules\Reader', array( + 'Magento\Module\Dir\Reader', array( 'moduleList' => $modulesList ) ); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php index b98cc6e8589ffd15acc3eb710d7a383081ebae12..9cc1bdb8002770fcbd8b3b953b66b2e2677b94fe 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php @@ -41,7 +41,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $moduleListMock = $this->getMockBuilder('Magento\App\ModuleListInterface') + $moduleListMock = $this->getMockBuilder('Magento\Module\ModuleListInterface') ->disableOriginalConstructor() ->getMock(); $moduleListMock->expects($this->any()) @@ -53,7 +53,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase )))); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $moduleReader = $objectManager->create('Magento\Core\Model\Config\Modules\Reader', array( + $moduleReader = $objectManager->create('Magento\Module\Dir\Reader', array( 'moduleList' => $moduleListMock )); $moduleReader->setModuleDir('Magento_Test', 'etc', __DIR__ . '/_files/code/Magento/Test/etc'); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php index 9300eaacf6cb2aa54d346a27c37553447a8e71aa..688480e6f4e02ea0bb7ba811a19667737a84d879 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php @@ -46,31 +46,31 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\App\Module\Declaration\FileResolver $modulesDeclarations */ + /** @var \Magento\Module\Declaration\FileResolver $modulesDeclarations */ $modulesDeclarations = $objectManager->create( - 'Magento\App\Module\Declaration\FileResolver', array( + 'Magento\Module\Declaration\FileResolver', array( 'applicationDirs' => $dirs, ) ); - /** @var \Magento\App\Module\Declaration\Reader\Filesystem $filesystemReader */ + /** @var \Magento\Module\Declaration\Reader\Filesystem $filesystemReader */ $filesystemReader = $objectManager->create( - 'Magento\App\Module\Declaration\Reader\Filesystem', array( + 'Magento\Module\Declaration\Reader\Filesystem', array( 'fileResolver' => $modulesDeclarations, ) ); - /** @var \Magento\App\ModuleList $modulesList */ + /** @var \Magento\Module\ModuleList $modulesList */ $modulesList = $objectManager->create( - 'Magento\App\ModuleList', array( + 'Magento\Module\ModuleList', array( 'reader' => $filesystemReader, ) ); - /** @var \Magento\Core\Model\Config\Modules\Reader $moduleReader */ + /** @var \Magento\Module\Dir\Reader $moduleReader */ $moduleReader = $objectManager->create( - 'Magento\Core\Model\Config\Modules\Reader', array( + 'Magento\Module\Dir\Reader', array( 'moduleList' => $modulesList ) ); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php index 340aa83fa6edfab74860494996b0e881d6d9f4e0..6ab959f223f358a97a646342f6617fb7bee96cd7 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php @@ -46,8 +46,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ public function testGetPluginSettings() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setDesignTheme('magento_basic', 'adminhtml'); + ->setDesignTheme('magento_basic'); $config = new \Magento\Object(); $settings = $this->_model->getPluginSettings($config); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php index 722a91f5ce17bed5a2e4129e188faea52c44b263..a506788d31b5f881ec9c51abe410523909a1025a 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php @@ -48,6 +48,8 @@ class InstanceTest extends \PHPUnit_Framework_TestCase public function testSetThemeId() { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') + ->setAreaCode('frontend'); $theme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\View\DesignInterface') ->setDefaultDesignTheme() @@ -62,6 +64,9 @@ class InstanceTest extends \PHPUnit_Framework_TestCase */ public function testGetWidgetConfigAsArray() { + $this->markTestIncomplete('Functionality is failed because widget' + . ' "app/design/frontend/magento_iphone_html5/etc/widget.xml" replaces' + . ' "new_products" widget in Catalog module'); $config = $this->_model->setType('Magento\Catalog\Block\Product\Widget\NewWidget')->getWidgetConfigAsArray(); $this->assertTrue(is_array($config)); $element = null; @@ -86,6 +91,9 @@ class InstanceTest extends \PHPUnit_Framework_TestCase */ public function testGetWidgetSupportedContainers() { + $this->markTestIncomplete('Functionality is failed because widget' + . ' "app/design/frontend/magento_iphone_html5/etc/widget.xml" replaces' + . ' "new_products" widget in Catalog module'); $this->_model->setType('Magento\Catalog\Block\Product\Widget\NewWidget'); $containers = $this->_model->getWidgetSupportedContainers(); $this->assertInternalType('array', $containers); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php index 27a0209bf7021c350160f5073a4da70be6f3d6ed..c2e4f87bb728203bcfc0a891a608ac42bb6a75a8 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php @@ -62,8 +62,13 @@ class WidgetTest extends \PHPUnit_Framework_TestCase */ public function testGetPlaceholderImageUrl($type, $expectedFile) { + $this->markTestIncomplete('Functionality is failed because widget' + . ' "app/design/frontend/magento_iphone_html5/etc/widget.xml" replaces' + . ' "new_products" widget in Catalog module'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setDesignTheme('magento_basic', 'adminhtml'); + ->setDesignTheme('magento_basic'); $expectedPubFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Dir') ->getDir(\Magento\App\Dir::STATIC_VIEW) . "/adminhtml/magento_basic/en_US/{$expectedFile}"; if (file_exists($expectedPubFile)) { diff --git a/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php b/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php index 1c39d4cb7584ebb9ad65ee57d5e96e6a2ff668ea..fdbf1d76264fedc88fbfa67f601bd4c9a05ad9dd 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadAreaPart(\Magento\Core\Model\App\Area::AREA_ADMINHTML, \Magento\Core\Model\App\Area::PART_CONFIG); + ->loadAreaPart(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, \Magento\Core\Model\App\Area::PART_CONFIG); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Registration'); diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php index 478e5d8528872aecee8259bb257818f420f97d30..26a9b1a7a6d6e465d73da81889fcb96f3010bc67 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php @@ -58,9 +58,8 @@ class AbstractTest extends \PHPUnit_Framework_TestCase public function testImage() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setArea(\Magento\Core\Model\App\Area::AREA_FRONTEND) ->setDefaultDesignTheme(); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Product'); diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php index 9199b90cd5e820b69fd67e9ea6830a8eff5ac7c9..cf5211844e2840e89cf3020b564d2be86799335b 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php @@ -37,7 +37,7 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractController protected function setUp() { parent::setUp(); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $this->_customerSession = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Customer\Model\Session', array($logger)); $this->_customerSession->login('customer@example.com', 'password'); diff --git a/dev/tests/performance/framework/Magento/TestFramework/Application.php b/dev/tests/performance/framework/Magento/TestFramework/Application.php index 4a4cfdbfb3703ea523cce8640ce7260bbbadca02..ff1421c248c2ce16af327335bde2f1dd7bf9f150 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Application.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Application.php @@ -191,9 +191,7 @@ class Application protected function _bootstrap() { if (!$this->_objectManager) { - $this->_objectManager = new \Magento\Core\Model\ObjectManager( - new \Magento\Core\Model\Config\Primary(BP, $_SERVER) - ); + $this->_objectManager = new \Magento\App\ObjectManager(BP, $_SERVER); } /** @var $app \Magento\Core\Model\App */ $this->_objectManager->get('Magento\Core\Model\App'); diff --git a/dev/tests/performance/testsuite/fixtures/shipping_flatrate_enabled.php b/dev/tests/performance/testsuite/fixtures/shipping_flatrate_enabled.php index d3d448ee95d62fe5fd93dcc292ff0afb8ffb904d..f73c7df31729e07bc5fb3520a3c4bf7bd54cc77b 100644 --- a/dev/tests/performance/testsuite/fixtures/shipping_flatrate_enabled.php +++ b/dev/tests/performance/testsuite/fixtures/shipping_flatrate_enabled.php @@ -34,5 +34,5 @@ $configData->setPath('carriers/flatrate/active') ->setValue(1) ->save(); -$this->getObjectManager()->get('Magento\Core\Model\CacheInterface') +$this->getObjectManager()->get('Magento\App\CacheInterface') ->clean(array(\Magento\Core\Model\Config::CACHE_TAG)); diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php index 9bc46795755d60a9cfe4c3a0a16e1a00353257c4..a248feff7bb9e3a688e0cd37e38eb304d422fb0c 100644 --- a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php +++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php @@ -92,7 +92,7 @@ class CodeMessDetector $command = new \PHP_PMD_TextUI_Command(); - return $command->run($options); + return $command->run($options, new \PHP_PMD_RuleSetFactory()); } } diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php index 3158e3c69d380621ac7d980f4b96fd70397cc8af..17ab0a22cf728a6f7ce68ae1a569f7c412624de2 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/Files.php @@ -536,11 +536,20 @@ class Files * Look for DI config through the system * @return array */ - public function getDiConfigs() + public function getDiConfigs($asDataSet = false) { $primaryConfigs = glob($this->_path . '/app/etc/{di.xml,*/di.xml}', GLOB_BRACE); $moduleConfigs = glob($this->_path . '/app/code/*/*/etc/{di,*/di}.xml', GLOB_BRACE); $configs = array_merge($primaryConfigs, $moduleConfigs); + + if ($asDataSet) { + $output = array(); + foreach ($configs as $file) { + $output[$file] = array($file); + } + + return $output; + } return $configs; } @@ -565,7 +574,7 @@ class Files '/dev/tests/api-functional/framework/', '/dev/tests/integration/framework/', '/dev/tests/integration/framework/tests/unit/testsuite/', '/dev/tests/integration/testsuite/', '/dev/tests/integration/testsuite/Magento/Test/Integrity/', '/dev/tests/performance/framework/', - '/dev/tests/static/framework/', '/dev/tests/static/testsuite/', + '/dev/tests/static/framework/', '/dev/tests/static/testsuite/', '/dev/tests/functional/tests/app/', '/dev/tests/unit/framework/', '/dev/tests/unit/testsuite/', ); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Compiler/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Compiler/CompilerTest.php deleted file mode 100644 index 7aa4a3d3e9c89786c307b5e9b08062ea3498cfda..0000000000000000000000000000000000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Compiler/CompilerTest.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php -/** - * Compiler test. Check compilation of DI definitions and code generation - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Test\Integrity\Compiler; - -class CompilerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var string - */ - protected $_command; - - /** - * @var \Magento\Shell - */ - protected $_shell; - - /** - * @var string - */ - protected $_generationDir; - - /** - * @var string - */ - protected $_compilationDir; - - /** - * @var string - */ - protected $_tmpDir; - - protected function setUp() - { - $this->_shell = new \Magento\Shell(); - $basePath = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); - $basePath = str_replace(DIRECTORY_SEPARATOR, '/', $basePath); - $this->_tmpDir = realpath(__DIR__) . '/tmp'; - $this->_generationDir = $this->_tmpDir . '/generation'; - $this->_compilationDir = $this->_tmpDir . '/di'; - $this->_command = 'php ' . $basePath - . '/dev/tools/Magento/Tools/Di/compiler.php --l=%s --generation=%s --di=%s --v'; - } - - protected function tearDown() - { - $filesystem = new \Magento\Filesystem\Adapter\Local(); - $filesystem->delete($this->_tmpDir); - } - - public function testCompiler() - { - try { - $output = $this->_shell->execute( - $this->_command, - array('error', $this->_generationDir, $this->_compilationDir) - ); - $this->assertEmpty($output, $output); - } catch (\Magento\Exception $exception) { - $this->fail($exception->getPrevious()->getMessage()); - } - } -} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4adc0eca3525c6458d5b0117eed0f6b4960d3490 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php @@ -0,0 +1,239 @@ +<?php +/** + * Compiler test. Check compilation of DI definitions and code generation + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Test\Integrity\Di; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class CompilerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var string + */ + protected $_command; + + /** + * @var \Magento\Shell + */ + protected $_shell; + + /** + * @var string + */ + protected $_generationDir; + + /** + * @var string + */ + protected $_compilationDir; + + /** + * @var string + */ + protected $_tmpDir; + + /** + * @var \Magento\ObjectManager\Config\Mapper\Dom() + */ + protected $_mapper; + + /** + * @var \Magento\Code\Validator\ConstructorIntegrity + */ + protected $_validator; + + protected function setUp() + { + $this->_shell = new \Magento\Shell(); + $basePath = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); + $basePath = str_replace(DIRECTORY_SEPARATOR, '/', $basePath); + + $this->_tmpDir = realpath(__DIR__) . '/tmp'; + $this->_generationDir = $this->_tmpDir . '/generation'; + $this->_compilationDir = $this->_tmpDir . '/di'; + + \Magento\Autoload\IncludePath::addIncludePath(array( + $basePath . '/app/code', + $basePath . '/lib', + $this->_generationDir, + )); + + $this->_command = 'php ' . $basePath + . '/dev/tools/Magento/Tools/Di/compiler.php --generation=%s --di=%s'; + $this->_mapper = new \Magento\ObjectManager\Config\Mapper\Dom(); + $this->_validator = new \Magento\Code\Validator\ConstructorIntegrity(); + } + + protected function tearDown() + { + $filesystem = new \Magento\Filesystem\Adapter\Local(); + $filesystem->delete($this->_tmpDir); + } + + /** + * Validate DI config file + * + * @param string $file + */ + protected function _validateFile($file) + { + $dom = new \DOMDocument(); + $dom->load($file); + $data = $this->_mapper->convert($dom); + + foreach ($data as $instanceName => $parameters) { + if (!isset($parameters['parameters']) || empty($parameters['parameters'])) { + continue; + } + if (\Magento\TestFramework\Utility\Classes::isVirtual($instanceName)) { + $instanceName = \Magento\TestFramework\Utility\Classes::resolveVirtualType($instanceName); + } + $parameters = $parameters['parameters']; + if (!class_exists($instanceName)) { + $this->fail('Detected configuration of non existed class: ' . $instanceName); + } + + $reflectionClass = new \ReflectionClass($instanceName); + + $constructor = $reflectionClass->getConstructor(); + if (!$constructor) { + $this->fail('Class ' . $instanceName . ' does not have __constructor'); + } + + $classParameters = $constructor->getParameters(); + foreach ($classParameters as $classParameter) { + $parameterName = $classParameter->getName(); + if (array_key_exists($parameterName, $parameters)) { + unset($parameters[$parameterName]); + } + } + $message = 'Configuration of ' . $instanceName + . ' contains data for non-existed parameters: ' . implode(', ', array_keys($parameters)); + $this->assertEmpty($parameters, $message); + } + } + + /** + * Get php classes list + * + * @return array + */ + protected function _phpClassesDataProvider() + { + $basePath = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); + + $basePath = str_replace('/', '\\', $basePath); + $libPath = $basePath . '\\lib'; + $appPath = $basePath . '\\app\\code'; + $generationPathPath = str_replace('/', '\\', $this->_generationDir); + + $files = \Magento\TestFramework\Utility\Files::init()->getClassFiles( + true, false, false, false, false, true, false + ); + + $patterns = array( + '/' . preg_quote($libPath) . '/', + '/' . preg_quote($appPath) . '/', + '/' . preg_quote($generationPathPath) . '/' + ); + $replacements = array('', '', ''); + + $classes = array(); + foreach ($files as $file) { + $file = str_replace('/', '\\', $file); + $filePath = preg_replace($patterns, $replacements, $file); + $className = substr($filePath, 0, -4); + if (class_exists($className)) { + $classes[$file] = array($className); + } + } + return $classes; + } + + /** + * Validate class + * + * @param string $className + */ + protected function _validateClass($className) + { + try { + $this->_validator->validate($className); + } catch (\Magento\Code\ValidationException $exceptions) { + $this->fail($exceptions->getMessage()); + } catch (\ReflectionException $exceptions) { + $this->fail($exceptions->getMessage()); + } + } + + public function testConfigurationOfInstanceParameters() + { + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $file + */ + function ($file) { + $this->_validateFile($file); + }, + \Magento\TestFramework\Utility\Files::init()->getDiConfigs(true) + ); + } + + public function testConstructorIntegrity() + { + $autoloader = new \Magento\Autoload\IncludePath(); + $generatorIo = new \Magento\Code\Generator\Io(new \Magento\Io\File(), $autoloader, $this->_generationDir); + $generator = new \Magento\Code\Generator(null, $autoloader, $generatorIo); + $autoloader = new \Magento\Code\Generator\Autoloader($generator); + spl_autoload_register(array($autoloader, 'load')); + + $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); + $invoker( + function ($className) { + $this->_validateClass($className); + }, + $this->_phpClassesDataProvider() + ); + spl_autoload_unregister(array($autoloader, 'load')); + } + + /** + * @depends testConfigurationOfInstanceParameters + * @depends testConstructorIntegrity + */ + public function testCompiler() + { + try { + $this->_shell->execute( + $this->_command, + array($this->_generationDir, $this->_compilationDir) + ); + } catch (\Magento\Exception $exception) { + $this->fail($exception->getPrevious()->getMessage()); + } + } +} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/ConfigurationTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/ConfigurationTest.php deleted file mode 100644 index 9be734c294c224d6ca992dbcfdc21a34302203b8..0000000000000000000000000000000000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/ConfigurationTest.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php -/** - * DI configuration test. Checks configuration of types and virtual types parameters - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Test\Integrity\Di; - -class ConfigurationTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\ObjectManager\Config\Mapper\Dom() - */ - protected $_mapper; - - protected function setUp() - { - $basePath = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); - \Magento\Autoload\IncludePath::addIncludePath(array( - $basePath . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'code', - $basePath . DIRECTORY_SEPARATOR . 'lib', - )); - $this->_mapper = new \Magento\ObjectManager\Config\Mapper\Dom(); - - } - - /** - * @dataProvider configFilesDataProvider - */ - public function testConfigurationOfInstanceParameters($file) - { - $dom = new \DOMDocument(); - $dom->load($file); - $data = $this->_mapper->convert($dom); - - foreach ($data as $instanceName => $parameters) { - if (!isset($parameters['parameters']) || empty($parameters['parameters'])) { - continue; - } - - if (\Magento\TestFramework\Utility\Classes::isVirtual($instanceName)) { - $instanceName = \Magento\TestFramework\Utility\Classes::resolveVirtualType($instanceName); - } - $parameters = $parameters['parameters']; - - if (!class_exists($instanceName)) { - $this->fail('Non existed class: ' . $instanceName); - } - - $reflectionClass = new \ReflectionClass($instanceName); - - $constructor = $reflectionClass->getConstructor(); - if (!$constructor) { - $this->fail('Class ' . $instanceName . ' does not have __constructor'); - } - - $classParameters = $constructor->getParameters(); - foreach ($classParameters as $classParameter) { - $parameterName = $classParameter->getName(); - if (array_key_exists($parameterName, $parameters)) { - unset($parameters[$parameterName]); - } - } - $this->assertEmpty($parameters, - 'Configuration of ' . $instanceName - . ' contains data for non-existed parameters: ' . implode(', ', array_keys($parameters)) - . ' in file: ' . $file - ); - } - } - - /** - * @return array - */ - public function configFilesDataProvider() - { - $output = array(); - $files = \Magento\TestFramework\Utility\Files::init()->getDiConfigs(); - foreach ($files as $file) { - $output[$file] = array($file); - } - return $output; - } -} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Page/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Page/ConfigTest.php index edf503af4fc8d583a5c9d2a7862447d266352e13..48295e9ff324f0a6d797bcbb5d14ed8146ead467 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Page/ConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Page/ConfigTest.php @@ -30,13 +30,13 @@ namespace Magento\Test\Integrity\Magento\Page; class ConfigTest extends \Magento\TestFramework\Integrity\AbstractConfig { - public function testFileSchemaUsingInvalidXml() + public function testFileSchemaUsingInvalidXml($expectedErrors = null) { $expectedErrors = array("Element 'layout': The attribute 'id' is required but missing."); parent::testFileSchemaUsingInvalidXml($expectedErrors); } - public function testSchemaUsingInvalidXml() + public function testSchemaUsingInvalidXml($expectedErrors = null) { $expectedErrors = array( "Element 'layouts': No match found for key-sequence ['bad_ref'] of keyref 'layout-ref'.", @@ -45,7 +45,7 @@ class ConfigTest extends \Magento\TestFramework\Integrity\AbstractConfig parent::testSchemaUsingInvalidXml($expectedErrors); } - public function testSchemaUsingPartialXml() + public function testSchemaUsingPartialXml($expectedErrors = null) { $expectedErrors = array( "Element 'layout': Missing child element(s). Expected is ( label ).", diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/ConfigTest.php index 50c27218ec0f1710ce3f0ded076c77032b00e5a6..25cc5d5e82906a2b9638191fdf2b1bf9b3bffae0 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/ConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/ConfigTest.php @@ -28,7 +28,7 @@ namespace Magento\Test\Integrity\Magento\Payment\Model; class ConfigTest extends \Magento\TestFramework\Integrity\AbstractConfig { - public function testSchemaUsingInvalidXml() + public function testSchemaUsingInvalidXml($expectedErrors = null) { $expectedErrors = array( "Element 'type': The attribute 'id' is required but missing.", @@ -39,7 +39,7 @@ class ConfigTest extends \Magento\TestFramework\Integrity\AbstractConfig parent::testSchemaUsingInvalidXml($expectedErrors); } - public function testFileSchemaUsingInvalidXml() + public function testFileSchemaUsingInvalidXml($expectedErrors = null) { $expectedErrors = array( "Element 'type': The attribute 'id' is required but missing.", @@ -49,7 +49,7 @@ class ConfigTest extends \Magento\TestFramework\Integrity\AbstractConfig parent::testFileSchemaUsingInvalidXml($expectedErrors); } - public function testSchemaUsingPartialXml() + public function testSchemaUsingPartialXml($expectedErrors = null) { $expectedErrors = array( "Element 'type': The attribute 'order' is required but missing.", diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/ConfigTest.php index b3aa707eedb883d18faf1188d7a969952dda3c6d..507c365709b5678a01257de40d3628c2cd674c2c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/ConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/ConfigTest.php @@ -101,12 +101,12 @@ class ConfigTest extends \Magento\TestFramework\Integrity\AbstractConfig return 'persistent.xml'; } - public function testFileSchemaUsingInvalidXml() + public function testFileSchemaUsingInvalidXml($expectedErrors = null) { $this->markTestSkipped('persistent.xml does not have a partial schema'); } - public function testSchemaUsingPartialXml() + public function testSchemaUsingPartialXml($expectedErrors = null) { $this->markTestSkipped('persistent.xml does not have a partial schema'); } @@ -116,7 +116,7 @@ class ConfigTest extends \Magento\TestFramework\Integrity\AbstractConfig $this->markTestSkipped('persistent.xml does not have a partial schema'); } - public function testSchemaUsingInvalidXml() + public function testSchemaUsingInvalidXml($expectedErrors = null) { $expectedErrors = array( "Element 'welcome': This element is not expected.", diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/JsTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/JsTest.php index a5bc126d36e82c2eca961878827dce42e2b03448..50bccdf3dd85af921afcd3abadd7cb95ef154d83 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/JsTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/JsTest.php @@ -60,7 +60,7 @@ class JsTest extends \Magento\Test\Integrity\Phrase\AbstractTestCase $registeredPhrases = $this->_getRegisteredPhrases(); - foreach ($this->_getJavascriptPhrases('adminhtml') as $phrase) { + foreach ($this->_getJavascriptPhrases(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) as $phrase) { if (!in_array($phrase['phrase'], $registeredPhrases)) { $unregisteredMessages[] = sprintf("'%s' \n in file %s, line# %s", $phrase['phrase'], $phrase['file'], $phrase['line']); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/adminhtml_decoupling.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/adminhtml_decoupling.php index 472e37de550ff593d0f44cd937324f0d98d8d78c..26896dc7bc217e4f6c7220346ca7dc1feb6e83ff 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/adminhtml_decoupling.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/adminhtml_decoupling.php @@ -30,37 +30,23 @@ return array( 'Block/Admin', 'Block/Backup', 'Block/Cache', - 'Block/Checkout', - 'Block/Cms', - 'Block/Customer', - 'Block/Dashboard', 'Block/Denied', 'Block/Html', 'Block/Media', 'Block/Messages', 'Block/Newsletter', 'Block/Page', - 'Block/Promo', - 'Block/Rating', 'Block/Report', 'Block/Review', 'Block/Shipping', 'Block/Sitemap', - 'Block/System', 'Block/Template', 'Block/Text', 'Block/Urlrewrite', 'Block/Widget', // Controllers - 'Controller/Checkout', - 'Controller/Cms', - 'Controller/Customer', 'Controller/Newsletter', - 'Controller/Promo', - 'Controller/Report', - 'Controller/System', - 'Controller/Promo', 'Controller/Report', 'Controller/Urlrewrite', @@ -71,7 +57,6 @@ return array( 'Helper/Js', // Models - 'Model/Customer', 'Model/Email', 'Model/Giftmessage', 'Model/LayoutUpdate', @@ -84,33 +69,23 @@ return array( // Views 'view/adminhtml/admin', 'view/adminhtml/backup', - 'view/adminhtml/cms', - 'view/adminhtml/customer', 'view/adminhtml/email', 'view/adminhtml/images', 'view/adminhtml/media', 'view/adminhtml/newsletter', 'view/adminhtml/page', - 'view/adminhtml/promo', 'view/adminhtml/report', 'view/adminhtml/review', 'view/adminhtml/store', - 'view/adminhtml/system', 'view/adminhtml/urlrewrite', 'view/adminhtml/widget', - 'view/adminhtml/validation-rules.js', - 'view/adminhtml/variables.js', // Layouts 'layout/adminhtml_cache', - 'layout/adminhtml_cms', - 'layout/adminhtml_customer', 'layout/adminhtml_denied', 'layout/adminhtml_newsletter', 'layout/adminhtml_noroute', - 'layout/adminhtml_promo', 'layout/adminhtml_report', - 'layout/adminhtml_system', 'layout/adminhtml_urlrewrite', 'layout/default', 'layout/editor', @@ -121,5 +96,4 @@ return array( 'layout/popup', 'layout/preview', 'layout/report_sales', - 'layout/systemPreview', -); \ No newline at end of file +); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt index 8991e35d1b3ce5ea6b2cddded724042fcfcff21b..37dfcfb185141554f373b1d63d27fa0c8cbf227f 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt @@ -1,5 +1,15 @@ dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Model/Test.php dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Helper/Test.php +dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Element.php +dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/ElementFactory.php +dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Proxy.php +dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/ElementFactory.php +dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/One/Test.php +dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Two/Test.php +dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Three/Test.php +dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Five/Test.php +dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Four/Test.php +dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Six/Test.php dev/tools/Magento/Tools/I18n/Zend/Exception.php dev/tools/Magento/Tools/I18n/Zend/Console/Getopt/Exception.php dev/tools/Magento/Tools/I18n/Zend/Console/Getopt.php diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt index cfcaf9992efa38139a7fddf6c7f1107929e9652a..b6d8747db510c129548cb25ccc90142e3d6f3b2b 100644 --- a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt +++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt @@ -12,7 +12,7 @@ app/code/Magento/Captcha/view/frontend/onepage.js app/code/Magento/Catalog/view/adminhtml/catalog/category/edit.js app/code/Magento/Catalog/view/adminhtml/catalog/product/composite/configure.js app/code/Magento/Catalog/view/adminhtml/catalog/product.js -app/code/Magento/Adminhtml/view/adminhtml/promo/rules.js +app/code/Magento/Adminhtml/view/adminhtml/rules.js app/code/Magento/Sales/view/adminhtml/order/create/giftmessage.js app/code/Magento/Sales/view/adminhtml/order/create/scripts.js app/code/Magento/Sales/view/adminhtml/order/giftoptions_tooltip.js diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php index 52dd0f986c9429cd531b322de1161904a6d9db91..96e1fba1d74efd48b7d50613dcb202d8211396fc 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php @@ -108,6 +108,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase $layoutXml = simplexml_load_file($layoutFile); $this->_testObsoleteReferences($layoutXml); + $this->_testObsoleteAttributes($layoutXml); $selectorHeadBlock = '(name()="block" or name()="referenceBlock") and ' . '(@name="head" or @name="convert_root_head" or @name="vde_head")'; @@ -170,6 +171,34 @@ class LayoutTest extends \PHPUnit_Framework_TestCase } } + /** + * Tests the attributes of the top-level Layout Node. + * Verifies there are no longer attributes of "parent" or "owner" + * + * @param SimpleXMLElement $layoutXml + */ + protected function _testObsoleteAttributes($layoutXml) + { + $issues = array(); + $type = $layoutXml['type']; + $parent = $layoutXml['parent']; + $owner = $layoutXml['owner']; + + if ((string)$type === 'page') { + if ($parent) { + $issues[] = 'Attribute "parent" is not valid'; + } + } + if ((string)$type === 'fragment') { + if ($owner) { + $issues[] = 'Attribute "owner" is not valid'; + } + } + if ($issues) { + $this->fail("Issues found in handle declaration:\n" . implode("\n", $issues) . "\n"); + } + } + public function testActionNodeMethods() { $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php index c7f028459d513d69484c6cb09cefb97275dbf19e..ed833af0a5d6fc07964fa0042977596264a8169d 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php @@ -258,8 +258,16 @@ class ObsoleteCodeTest extends \PHPUnit_Framework_TestCase "Function or method '{$method}()' is obsolete in file '{$file}'.", $replacement ); - $this->_assertNotRegExp('/function\s*' . $quotedMethod . '\s*\(/iS', $content, $message); - $this->_assertNotRegExp('/[^a-z\d_]' . $quotedMethod . '\s*\(/iS', $content, $message); + $this->_assertNotRegExp( + '/(?<!public|protected|private|static)\s+function\s*' . $quotedMethod . '\s*\(/iS', + $content, + $message + ); + $this->_assertNotRegExp( + '/(?<![a-z\d_:]|->|function\s)' . $quotedMethod . '\s*\(/iS', + $content, + $message + ); } } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index e3dbeedaaa5a9223dd7a87d8beb8daadb534dfc8..6ef10a4a6195901f80b6e8c680a0cc8266b39ce8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -585,7 +585,7 @@ return array( array('Mage_Core_Block_Template_Facade'), array('Mage_Core_Block_Template_Smarty'), array('Mage_Core_Block_Template_Zend'), - array('Mage_Core_Controller_Magento_Router_Admin', 'Magento\Backend\Controller\Router\DefaultRouter'), + array('Mage_Core_Controller_Magento_Router_Admin', 'Magento\Backend\App\Router\DefaultRouter'), array('Mage_Core_Model_Convert'), array('Mage_Core_Model_Config_Fieldset', 'Magento\Core\Model\Fieldset\Config'), array('Mage_Core_Model_Config_Options', 'Magento\App\Dir'), @@ -978,8 +978,10 @@ return array( array('Mage_Sales_Model_Order_Creditmemo_Api_V2'), array('Mage_Sales_Model_Order_Creditmemo_Api'), array('Magento\ImportExport\Model\Config'), + array('Magento\Install\Model\EntryPoint\Console', 'Magento\Install\App\Console'), + array('Magento\Install\Model\EntryPoint\Output', 'Magento\Install\App\Output'), array('Magento\Data\Collection\Factory', 'Magento\Data\CollectionFactory'), - array('Magento\Adminhtml\Block\Customer\System\Config\ValidatevatFactory'), + array('Magento\Customer\Block\Adminhtml\System\Config\ValidatevatFactory'), array('Magento\Customer\Model\Attribute\Data'), array('Magento\Eav\Model\Attribute\Data'), array('Magento\Log\Model\Resource\Helper\Mysql4', 'Magento\Log\Model\Resource\Helper'), @@ -991,8 +993,11 @@ return array( array('Magento\Core\Model\Resource\Helper\Mysql4', 'Magento\Core\Model\Resource\Helper'), array('Magento\Catalog\Model\Resource\Helper\Mysql4', 'Magento\Catalog\Model\Resource\Helper'), array('Magento\Eav\Model\Resource\Helper\Mysql4', 'Magento\Eav\Model\Resource\Helper'), - array('Magento\Eav\Model\Entity\Attribute\Backend\Array', 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend'), - array('Magento\Sales\Model\Resource\Helper\HelperInterface', 'Magento\Sales\Model\Resource\HelperInterface'), + array( + 'Magento\Eav\Model\Entity\Attribute\Backend\Array', + 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend'), + array('Magento\Sales\Model\Resource\Helper\HelperInterface', 'Magento\Sales\Model\Resource\HelperInterface' + ), array('Magento\Reports\Model\Resource\Helper\HelperInterface', 'Magento\Reports\Model\Resource\HelperInterface'), array('Magento\Poll\Block\ActivePoll'), array('Magento\Poll\Controller\Vote'), @@ -1005,43 +1010,77 @@ return array( array('Magento\Poll\Model\Resource\Poll\Answer\Collection'), array('Magento\Poll\Model\Resource\Poll\Collection'), array('Magento\Poll\Model\Resource\Poll\Vote'), - array('Magento\Backup', 'Magento\Backup\Factory'), - array('Magento\Core\Controller\Front\Router', 'Magento\Core\Controller\Request\HttpProxy'), - array('Magento\Core\Controller\Response\Http', 'Magento\Core\Controller\Varien\Action\Forward'), - array('Magento\Core\Controller\Varien\Action\Redirect', 'Magento\Core\Controller\Varien\DispatchableInterface'), - array('Magento\Core\Controller\Varien\Front'), - array('Magento\Core\Controller\FrontInterface', 'Magento\Core\Model\App\Handler'), - array('Magento\Core\Model\App\Proxy', 'Magento\Core\Model\Event\Config\SchemaLocator'), - array('Magento\Core\Controller\Varien\Router\AbstractRouter', 'Magento\Core\Controller\Varien\AbstractAction'), - array('Magento\Core\Controller\Varien\Exception', 'Magento\HTTP\HandlerFactory'), - array('Magento\Core\Controller\Request\Http', 'Magento\Core\Controller\Varien\Router\AbstractRouter'), - array('Magento\Core\Controller\Varien\Router\DefaultRouter', 'Magento\Core\Model\NoRouteHandlerList'), - array('Magento\Core\Controller\Varien\Action\Factory', 'Magento\Core\Model\Dir'), - array('Magento\Core\Model\ModuleList', 'Magento\Core\Model\ModuleListInterface'), - array('Magento\Core\Model\RouterList', 'Magento\Core\Model\App\State'), - array('Magento\Core\Model\Event\Config\Converter', 'Magento\Core\Model\Event\Config\Data'), - array('Magento\Core\Model\Event\Config\Reader', 'Magento\Core\Model\Event\Invoker\InvokerDefault'), - array('Magento\Core\Model\Event\Config', 'Magento\Core\Model\Event\ConfigInterface'), - array('Magento\Core\Model\Event\InvokerInterface', 'Magento\Core\Model\Event\Manager'), - array('Magento\HTTP\Handler\Composite', 'Magento\HTTP\HandlerInterface'), - array('Magento\Backend\Model\Request\PathInfoProcessor', 'Magento\Backend\Model\Router\NoRouteHandler'), - array('Magento\Core\Model\Request\PathInfoProcessor', 'Magento\Core\Model\Request\RewriteService'), - array('Magento\Core\Model\Router\NoRouteHandler', 'Magento\Core\Model\Resource\SetupFactory'), - array('Magento\Core\Model\Dir\Verification', 'Magento\Core\Model\Module\Declaration\Converter\Dom'), - array('Magento\Core\Model\Module\Declaration\Reader\Filesystem', 'Magento\Core\Model\Module\Dir'), - array('Magento\Core\Model\Module\Declaration\FileResolver', 'Magento\Core\Model\Module\Declaration\SchemaLocator'), - array('Magento\Core\Model\Module\Dir\ReverseResolver', 'Magento\Core\Model\Module\ResourceResolver'), - array('Magento\Core\Model\Module\ResourceResolverInterface', 'Magento\Core\Model\Resource\SetupInterface'), - array('Magento\Core\Model\Db\UpdaterInterface', 'Magento\Core\Model\Router\NoRouteHandlerInterface'), - array('Magento\Core\Model\Router\NoRouteHandlerInterface', 'Magento\Core\Model\UrlInterface'), + array('Magento\Backup'), + array('Magento\Core\Controller\Front\Router'), + array('Magento\Core\Controller\Request\HttpProxy'), + array('Magento\Core\Controller\Response\Http', 'Magento\App\Response\Http'), + array('Magento\Core\Controller\Varien\Action\Forward', 'Magento\App\Action\Forward'), + array('Magento\Core\Controller\Varien\Action\Redirect', 'Magento\App\Action\Redirect'), + array('Magento\Core\Controller\Varien\DispatchableInterface'), + array('Magento\Core\Controller\Varien\Front', 'Magento\App\FrontController'), + array('Magento\Core\Controller\FrontInterface', 'Magento\App\FrontControllerInterface'), + array('Magento\Core\Model\App\Handler'), + array('Magento\Core\Model\App\Proxy'), + array('Magento\Core\Model\Event\Config\SchemaLocator', 'Magento\Event\Config\SchemaLocator'), + array('Magento\Core\Controller\Varien\Router\AbstractRouter'), + array('Magento\Core\Controller\Varien\AbstractAction'), + array('Magento\Core\Controller\Varien\Exception'), + array('Magento\HTTP\HandlerFactory'), + array('Magento\Core\Controller\Request\Http'), + array('Magento\Core\Controller\Varien\Router\DefaultRouter'), + array('Magento\Core\Model\NoRouteHandlerList'), + array('Magento\Core\Controller\Varien\Action\Factory'), + array('Magento\Core\Model\Config\Loader\Primary'), + array('Magento\Core\Model\Config\AbstractStorage'), + array('Magento\Core\Model\Config\Loader'), + array('Magento\Core\Model\Config\LoaderInterface'), + array('Magento\Core\Model\Config\Primary'), + array('Magento\Core\Model\Config\Storage'), + array('Magento\Core\Model\Config\StorageInterface'), + array('Magento\Core\Model\Dir'), + array('Magento\Core\Model\ModuleList'), + array('Magento\Core\Model\ModuleListInterface'), + array('Magento\Core\Model\RouterList'), + array('Magento\Core\Model\App\State'), + array('Magento\Core\Model\Event\Config\Converter'), + array('Magento\Core\Model\Event\Config\Data'), + array('Magento\Core\Model\Event\Config\Reader'), + array('Magento\Core\Model\Event\Invoker\InvokerDefault'), + array('Magento\Core\Model\Event\Config'), + array('Magento\Core\Model\Event\ConfigInterface'), + array('Magento\Core\Model\Event\InvokerInterface'), + array('Magento\Core\Model\Event\Manager'), + array('Magento\HTTP\Handler\Composite'), + array('Magento\HTTP\HandlerInterface'), + array('Magento\Backend\Model\Request\PathInfoProcessor'), + array('Magento\Backend\Model\Router\NoRouteHandler'), + array('Magento\Core\Model\Request\PathInfoProcessor'), + array('Magento\Core\Model\Request\RewriteService'), + array('Magento\Core\Model\Router\NoRouteHandler'), + array('Magento\Core\Model\Resource\SetupFactory'), + array('Magento\Core\Model\Dir\Verification'), + array('Magento\Core\Model\Module\Declaration\Converter\Dom'), + array('Magento\Core\Model\Module\Declaration\Reader\Filesystem'), + array('Magento\Core\Model\Module\Dir'), + array('Magento\Core\Model\Module\Declaration\FileResolver'), + array('Magento\Core\Model\Module\Declaration\SchemaLocator'), + array('Magento\Core\Model\Module\Dir\ReverseResolver'), + array('Magento\Core\Model\Module\ResourceResolver'), + array('Magento\Core\Model\Module\ResourceResolverInterface'), + array('Magento\Core\Model\Resource\SetupInterface'), + array('Magento\Core\Model\Db\UpdaterInterface'), + array('Magento\Core\Model\Router\NoRouteHandlerInterface'), + array('Magento\Core\Model\UrlInterface'), array('Magento\Sales\Model\Resource\Order\Attribute\Backend\Parent'), array('Magento\Sales\Model\Resource\Order\Creditmemo\Attribute\Backend\Parent'), array('Magento\Sales\Model\Resource\Order\Invoice\Attribute\Backend\Parent'), array('Magento\Sales\Model\Resource\Order\Shipment\Attribute\Backend\Parent'), array('Magento\Sales\Model\Resource\Quote\Address\Attribute\Backend\Parent'), + array('Magento\Core\Helper\Http'), array('Magento\Core\Model\ThemeInterface', 'Magento\View\Design\ThemeInterface'), array('Magento\Core\Model\View\DesignInterface', 'Magento\View\DesignInterface'), array('Magento\Core\Model\Layout\Element', 'Magento\View\Layout\Element'), + array('Magento\Core\Helper\Hint', 'Magento\Backend\Block\Store\Switcher'), array('Magento\Core\Model\Design\Fallback\Rule\ModularSwitch', 'Magento\View\Design\Fallback\Rule\ModularSwitch'), array('Magento\Core\Model\Design\Fallback\Rule\RuleInterface', 'Magento\View\Design\Fallback\Rule\RuleInterface'), array('Magento\Core\Model\Design\Fallback\Rule\Simple', 'Magento\View\Design\Fallback\Rule\Simple'), @@ -1084,4 +1123,301 @@ return array( array('Magento\Media\Model\File\Image'), array('Magento\Media\Model\Image'), array('Magento\Media\Helper\Data'), + array( + 'Magento\Adminhtml\Block\Promo\Catalog\Edit\Form', + 'Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Form' + ), + array( + 'Magento\Adminhtml\Block\Promo\Catalog\Edit\Js', + 'Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Js'), + array( + 'Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab\Actions', + 'Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Actions' + ), + array( + 'Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab\Conditions', + 'Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Conditions' + ), + array( + 'Magento\Adminhtml\Block\Promo\Catalog\Edit\Tab\Main', + 'Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Main' + ), + array( + 'Magento\Adminhtml\Block\Promo\Catalog\Edit\Tabs', + 'Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tabs' + ), + array( + 'Magento\Adminhtml\Block\Promo\Catalog\Edit', + 'Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit' + ), + array( + 'Magento\Adminhtml\Block\Promo\Catalog', + 'Magento\CatalogRule\Block\Adminhtml\Promo\Catalog' + ), + + array( + 'Magento\Adminhtml\Block\Promo\Widget\Chooser\Daterange', + 'Magento\CatalogRule\Block\Adminhtml\Widget\Chooser\Daterange' + ), + array( + 'Magento\Adminhtml\Block\Promo\Widget\Chooser\Sku', + 'Magento\CatalogRule\Block\Adminhtml\Widget\Chooser\Sku' + ), + array( + 'Magento\Adminhtml\Block\Promo\Widget\Chooser', + 'Magento\CatalogRule\Block\Adminhtml\Widget\Chooser' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Form', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Form' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Actions', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Actions' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Conditions', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Conditions' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Form', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Form' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Grid\Column\Renderer\Used', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid\Column\Renderer\Used' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons\Grid', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Coupons', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Labels', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Labels' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Main\Renderer\Checkbox', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Main\Renderer\Checkbox' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tab\Main', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Main' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit\Tabs', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tabs' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote\Edit', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit' + ), + array( + 'Magento\Adminhtml\Block\Promo\Quote', + 'Magento\SalesRule\Block\Adminhtml\Promo\Quote' + ), + array( + 'Magento\Adminhtml\Controller\Promo\Catalog', + 'Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog' + ), + array( + 'Magento\Adminhtml\Controller\Promo\Quote', + 'Magento\SalesRule\Controller\Adminhtml\Promo\Quote' + ), + array( + 'Magento\Adminhtml\Controller\Promo\Widget', + 'Magento\CatalogRule\Controller\Adminhtml\Promo\Widget' + ), + array( + 'Magento\Adminhtml\Controller\Promo', + 'Magento\CatalogRule\Controller\Adminhtml\Promo' + ), + array( + 'Magento\Adminhtml\Controller\System\Account', + 'Magento\Backend\Controller\Adminhtml\System\Account', + ), + array( + 'Magento\Adminhtml\Controller\System\Backup', + 'Magento\Backend\Controller\Adminhtml\System\Backup', + ), + array( + 'Magento\Adminhtml\Controller\System\Config\System\Storage', + 'Magento\Backend\Controller\Adminhtml\System\Config\System\Storage', + ), + array( + 'Magento\Adminhtml\Controller\System\Design', + 'Magento\Backend\Controller\Adminhtml\System\Design', + ), + array( + 'Magento\Adminhtml\Controller\System\Email\Template', + 'Magento\Backend\Controller\Adminhtml\System\Email\Template', + ), + array( + 'Magento\Adminhtml\Controller\System\Store', + 'Magento\Backend\Controller\Adminhtml\System\Store', + ), + array( + 'Magento\Adminhtml\Controller\System\Variable', + 'Magento\Backend\Controller\Adminhtml\System\Variable', + ), + array( + 'Magento\Adminhtml\Block\System\Account\Edit\Form', + 'Magento\Backend\Block\System\Account\Edit\Form' + ), + array( + 'Magento\Adminhtml\Block\System\Account\Edit', + 'Magento\Backend\Block\System\Account\Edit' + ), + array( + 'Magento\Adminhtml\Block\System\Cache\Edit', + 'Magento\Backend\Block\System\Cache\Edit' + ), + array( + 'Magento\Adminhtml\Block\System\Cache\Form', + 'Magento\Backend\Block\System\Cache\Form' + ), + array( + 'Magento\Adminhtml\Block\System\Design\Edit\Tab\General', + 'Magento\Backend\Block\System\Design\Edit\Tab\General' + ), + array( + 'Magento\Adminhtml\Block\System\Design\Edit\Tabs', + 'Magento\Backend\Block\System\Design\Edit\Tabs' + ), + array( + 'Magento\Adminhtml\Block\System\Design\Edit', + 'Magento\Backend\Block\System\Design\Edit' + ), + array( + 'Magento\Adminhtml\Block\System\Design', + 'Magento\Backend\Block\System\Design' + ), + array( + 'Magento\Adminhtml\Block\System\Email\Template\Edit\Form', + 'Magento\Backend\Block\System\Email\Template\Edit\Form' + ), + array( + 'Magento\Adminhtml\Block\System\Email\Template\Edit', + 'Magento\Backend\Block\System\Email\Template\Edit' + ), + array( + 'Magento\Adminhtml\Block\System\Email\Template\Grid\Filter\Type', + 'Magento\Backend\Block\System\Email\Template\Grid\Filter\Type' + ), + array( + 'Magento\Adminhtml\Block\System\Email\Template\Grid\Renderer\Action', + 'Magento\Backend\Block\System\Email\Template\Grid\Renderer\Action' + ), + array( + 'Magento\Adminhtml\Block\System\Email\Template\Grid\Renderer\Sender', + 'Magento\Backend\Block\System\Email\Template\Grid\Renderer\Sender' + ), + array( + 'Magento\Adminhtml\Block\System\Email\Template\Grid\Renderer\Type', + 'Magento\Backend\Block\System\Email\Template\Grid\Renderer\Type' + ), + array( + 'Magento\Adminhtml\Block\System\Email\Template\Preview', + 'Magento\Backend\Block\System\Email\Template\Preview' + ), + array( + 'Magento\Adminhtml\Block\System\Email\Template', + 'Magento\Backend\Block\System\Email\Template' + ), + array( + 'Magento\Adminhtml\Block\System\Shipping\Ups', + 'Magento\Backend\Block\System\Shipping\Ups' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Delete\Form', + 'Magento\Backend\Block\System\Store\Delete\Form' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Delete\Group', + 'Magento\Backend\Block\System\Store\Delete\Group' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Delete\Website', + 'Magento\Backend\Block\System\Store\Delete\Website' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Delete', + 'Magento\Backend\Block\System\Store\Delete' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Edit\AbstractForm', + 'Magento\Backend\Block\System\Store\Edit\AbstractForm' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Edit\Form\Group', + 'Magento\Backend\Block\System\Store\Edit\Form\Group' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Edit\Form\Store', + 'Magento\Backend\Block\System\Store\Edit\Form\Store' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Edit\Form\Website', + 'Magento\Backend\Block\System\Store\Edit\Form\Website' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Edit', + 'Magento\Backend\Block\System\Store\Edit' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Grid\Render\Group', + 'Magento\Backend\Block\System\Store\Grid\Render\Group' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Grid\Render\Store', + 'Magento\Backend\Block\System\Store\Grid\Render\Store' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Grid\Render\Website', + 'Magento\Backend\Block\System\Store\Grid\Render\Website' + ), + array( + 'Magento\Adminhtml\Block\System\Store\Store', + 'Magento\Backend\Block\System\Store\Store' + ), + array( + 'Magento\Adminhtml\Block\System\Variable\Edit\Form', + 'Magento\Backend\Block\System\Variable\Edit\Form' + ), + array( + 'Magento\Adminhtml\Block\System\Variable\Edit', + 'Magento\Backend\Block\System\Variable\Edit' + ), + array( + 'Magento\Adminhtml\Block\System\Variable', + 'Magento\Backend\Block\System\Variable' + ), + array( + 'Magento\Adminhtml\Block\Checkout\Agreement\Edit\Form', + 'Magento\Checkout\Block\Adminhtml\Agreement\Edit\Form' + ), + array( + 'Magento\Adminhtml\Block\Checkout\Agreement\Edit', + 'Magento\Checkout\Block\Adminhtml\Agreement\Edit' + ), + array( + 'Magento\Adminhtml\Block\Checkout\Agreement\Grid', + 'Magento\Checkout\Block\Adminhtml\Agreement\Grid' + ), + array( + 'Magento\Adminhtml\Block\Checkout\Agreement', + 'Magento\Checkout\Block\Adminhtml\Agreement' + ), + array( + 'Magento\Adminhtml\Controller\Checkout\Agreement', + 'Magento\Checkout\Controller\Adminhtml\Agreement' + ), + array('Magento\Core\Model\EntryPoint\Cron', 'Magento\App\Cron'), + array('Magento\Log\Model\EntryPoint\Shell', 'Magento\Log\App\Shell'), + array('Magento\Index\Model\EntryPoint\Shell', 'Magento\Index\App\Shell'), + array('Magento\Index\Model\EntryPoint\Indexer', 'Magento\Index\App\Indexer'), + array('\Magento\Core\Model\EntryPoint\Media', '\Magento\Core\App\Media'), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php index 68b8a2c4de0f009e0473a667da969db6055a3786..35306594018ffce631e2681685aa7400d1b8cfda 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php @@ -29,6 +29,18 @@ return array( '/config/global/fieldsets' => '', '/config/global/cache/betatypes' => '', '/config/admin/fieldsets' => '', + '/config/global/webhook' => + 'This configuration moved to Di configuration of \Magento\Webhook module models', + '/config/general/locale' => + 'This configuration moved to Di configuration of \Magento\Core\Model\Locale\Config model', + '/config/global/can_use_base_url' => + 'This configuration moved to Di configuration of \Magento\Backend\Controller\Context class', + '/config/global/locale/allow/codes' => + 'This configuration moved to Di configuration of \Magento\Core\Model\Locale\Config model', + '/config/global/locale/allow/currencies' => + 'This configuration moved to Di configuration of \Magento\Core\Model\Locale\Config model', + '/config/global/mime/types' => + 'This configuration moved to Di configuration for \Magento\Downloadable\Helper\File class', '/config/global/models/*/deprecatedNode' => '', '/config/global/models/*/entities/*/table' => '', '/config/global/models/*/class' => '', @@ -42,6 +54,8 @@ return array( '/config/global/payment' => 'Move them to payment.xml.', '/config/adminhtml/menu' => 'Move them to adminhtml.xml.', '/config/adminhtml/acl' => 'Move them to adminhtml.xml.', + '/config/adminhtml/global_search' => + 'This configuration moved to Di configuration of \Magento\Adminhtml\Controller\Index', '/config/*[self::global|self::adminhtml|self::frontend]/di' => 'This configuration moved to di.xml file', '/config/*[self::global|self::adminhtml|self::frontend]/events' => 'This configuration moved to events.xml file', '/config/*[self::global|self::adminhtml|self::frontend]/routers' => @@ -50,6 +64,9 @@ return array( '/config/global/importexport' => 'This configuration moved to import.xml and export.xml files', '/config/global/catalog/product/type' => 'This configuration moved to product_types.xml file', '/config/global/catalog/product/options' => 'This configuration moved to product_options.xml file', + '/config/global/catalog/product/media/image_types' => + 'This configuration moved to Di configuration of ' + . '\Magento\Adminhtml\Block\Catalog\Product\Frontend\Product\Watermark', '/config/global/eav_attributes' => 'This configuration moved to eav_attributes.xml file', '/config/global/index' => 'This configuration moved to indexers.xml file', '/config/global/catalogrule' => 'This configuration moved to Di configuration of \Magento\CatalogRule\Model\Rule', @@ -90,8 +107,8 @@ return array( '/config/global/eav_frontendclasses' => 'This configuration was removed. ' . 'Please pluginize \Magento\Eav\Helper\Data::getFrontendClasses to extend frontend classes list', - '/config/global/resources' => 'This configuration moved to Di configuration of \Magento\Core\Model\Resource', - '/config/global/resource' => 'This configuration moved to Di configuration of \Magento\Core\Model\Resource', + '/config/global/resources' => 'This configuration moved to Di configuration of \Magento\App\Resource', + '/config/global/resource' => 'This configuration moved to Di configuration of \Magento\App\Resource', '/config/*/events/core_block_abstract_to_html_after' => 'Event has been replaced with "core_layout_render_element"', '/config/*/events/catalog_controller_product_delete' => '', diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php index 0cfb4ae052f6aec0f6136068dfb2ea50d2120c81..45f7151375c608542c23c416fd4ed6eb2643c9d1 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php @@ -30,7 +30,9 @@ return array( array('BACKORDERS_YES'), array('CACHE_TAG', 'Magento\Api\Model\Config', 'Magento_Api_Model_Cache_Type::CACHE_TAG'), array('CACHE_TAG', 'Magento\Core\Model\AppInterface'), - array('CACHE_TAG', 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', + array( + 'CACHE_TAG', + 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', 'Magento_Core_Model_Cache_Type_Collection::CACHE_TAG' ), array('CACHE_TAG', 'Magento\Core\Model\Translate', 'Magento_Core_Model_Cache_Type_Translate::CACHE_TAG'), @@ -50,19 +52,25 @@ return array( array('CONFIG_XML_PATH_DISPLAY_TAX_COLUMN'), array('CONFIG_XML_PATH_DISPLAY_ZERO_TAX'), array('CONFIG_XML_PATH_SHOW_IN_CATALOG'), - array('DEFAULT_SETUP_RESOURCE', 'Mage_Core_Model_Resource', + array( + 'DEFAULT_SETUP_RESOURCE', + 'Mage_Core_Model_Resource', 'Magento_Core_Model_Config_Resource::DEFAULT_SETUP_CONNECTION' ), - array('DEFAULT_READ_RESOURCE', 'Mage_Core_Model_Resource', + array( + 'DEFAULT_READ_RESOURCE', + 'Mage_Core_Model_Resource', 'Magento_Core_Model_Config_Resource::DEFAULT_READ_CONNECTION' ), - array('DEFAULT_WRITE_RESOURCE', 'Mage_Core_Model_Resource', + array( + 'DEFAULT_WRITE_RESOURCE', + 'Mage_Core_Model_Resource', 'Magento_Core_Model_Config_Resource::DEFAULT_WRITE_CONNECTION' ), array('DEFAULT_CURRENCY', 'Magento\Core\Model\Locale', 'Magento_Core_Model_LocaleInterface::DEFAULT_CURRENCY'), array('DEFAULT_ERROR_HANDLER', 'Magento\Core\Model\App'), - array('DEFAULT_READ_CONNECTION', 'Magento\Core\Model\Config\Resource'), - array('DEFAULT_WRITE_CONNECTION', 'Magento\Core\Model\Config\Resource'), + array('DEFAULT_READ_CONNECTION', 'Magento\App\Resource\Config'), + array('DEFAULT_WRITE_CONNECTION', 'Magento\App\Resource\Config'), array('DEFAULT_ERROR_HANDLER', 'Mage'), array('DEFAULT_LOCALE', 'Magento\Core\Model\Locale', 'Magento_Core_Model_LocaleInterface::DEFAULT_LOCALE'), array('DEFAULT_THEME_NAME', 'Magento\Core\Model\Design\PackageInterface'), @@ -85,7 +93,11 @@ return array( array('INIT_OPTION_SCOPE_TYPE', 'Magento\Core\Model\App', 'Magento_Core_Model_App::PARAM_RUN_TYPE'), array('INIT_OPTION_URIS', 'Magento\Core\Model\App', 'Magento_Core_Model_App::PARAM_APP_URIS'), array('INSTALLER_HOST_RESPONSE', 'Magento\Install\Model\Installer'), - array('LAYOUT_GENERAL_CACHE_TAG', 'Magento\Core\Model\Layout\Merge', 'Magento_Core_Model_Cache_Type_Layout::CACHE_TAG'), + array( + 'LAYOUT_GENERAL_CACHE_TAG', + 'Magento\Core\Model\Layout\Merge', + 'Magento_Core_Model_Cache_Type_Layout::CACHE_TAG' + ), array('LOCALE_CACHE_KEY', 'Magento\Adminhtml\Block\Page\Footer'), array('LOCALE_CACHE_LIFETIME', 'Magento\Adminhtml\Block\Page\Footer'), array('LOCALE_CACHE_TAG', 'Magento\Adminhtml\Block\Page\Footer'), @@ -93,19 +105,29 @@ return array( array('PATH_PREFIX_CUSTOMIZED', 'Magento\Core\Model\Theme\Files'), array('PUBLIC_BASE_THEME_DIR', 'Magento\Core\Model\Design\PackageInterface'), array('PUBLIC_CACHE_TAG', 'Magento\Core\Model\Design\PackageInterface'), - array('PUBLIC_MODULE_DIR', 'Magento\Core\Model\Design\PackageInterface', + array( + 'PUBLIC_MODULE_DIR', + 'Magento\Core\Model\Design\PackageInterface', 'Magento_Core_Model_Design_Package::PUBLIC_MODULE_DIR' ), - array('PUBLIC_THEME_DIR', 'Magento\Core\Model\Design\PackageInterface', + array( + 'PUBLIC_THEME_DIR', + 'Magento\Core\Model\Design\PackageInterface', 'Magento_Core_Model_Design_Package::PUBLIC_THEME_DIR' ), - array('PUBLIC_VIEW_DIR', 'Magento\Core\Model\Design\PackageInterface', + array( + 'PUBLIC_VIEW_DIR', + 'Magento\Core\Model\Design\PackageInterface', 'Magento_Core_Model_Design_Package::PUBLIC_VIEW_DIR' ), array('REGISTRY_FORM_PARAMS_KEY', null, 'direct value'), array('SCOPE_TYPE_GROUP', 'Magento\Core\Model\App', 'Magento_Core_Model_StoreManagerInterface::SCOPE_TYPE_GROUP'), array('SCOPE_TYPE_STORE', 'Magento\Core\Model\App', 'Magento_Core_Model_StoreManagerInterface::SCOPE_TYPE_STORE'), - array('SCOPE_TYPE_WEBSITE', 'Magento\Core\Model\App', 'Magento_Core_Model_StoreManagerInterface::SCOPE_TYPE_WEBSITE'), + array( + 'SCOPE_TYPE_WEBSITE', + 'Magento\Core\Model\App', + 'Magento_Core_Model_StoreManagerInterface::SCOPE_TYPE_WEBSITE' + ), array('SEESION_MAX_COOKIE_LIFETIME'), array('TYPE_BINARY', null, 'Magento_DB_Ddl_Table::TYPE_BLOB'), array('TYPE_CHAR', null, 'Magento_DB_Ddl_Table::TYPE_TEXT'), @@ -124,14 +146,17 @@ return array( array('XML_CHARSET_NODE', 'Magento\SalesRule\Helper\Coupon'), array('XML_CHARSET_SEPARATOR', 'Magento\SalesRule\Helper\Coupon'), array('XML_NODE_RELATED_CACHE', 'Magento\CatalogRule\Model\Rule'), - array('XML_NODE_ATTRIBUTE_NODES', 'Magento\Catalog\Model\Resource\Product\Flat\Indexer', - 'XML_NODE_ATTRIBUTE_GROUPS'), - array('XML_PATH_ALLOW_CODES', 'Magento\Core\Model\Locale', 'Magento_Core_Model_LocaleInterface::XML_PATH_ALLOW_CODES'), - array('XML_PATH_ALLOW_CURRENCIES', 'Magento\Core\Model\Locale', + array( + 'XML_NODE_ATTRIBUTE_NODES', + 'Magento\Catalog\Model\Resource\Product\Flat\Indexer', + 'XML_NODE_ATTRIBUTE_GROUPS' + ), + array( + 'XML_PATH_ALLOW_CURRENCIES', + 'Magento\Core\Model\Locale', 'Magento_Core_Model_LocaleInterface::XML_PATH_ALLOW_CURRENCIES' ), - array('XML_PATH_ALLOW_CURRENCIES_INSTALLED', 'Magento\Core\Model\Locale', - 'Magento_Core_Model_LocaleInterface::XML_PATH_ALLOW_CURRENCIES_INSTALLED'), + array('XML_PATH_ALLOW_CODES', 'Magento\Core\Model\LocaleInterface'), array('XML_PATH_ALLOW_DUPLICATION', 'Magento\Core\Model\Design\PackageInterface', 'Magento_Core_Model_Design_Package::XML_PATH_ALLOW_DUPLICATION' ), @@ -139,81 +164,116 @@ return array( array('XML_PATH_BACKEND_FRONTNAME', 'Mage_Backend_Helper_Data'), array('XML_PATH_CACHE_BETA_TYPES'), array('XML_PATH_CHECK_EXTENSIONS', 'Magento\Install\Model\Config'), - array('XML_PATH_CONNECTION_TYPE', 'Magento\Core\Model\Config\Resource'), + array('XML_PATH_CONNECTION_TYPE', 'Magento\App\Resource\Config'), array('XML_PATH_COUNTRY_DEFAULT', 'Magento\Paypal\Model\System\Config\Backend\MerchantCountry'), - array('XML_PATH_DEBUG_TEMPLATE_HINTS', 'Magento\Core\Block\Template', - 'Magento\Core\Model\TemplateEngine\Plugin::XML_PATH_DEBUG_TEMPLATE_HINTS'), - array('XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS', 'Magento\Core\Block\Template', - 'Magento\Core\Model\TemplateEngine\Plugin::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS'), + array( + 'XML_PATH_DEBUG_TEMPLATE_HINTS', + 'Magento\Core\Block\Template', + 'Magento\Core\Model\TemplateEngine\Plugin::XML_PATH_DEBUG_TEMPLATE_HINTS' + ), + array( + 'XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS', + 'Magento\Core\Block\Template', + 'Magento\Core\Model\TemplateEngine\Plugin::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS' + ), array('XML_PATH_DEFAULT_COUNTRY', 'Magento\Core\Model\Locale'), - array('XML_PATH_DEFAULT_LOCALE', 'Magento\Core\Model\Locale', + array( + 'XML_PATH_DEFAULT_LOCALE', + 'Magento\Core\Model\Locale', 'Magento_Core_Model_LocaleInterface::XML_PATH_DEFAULT_LOCALE' ), - array('XML_PATH_DEFAULT_TIMEZONE', 'Magento\Core\Model\Locale', + array( + 'XML_PATH_DEFAULT_TIMEZONE', + 'Magento\Core\Model\Locale', 'Magento_Core_Model_LocaleInterface::XML_PATH_DEFAULT_TIMEZONE' ), array('XML_PATH_INDEXER_DATA', 'Magento\Index\Model\Process'), array('XML_PATH_INSTALL_DATE', 'Mage_Core_Model_App', 'Mage_Core_Model_Config_Primary::XML_PATH_INSTALL_DATE'), array('XML_PATH_EXTERNAL_CACHE_CONTROLS', 'Magento\PageCache\Helper\Data'), + array('XML_PATH_EXTERNAL_CACHE_CONTROLS', 'Magento\PageCache\Model\CacheControlFactory'), array('XML_PATH_EXTERNAL_CACHE_CONTROL', 'Magento\PageCache\Helper\Data'), array('XML_PATH_LOCALE_INHERITANCE', 'Mage_Core_Model_Translate'), array('XML_PATH_PRODUCT_ATTRIBUTES', 'Magento\Wishlist\Model\Config'), array('XML_PATH_PRODUCT_COLLECTION_ATTRIBUTES', 'Magento\Catalog\Model\Config'), array('XML_PATH_QUOTE_PRODUCT_ATTRIBUTES', 'Magento\Sales\Model\Quote\Config'), array('XML_PATH_SENDING_SET_RETURN_PATH', 'Mage_Newsletter_Model_Subscriber'), - array('XML_PATH_SKIP_PROCESS_MODULES_UPDATES', 'Mage_Core_Model_App', + array( + 'XML_PATH_SKIP_PROCESS_MODULES_UPDATES', + 'Mage_Core_Model_App', 'Mage_Core_Model_Db_UpdaterInterface::XML_PATH_SKIP_PROCESS_MODULES_UPDATES' ), - array('XML_PATH_STATIC_FILE_SIGNATURE', 'Magento\Core\Helper\Data', + array( + 'XML_PATH_STATIC_FILE_SIGNATURE', + 'Magento\Core\Helper\Data', 'Magento_Core_Model_Design_Package::XML_PATH_STATIC_FILE_SIGNATURE' ), array('XML_PATH_TEMPLATE_EMAIL', 'Magento\Core\Model\Email\Template'), - array('XML_PATH_TEMPLATE_FILTER', 'Magento\Newsletter\Helper\Data', + array( + 'XML_PATH_TEMPLATE_FILTER', + 'Magento\Newsletter\Helper\Data', 'Use directly model \Magento\Newsletter\Model\Template\Filter' ), - array('XML_PATH_THEME', 'Magento\Core\Model\Design\PackageInterface', + array( + 'XML_PATH_THEME', + 'Magento\Core\Model\Design\PackageInterface', 'Magento_Core_Model_Design_Package::XML_PATH_THEME' ), - array('XML_PATH_THEME_ID', 'Magento\Core\Model\Design\PackageInterface', + array( + 'XML_PATH_THEME_ID', + 'Magento\Core\Model\Design\PackageInterface', 'Magento_Core_Model_Design_Package::XML_PATH_THEME_ID' ), array('XML_STORE_ROUTERS_PATH', 'Mage_Core_Controller_Varien_Front'), array('XML_PATH_SESSION_MESSAGE_MODELS', 'Magento\Catalog\Helper\Product\View'), - - array('VALIDATOR_KEY', 'Magento\Core\Model\Session\AbstractSession', + array( + 'VALIDATOR_KEY', + 'Magento\Core\Model\Session\AbstractSession', 'Magento_Core_Model_Session_Validator::VALIDATOR_KEY' ), - array('VALIDATOR_HTTP_USER_AGENT_KEY', 'Magento\Core\Model\Session\AbstractSession', + array( + 'VALIDATOR_HTTP_USER_AGENT_KEY', + 'Magento\Core\Model\Session\AbstractSession', 'Magento_Core_Model_Session_Validator::VALIDATOR_HTTP_USER_AGENT_KEY' ), - array('VALIDATOR_HTTP_X_FORVARDED_FOR_KEY', 'Magento\Core\Model\Session\AbstractSession', + array( + 'VALIDATOR_HTTP_X_FORVARDED_FOR_KEY', + 'Magento\Core\Model\Session\AbstractSession', 'Magento_Core_Model_Session_Validator::VALIDATOR_HTTP_X_FORWARDED_FOR_KEY' ), - array('VALIDATOR_HTTP_VIA_KEY', 'Magento\Core\Model\Session\AbstractSession', + array( + 'VALIDATOR_HTTP_VIA_KEY', + 'Magento\Core\Model\Session\AbstractSession', 'Magento_Core_Model_Session_Validator::VALIDATOR_HTTP_VIA_KEY' ), - array('VALIDATOR_REMOTE_ADDR_KEY', 'Magento\Core\Model\Session\AbstractSession', + array( + 'VALIDATOR_REMOTE_ADDR_KEY', + 'Magento\Core\Model\Session\AbstractSession', 'Magento_Core_Model_Session_Validator::VALIDATOR_REMOTE_ADDR_KEY' ), - array('XML_PATH_USE_REMOTE_ADDR', 'Magento\Core\Model\Session\AbstractSession', + array( + 'XML_PATH_USE_REMOTE_ADDR', + 'Magento\Core\Model\Session\AbstractSession', 'Magento_Core_Model_Session_Validator::XML_PATH_USE_REMOTE_ADDR' ), - array('XML_PATH_USE_HTTP_VIA', 'Magento\Core\Model\Session\AbstractSession', + array( + 'XML_PATH_USE_HTTP_VIA', + 'Magento\Core\Model\Session\AbstractSession', 'Magento_Core_Model_Session_Validator::XML_PATH_USE_HTTP_VIA' ), - array('XML_PATH_USE_X_FORWARDED', 'Magento\Core\Model\Session\AbstractSession', + array( + 'XML_PATH_USE_X_FORWARDED', + 'Magento\Core\Model\Session\AbstractSession', 'Magento_Core_Model_Session_Validator::XML_PATH_USE_X_FORWARDED' ), - array('XML_PATH_USE_USER_AGENT', 'Magento\Core\Model\Session\AbstractSession', + array( + 'XML_PATH_USE_USER_AGENT', + 'Magento\Core\Model\Session\AbstractSession', 'Magento_Core_Model_Session_Validator::XML_PATH_USE_USER_AGENT' ), - array('XML_NODE_DIRECT_FRONT_NAMES', 'Magento\App\Request\Http'), - array('XML_NODE_USET_AGENT_SKIP', 'Magento\Core\Model\Session\AbstractSession'), array('XML_PAGE_TYPE_RENDER_INHERITED', 'Magento\Core\Controller\Varien\Action'), array('XML_PATH_ALLOW_MAP_UPDATE', 'Magento\Core\Model\Design\FileResolution\StrategyPool'), - array('XML_PATH_WEBAPI_REQUEST_INTERPRETERS', 'Magento\Webapi\Controller\Request\Rest\Interpreter\Factory'), array('XML_PATH_WEBAPI_RESPONSE_RENDERS', 'Magento\Webapi\Controller\Response\Rest\Renderer\Factor'), array('XML_PATH_THEME'), @@ -238,17 +298,58 @@ return array( array('XML_PATH_DISABLED_CACHE_TYPES', 'Magento\DesignEditor\Helper\Data'), array('XML_PATH_ENCRYPTION_MODEL', 'Magento\Core\Helper\Data'), array('CONFIG_KEY_PATH_TO_MAP_FILE', 'Magento\Core\Model\Resource\Setup\Migration'), - array('XML_PATH_IGNORE_DEV_MODE', 'Magento\App\UpdaterInterface'), array('XML_PATH_SKIP_PROCESS_MODULES_UPDATES', 'Magento\App\UpdaterInterface'), - array('XML_NODE_SESSION_SAVE', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_AbstractSession::PARAM_SESSION_SAVE_METHOD' + array( + 'XML_NODE_SESSION_SAVE', + 'Magento\Core\Model\Session\AbstractSession', + 'Magento\Core\Model\Session\AbstractSession::PARAM_SESSION_SAVE_METHOD' ), - array('XML_NODE_SESSION_SAVE_PATH', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_AbstractSession::PARAM_SESSION_SAVE_PATH' + array('XML_PATH_IGNORE_DEV_MODE', 'Magento\Module\UpdaterInterface'), + array('XML_PATH_SKIP_PROCESS_MODULES_UPDATES', 'Magento\Module\UpdaterInterface'), + array( + 'XML_NODE_SESSION_SAVE_PATH', + 'Magento\Core\Model\Session\AbstractSession', + 'Magento\Core\Model\Session\AbstractSession::PARAM_SESSION_SAVE_PATH' ), array('XML_PATH_USE_CUSTOM_ADMIN_PATH', 'Magento\Backend\Helper\Data'), array('XML_PATH_CUSTOM_ADMIN_PATH', 'Magento\Backend\Helper\Data'), array('XML_PATH_BACKEND_AREA_FRONTNAME', 'Magento\Backend\Helper\Data'), array('PARAM_BACKEND_FRONT_NAME', 'Magento\Backend\Helper\Data'), - + array('CHARS_LOWERS', '\Magento\Core\Helper\Data', '\Magento\Math\Random::CHARS_LOWERS'), + array('CHARS_UPPERS', '\Magento\Core\Helper\Data', '\Magento\Math\Random::CHARS_UPPERS'), + array('CHARS_DIGITS', '\Magento\Core\Helper\Data', '\Magento\Math\Random::CHARS_DIGITS'), + array('CHARS_SPECIALS', '\Magento\Core\Helper\Data', '\Magento\Math\Random::CHARS_SPECIALS'), + array('CHARS_PASSWORD_LOWERS', '\Magento\Core\Helper\Data', '\Magento\Math\Random::CHARS_PASSWORD_LOWERS'), + array('CHARS_PASSWORD_UPPERS', '\Magento\Core\Helper\Data', '\Magento\Math\Random::CHARS_PASSWORD_UPPERS'), + array('CHARS_PASSWORD_DIGITS', '\Magento\Core\Helper\Data', '\Magento\Math\Random::CHARS_PASSWORD_DIGITS'), + array('CHARS_PASSWORD_SPECIALS', '\Magento\Core\Helper\Data', '\Magento\Math\Random::CHARS_PASSWORD_SPECIALS'), + array('XML_NODE_REMOTE_ADDR_HEADERS', '\Magento\Core\Helper\Http'), + array( + 'XML_PATH_EU_COUNTRIES_LIST', + '\Magento\Core\Helper\Data', + 'Magento\Customer\Helper\Data::XML_PATH_EU_COUNTRIES_LIST' + ), + array( + 'XML_PATH_MERCHANT_COUNTRY_CODE', + '\Magento\Core\Helper\Data', + 'Magento\Customer\Helper\Data::XML_PATH_MERCHANT_COUNTRY_CODE' + ), + array( + 'XML_PATH_MERCHANT_VAT_NUMBER', + '\Magento\Core\Helper\Data', + 'Magento\Customer\Helper\Data::XML_PATH_MERCHANT_VAT_NUMBER' + ), + array( + 'XML_PATH_PROTECTED_FILE_EXTENSIONS', + '\Magento\Core\Helper\Data', + '\Magento\Core\Model\File\Validator\NotProtectedExtension::XML_PATH_PROTECTED_FILE_EXTENSIONS' + ), + array( + 'XML_PATH_PUBLIC_FILES_VALID_PATHS', + '\Magento\Core\Helper\Data', + '\Magento\Adminhtml\Helper\Catalog::XML_PATH_PUBLIC_FILES_VALID_PATHS' + ), + array('XML_PATH_IMAGE_TYPES', 'Magento\Adminhtml\Block\Catalog\Product\Frontend\Product\Watermark'), + array('XML_PATH_WEBHOOK', 'Magento\Webhook\Model\Source\Hook'), + array('XML_PATH_SUBSCRIPTIONS', 'Magento\Webhook\Model\Subscription\Config'), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 212afbd9e0270eca22147d57da00113149d42895..3da69e71f1122153843559b57b3cc203bf38e167 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -78,7 +78,7 @@ return array( array('_getCookie', 'Magento\PageCache\Helper\Data'), array('_getCollapseState', 'Magento\Backend\Block\System\Config\Form\Fieldset', '_isCollapseState'), array('_getCollectionNames', 'Magento\Adminhtml\Controller\Report\Sales'), - array('_getConnectionAdapterClassName', 'Magento\Core\Model\Resource'), + array('_getConnectionAdapterClassName', 'Magento\App\Resource'), array('_getConnenctionType', 'Magento\Install\Model\Installer\Db'), array('_getDateFromToHtml', 'Magento\ImportExport\Block\Adminhtml\Export\Filter'), array('_getDeclaredModuleFiles', 'Magento\Core\Model\Config'), @@ -198,7 +198,7 @@ return array( array('addKey', 'Magento\DB\Adapter\Pdo\Mysql'), array('addLinkRel', 'Magento\Page\Block\Html\Head'), array('addLogInLink', 'Magento\Customer\Block\Account\Link'), - array('addModule', 'Magento\Core\Controller\Varien\Router\Base'), + array('addModule', 'Magento\Core\App\Router\Base'), array('addRouter', 'Magento\App\FrontController'), array('addOptionRenderer', 'Magento\Catalog\Block\Product\View\Options'), array('addPageHandles', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), @@ -233,9 +233,9 @@ return array( array('asSimplexml', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), array('asString', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), array('authAdmin'), - array('authFailed', '', 'Magento_Core_Helper_Http::failHttpAuthentication()'), + array('authFailed', '', '\Magento\HTTP\Authentication::setAuthenticationFailed'), array('authFrontend'), - array('authValidate', '', 'Magento_Core_Helper_Http::getHttpAuthCredentials()'), + array('authValidate', '', '\Magento\HTTP\Authentication::getCredentials'), array('baseInit', 'Magento\Core\Model\App'), array('bundlesAction', 'Magento\Catalog\Controller\Adminhtml\Product'), array('calcTaxAmount', 'Magento\Sales\Model\Quote\Item\AbstractItem'), @@ -259,7 +259,7 @@ return array( array('checkDateTime', 'Magento\Core\Model\Date'), array('chooseTemplate', 'Magento\Checkout\Block\Cart'), array('cleanCache', 'Magento\Core\Model\Config'), - array('cleanDbRow', 'Magento\Core\Model\Resource'), + array('cleanDbRow', 'Magento\App\Resource'), array('cleanMergedJsCss', 'Magento\Core\Model\Design\Package', 'Magento\Core\Model\Page\Asset\MergeService'), array('cleanMergedJsCss', 'Magento\Core\Model\Design\Package\Proxy', 'Magento\Core\Model\Page\Asset\MergeService'), array( @@ -271,8 +271,8 @@ return array( array('cleanVarSubFolders', '', 'glob() on \Magento\App\Dir::getBaseDir(\Magento\Core\Model\App\Dir::VAR_DIR)'), array('cloneIndexTable', 'Magento\Index\Model\Resource\AbstractResource'), - array('collectRoutes', 'Magento\Backend\Controller\Router\DefaultRouter'), - array('collectRoutes', 'Magento\Core\Controller\Varien\Router\Base'), + array('collectRoutes', 'Magento\Backend\App\Router\DefaultRouter'), + array('collectRoutes', 'Magento\Core\App\Router\Base'), array('composeLocaleHierarchy', 'Magento\Core\Helper\Translate'), array('convertOldTaxData', 'Magento\Tax\Model\Resource\Setup'), array('convertOldTreeToNew', 'Magento\Catalog\Model\Resource\Setup'), @@ -301,7 +301,7 @@ return array( array('fetchUpdatesByHandle', 'Magento\Core\Model\Resource\Layout', 'Magento\Core\Model\Resource\Layout\Update'), array('flush', 'Magento\Core\Model\Cache', 'Magento_Cache_FrontendInterface::clean()'), array('flush', 'Magento\Core\Model\Cache\Proxy', 'Magento_Cache_FrontendInterface::clean()'), - array('flush', 'Magento\Core\Model\CacheInterface', 'Magento_Cache_FrontendInterface::clean()'), + array('flush', 'Magento\App\CacheInterface', 'Magento_Cache_FrontendInterface::clean()'), array('forsedSave'), array('generateBlocks', '', 'generateElements()'), array('getAbsolutePath', '', 'normalizePath'), @@ -337,7 +337,7 @@ return array( array('getConfigAsXml','Magento\Widget\Model\Widget'), array('getConfigData', 'Magento\Cms\Model\Wysiwyg\Images\Storage'), array('getConfigDataModel', 'Magento\Core\Model\Config'), - array('getConnectionTypeInstance', 'Magento\Core\Model\Resource'), + array('getConnectionTypeInstance', 'Magento\App\Resource'), array('getContainers', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), array('getCustomerData', 'Magento\Sales\Block\Adminhtml\Order\Create\Form\Account'), array('getDataForSave', 'Magento\Wishlist\Model\Item'), @@ -345,7 +345,7 @@ return array( array('getDataMaxSizeInBytes', 'Magento\Adminhtml\Block\Media\Uploader', 'Magento_File_Size::getMaxFileSize()'), array('getDbAdapter', 'Magento\Core\Model\Cache'), array('getDbAdapter', 'Magento\Core\Model\Cache\Proxy'), - array('getDbAdapter', 'Magento\Core\Model\CacheInterface'), + array('getDbAdapter', 'Magento\App\CacheInterface'), array( 'getDbVendorName', 'Magento\TestFramework\Bootstrap', @@ -412,7 +412,7 @@ return array( array('getMessageUserCreationProhibited', 'Magento\User\Model\Resource\User'), array('getMinQueryLenght'), array('getModelClassName', 'Magento\Core\Model\Config'), - array('getModuleByName', 'Magento\Core\Controller\Varien\Router\Base'), + array('getModuleByName', 'Magento\Core\App\Router\Base'), array('getModuleConfigurationFiles', 'Magento\Core\Model\Config'), array('getModuleSetup', 'Magento\Core\Model\Config'), array('getNeedUsePriceExcludeTax', '', 'Magento_Tax_Model_Config::priceIncludesTax()'), @@ -446,7 +446,7 @@ return array( array('getPathVars', 'Magento\Core\Model\Config'), array('getParentProductIds', 'Magento\Catalog\Model\Resource\Product'), array('getPostMaxSize', 'Magento\Adminhtml\Block\Media\Uploader', 'Magento_File_Size::getPostMaxSize()'), - array('getPriceFormatted', 'Magento\Adminhtml\Block\Customer\Edit\Tab\View\Sales'), + array('getPriceFormatted', 'Magento\Customer\Block\Adminhtml\Edit\Tab\View\Sales'), array('getPrices', 'Magento\Bundle\Model\Product\Price'), array('getPricesDependingOnTax', 'Magento\Bundle\Model\Product\Price'), array('getPrintUrl', 'Magento\Checkout\Block\Onepage\Success'), @@ -486,14 +486,8 @@ return array( array('getResourceTypeConfig', 'Magento\Core\Model\Config'), array('getResTreeJson', 'Magento\User\Block\Role\Tab\Edit', 'getTree'), array('getResTreeJson', 'Magento\Adminhtml\Block\Api\Tab\Rolesedit', 'getTree'), - array( - 'getRouterByRoute', - 'Magento\App\FrontController', - 'Magento_Core_Model_RouterList::getRouterByFrontName' - ), - array('getRouterByFrontName', 'Magento\App\FrontController', - 'Magento_Core_Model_RouterList::getRouterByFrontName' - ), + array('getRouterByRoute', 'Magento\App\FrontController'), + array('getRouterByFrontName', 'Magento\App\FrontController'), array('getRouters', 'Magento\Core\Model\Config'), array('getRowId', 'Magento\Sales\Block\Adminhtml\Order\Create\Customer\Grid'), array('getRowId', 'Magento\Adminhtml\Block\Widget\Grid'), @@ -510,7 +504,7 @@ return array( array('getStateModelClass', 'Magento\Centinel\Model\Config'), array('getStatrupPageUrl'), array('getStore', 'Magento\Captcha\Helper\Data'), - array('getStore', 'Magento\Adminhtml\Block\Promo\Widget\Chooser\Sku'), + array('getStore', 'Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser\Sku'), array('getStoreButtonsHtml', 'Magento\Backend\Block\System\Config\Tabs'), array('getStoreCodeFromPath', 'Magento\App\Request\Http'), array('getStoreCurrency', 'Magento\Sales\Model\Order'), @@ -522,7 +516,7 @@ return array( array('getTablePrefix', 'Magento\Core\Model\Config'), array('getTagsByType', 'Magento\Core\Model\Cache', 'Magento_Cache_Frontend_Decorator_TagScope::getTag()'), array('getTagsByType', 'Magento\Core\Model\Cache\Proxy', 'Magento_Cache_Frontend_Decorator_TagScope::getTag()'), - array('getTagsByType', 'Magento\Core\Model\CacheInterface', 'Magento_Cache_Frontend_Decorator_TagScope::getTag()'), + array('getTagsByType', 'Magento\App\CacheInterface', 'Magento_Cache_Frontend_Decorator_TagScope::getTag()'), array('getTaxAmount', 'Magento\Sales\Model\Quote\Item\AbstractItem'), array('getTaxRatesByProductClass', '', '_getAllRatesByProductClass'), array('getTemplateProcessor', 'Magento\Newsletter\Helper\Data', @@ -681,7 +675,7 @@ return array( array('saveConfig', 'Magento\Core\Model\Config'), array('saveOptions', 'Magento\Core\Model\Cache'), array('saveOptions', 'Magento\Core\Model\Cache\Proxy'), - array('saveOptions', 'Magento\Core\Model\CacheInterface'), + array('saveOptions', 'Magento\App\CacheInterface'), array('saveRow__OLD'), array('saveSegmentCustomersFromSelect'), array('saveUseCache'), @@ -705,7 +699,7 @@ return array( array('setParentBlock'), array('setProduct', 'Magento\Catalog\Model\Product\Type\AbstractType'), array('setProfile', 'Magento\Convert\Container\AbstractContainer'), - array('setResourceConfig', 'Magento\Core\Model\Resource'), + array('setResourceConfig', 'Magento\App\Resource'), array('setSaveTemplateFlag', 'Magento\Newsletter\Model\Queue'), array('setScriptPath'), array('setScriptPath', 'Magento\Core\Block\Template'), @@ -876,10 +870,71 @@ return array( array('_initFrontController', '\Magento\Core\Model\App'), array('_getFrontControllerByCurrentArea', '\Magento\Core\Model\App'), array('run', '\Magento\Core\Model\AppInterface'), - array('setModuleDir', 'Magento\Core\Model\Config\Modules\Reader'), + array('setModuleDir', 'Magento\Module\Dir\Reader'), array('setModuleDir', 'Magento\Core\Model\Config'), array('getAreaConfig', 'Magento\Core\Model\Config'), + array('getRandomString', '\Magento\Core\Helper\Data'), + array('getHttpHost', '\Magento\Core\Helper\Http'), + array('getHttpUserAgent', '\Magento\Core\Helper\Http'), + array('getHttpUserAcceptLanguage', '\Magento\Core\Helper\Http'), + array('getHttpUserAcceptCharset', '\Magento\Core\Helper\Http'), + array('getHttpUserAcceptReferer', '\Magento\Core\Helper\Http'), + array('getHttpUserRemoteAddr', '\Magento\Core\Helper\Http'), + array('getHttpUserServerAddr', '\Magento\Core\Helper\Http'), + array('getEncryptor', '\Magento\Core\Helper\Data', '\Magento\Encryption\Encryptor'), + array('getCoreData', '\Magento\Sales\Model\Resource\Setup'), + array('encrypt', '\Magento\Core\Helper\Data'), + array('decrypt', '\Magento\Core\Helper\Data'), + array('validateKey', '\Magento\Core\Helper\Data', '\Magento\Encryption\EncryptorInterface'), + array('validateHash', '\Magento\Core\Helper\Data'), + array('getHash', '\Magento\Core\Helper\Data'), + array('escapeHtml', '\Magento\Core\Helper\AbstractHelper', '\Magento\Escaper::escapeHtml'), + array('escapeUrl', '\Magento\Core\Helper\AbstractHelper', '\Magento\Escaper::escapeUrl'), + array('jsQuoteEscape', '\Magento\Core\Helper\AbstractHelper', '\Magento\Escaper::escapeJsQuote'), + array('quoteEscape', '\Magento\Core\Helper\AbstractHelper', '\Magento\Escaper::escapeQuote'), + array('removeTags', '\Magento\Core\Helper\AbstractHelper', '\Magento\Filter\FilterManager'), + array('removeAccents', '\Magento\Core\Helper\Data', '\Magento\Filter\FilterManager'), + array('splitWords', '\Magento\Core\Helper\String', '\Magento\Filter\FilterManager'), + array('strlen', '\Magento\Core\Helper\String', '\Magento\Stdlib\String::strlen'), + array('substr', '\Magento\Core\Helper\String', '\Magento\Stdlib\String::substr'), + array('strrev', '\Magento\Core\Helper\String', '\Magento\Stdlib\String::strrev'), + array('cleanString', '\Magento\Core\Helper\String', '\Magento\Stdlib\String::cleanString'), + array('strpos', '\Magento\Core\Helper\String', '\Magento\Stdlib\String::strpos'), + array('strSplit', '\Magento\Core\Helper\String', '\Magento\Stdlib\String::split'), + array('splitInjection', '\Magento\Core\Helper\String', '\Magento\Stdlib\String::splitInjection'), + array('truncate', '\Magento\Core\Helper\String', '\Magento\Filter\Truncate'), + array('ksortMultibyte', '\Magento\Core\Helper\String'), + array('uc_words'), + array('is_empty_date'), + array('now'), + array('uniqHash', '\Magento\Core\Helper\Data', '\Magento\Math\Random::getUniqueHash'), + array('getMerchantCountryCode', '\Magento\Core\Helper\Data', '\Magento\Customer\Helper\Data::getMerchantCountryCode'), + array('getMerchantVatNumber', '\Magento\Core\Helper\Data', '\Magento\Customer\Helper\Data::getMerchantVatNumber'), + array('isCountryInEU', '\Magento\Core\Helper\Data', '\Magento\Customer\Helper\Data::isCountryInEU'), + array('assocToXml', '\Magento\Core\Helper\Data', '\Magento\Convert\ConvertArray::assocToXml'), + array('xmlToAssoc', '\Magento\Core\Helper\Data', '\Magento\Convert\Xml::xmlToAssoc'), + array('checkLfiProtection', '\Magento\Core\Helper\Data', '\Magento\Filesystem::checkLfiProtection'), + array('getProtectedFileExtensions', '\Magento\Core\Helper\Data', + '\Magento\Core\Model\File\Validator\NotProtectedExtension::getProtectedFileExtensions'), + array('getStoreId', '\Magento\Core\Helper\Data'), + array('getExactDivision', '\Magento\Core\Helper\Data', '\Magento\Math\Division::getExactDivision'), + array('getPublicFilesValidPath', '\Magento\Core\Helper\Data'), array('getViewConfig', '\Magento\Core\Model\View\Config', 'get'), array('_getSession', '\Magento\Catalog\Helper\Product\Compare', '$this->_catalogSession'), array('getEnginePool', '\Magento\Core\Block\Template\Context', 'getEngineFactory'), + array('is_dir_writeable'), + array('destruct'), + array('mageDebugBacktrace'), + array('mageDelTree'), + array('mageParseCsv'), + array('getHttpAuthCredentials', '\Magento\Core\Helper\Http', '\Magento\HTTP\Authentication::getCredentials'), + array('failHttpAuthentication', '\Magento\Core\Helper\Http', + '\Magento\HTTP\Authentication::setAuthenticationFailed' + ), + array('getRequestUri', '\Magento\Core\Helper\Http', '\Magento\HTTP\Header::getRequestUri'), + array('validateIpAddr', '\Magento\Core\Helper\Http', '\Zend_Validate_Ip::isValid'), + array('getRemoteAddr', '\Magento\Core\Helper\Http', 'Magento\HTTP\PhpEnvironment\RemoteAddress::getRemoteAddress'), + array('getServerAddr', '\Magento\Core\Helper\Http', 'Magento\HTTP\PhpEnvironment\ServerAddress::getServerAddress'), + array('formatDate', 'Magento\Core\Model\Resource\AbstractResource', '\Magento\Stdlib\DateTime::formatDate'), + array('mktime', 'Magento\Core\Model\Resource\AbstractResource', '\Magento\Stdlib\DateTime::toTimestamp'), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php index 4d6d59c94476f0921e1bd9c5744f9ebb08a5220f..921b76a3e7171711807e82e1d93729c12fb16295 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php @@ -30,7 +30,7 @@ return array( array('_addMinimalPrice', 'Magento\Catalog\Model\Resource\Product\Collection'), array('_alias', 'Magento\Core\Block\AbstractBlock'), array('_anonSuffix'), - array('_appMode', 'Magento\Core\Model\ObjectManager\ConfigLoader'), + array('_appMode', 'Magento\App\ObjectManager\ConfigLoader'), array('_baseDirCache', 'Magento\Core\Model\Config'), array('_cacheConf'), array('_canUseLocalModules'), @@ -40,22 +40,22 @@ return array( array('_childGroups', 'Magento\Core\Block\AbstractBlock'), array('_combineHistory'), array('_config', 'Magento\Core\Model\Design\Package'), - array('_config', 'Magento\Core\Model\Logger', '_dirs'), + array('_config', 'Magento\Logger', '_dirs'), array('_config', 'Magento\Core\Model\Resource\Setup'), array('_configModel', 'Magento\Backend\Model\Menu\AbstractDirector'), array('_configuration', 'Magento\Index\Model\Lock\Storage', '_dirs'), array('_connectionConfig', 'Magento\Core\Model\Resource\Setup'), - array('_connectionTypes', 'Magento\Core\Model\Resource'), + array('_connectionTypes', 'Magento\App\Resource'), array('_currency', 'Magento\GoogleCheckout\Model\Api\Xml\Checkout'), array('_currencyNameTable'), array('_customEtcDir', 'Magento\Core\Model\Config'), array('_defaultTemplates', 'Magento\Core\Model\Email\Template'), array('_designProductSettingsApplied'), array('_directOutput', 'Magento\Core\Model\Layout'), - array('_dirs', 'Magento\Core\Model\Resource'), + array('_dirs', 'Magento\App\Resource'), array('_distroServerVars'), array('_entityIdsToIncrementIds'), - array('entities', 'Magento\Core\Model\Resource'), + array('entities', 'Magento\App\Resource'), array('_entityTypeIdsToTypes'), array('_factory', 'Magento\Backend\Model\Menu\Config'), array('_factory', 'Magento\Backend\Model\Menu\AbstractDirector', '_commandFactory'), @@ -67,7 +67,7 @@ return array( array('_loadDefault', 'Magento\Core\Model\Resource\Website\Collection'), array('_mapper', 'Magento\ObjectManager\Config\Reader\Dom'), array('_menu', 'Magento\Backend\Model\Menu\Builder'), - array('_modulesReader', 'Magento\Core\Model\ObjectManager\ConfigLoader'), + array('_modulesReader', 'Magento\App\ObjectManager\ConfigLoader'), array('_moduleReader', 'Magento\Backend\Model\Menu\Config'), array('_option', 'Magento\Captcha\Helper\Data', '_dirs'), array('_options', 'Magento\Core\Model\Config', 'Magento\App\Dir'), @@ -79,7 +79,7 @@ return array( array('_persistentCustomerGroupId'), array('_queriesHooked', 'Magento\Core\Model\Resource\Setup'), array('_ratingOptionTable', 'Magento\Rating\Model\Resource\Rating\Option\Collection'), - array('_readerFactory', 'Magento\Core\Model\ObjectManager\ConfigLoader'), + array('_readerFactory', 'Magento\App\ObjectManager\ConfigLoader'), array('_resourceConfig', 'Magento\Core\Model\Resource\Setup'), array('_saveTemplateFlag', 'Magento\Newsletter\Model\Queue'), array('_searchTextFields'), @@ -106,7 +106,6 @@ return array( array('_useAnalyticFunction'), array('_defaultIndexer', 'Magento\CatalogInventory\Model\Resource\Indexer\Stock'), array('_engine', 'Magento\CatalogSearch\Model\Resource\Fulltext'), - array('_moduleNamespaces', 'Magento\Core\Model\Config'), array('_allowedAreas', 'Magento\Core\Model\Config'), array('_app', 'Magento\Core\Block\AbstractBlock'), array('_app', 'Magento\Core\Block\Template'), diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt index f51bc4fce8253da44b91a4954185ca0f3d0ad6c8..48008e71d27887d3dc0165519f85faadca0cca22 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt @@ -38,14 +38,10 @@ lib/Magento/Cache/Backend/Database.php lib/Magento/Cache/Backend/Eaccelerator.php lib/Magento/Cache/Backend/Memcached.php lib/Magento/Cache/Core.php -lib/Magento/Code/Generator.php -lib/Magento/Code/Generator/EntityAbstract.php -lib/Magento/Code/Generator/Io.php lib/Magento/Connect lib/Magento/Convert/ConvertException.php lib/Magento/Convert/Mapper/Column.php lib/Magento/Convert/Mapper/MapperInterface.php -lib/Magento/DB lib/Magento/Data/Collection.php lib/Magento/Data/Collection/Db.php lib/Magento/Data/Collection/Db/FetchStrategy/Cache.php @@ -94,8 +90,8 @@ lib/Magento/Data/Tree/Db.php lib/Magento/Data/Tree/Dbp.php lib/Magento/Data/Tree/Node.php lib/Magento/Data/Tree/Node/Collection.php -lib/Magento/Date.php lib/Magento/DB +lib/Magento/Stdlib/DateTime.php lib/Magento/Debug.php lib/Magento/Event.php lib/Magento/Event @@ -103,7 +99,6 @@ lib/Magento/File/Csv.php lib/Magento/File/CsvMulty.php lib/Magento/File/Transfer/Adapter/Http.php lib/Magento/File/Uploader.php -lib/Magento/Filter lib/Magento/Gdata lib/Magento/HTTP/Adapter/Curl.php lib/Magento/HTTP/Client.php @@ -121,6 +116,3 @@ lib/Magento/Simplexml lib/Magento/System lib/Magento/Util.php lib/Magento/Xml -lib/Magento/Validator -dev/tests/unit/testsuite/Magento/Code/Plugin/GeneratorTest/SimpleObjectManager.php -dev/tools/Magento/Tools/I18n/Zend diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 2b12c8effe642c3dace1d298b2e5f41fa3d7fb58..fe12bc4fcaeac25319e8bbb134e30fce1091e054 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -7,6 +7,7 @@ Magento/Catalog/Block/Product/ProductList Magento/Catalog/Model/Category/Attribute/Source Magento/Catalog/Model/Category/Indexer Magento/Catalog/Model/Product +Magento/Core/Model/Resource/Design Zend downloader dev @@ -39,12 +40,15 @@ Magento/Sales/Controller/Adminhtml/Order Magento/Sales/Model/Resource/Helper Magento/Sales/Model/Resource/Order Magento/Catalog/Model/Resource/Product +Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab Magento/Checkout/Block/Onepage +Magento/Cms/Block/Adminhtml/Page/Edit Magento/Core/Model/Design/Backend Magento/Core/Model/Layout/File/Source/Override Magento/Core/Model/Store Magento/Cron/Model/Config/Backend/Product Magento/Customer/Block/Account/Dashboard +Magento/Customer/Block/Adminhtml/Edit/Tab Magento/Customer/Model/Config/Backend/Show Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code Magento/DesignEditor/Block/Adminhtml/Theme/Selector/Tab @@ -68,6 +72,7 @@ Magento/Sales/Block/Adminhtml Magento/Sales/Model/Resource Magento/Sales/Model/Quote/Address/Total Magento/Sales/Model/Resource/Report/Order +Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab Magento/Shipping/Model/Carrier Magento/CatalogRule/Model Magento/Tax/Block/Checkout @@ -95,3 +100,4 @@ Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit Magento/User/Block/User/Edit var/generation Magento/Newsletter/Model/Template/Filter + diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt index 0e31503b64c16e0d969b2aa0e38da50af80ce54b..b3f11828c12acb241cbd77317a240034d10c4992 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt @@ -15,23 +15,21 @@ app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php # Formatter intorduces long line app/code/Magento/Catalog/Block/Adminhtml/Product/Options/Ajax.php # Formatter intorduces long line -app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php +app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php # Formatter intorduces long line app/code/Magento/Adminhtml/Block/Page/System/Config/Robots/Reset.php # Formatter intorduces long line -app/code/Magento/Adminhtml/Block/System/Store/Edit.php +app/code/Magento/Backend/Block/System/Store/Edit.php # Not magento code app/code/Zend # Not magento code dev/tools/Magento/Tools/I18n/Zend -# Not required to scan build director -dev/build # Not magento code dev/tools/layout # Not magento code dev/tools/xml # PSR-1 not applied to -dev/tests/functional +dev/tests/functional-old # PSR-1 not applied to dev/tests/js # Example files that are expected to fail code sniffer diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/ruleset.xml b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/ruleset.xml index f5d34c3cd440e3dc7a9235267881e3fac4134ca0..63a04bb214493c78ce089b05d427744da11a9d57 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/ruleset.xml +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/ruleset.xml @@ -40,6 +40,7 @@ <rule ref="PEAR.NamingConventions.ValidClassName"/> <rule ref="Squiz.Functions.GlobalFunction"/> <rule ref="Zend.NamingConventions.ValidVariableName"> + <!-- Excluding as it conflicts with the PSR2 standard which over rides this one --> <exclude name="Zend.NamingConventions.ValidVariableName.PrivateNoUnderscore"/> </rule> <rule ref="Generic.NamingConventions.UpperCaseConstantName"/> diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt index 85e7a4d5454558d08f3339d8a8c693eed0cba4b6..aa62825238e5573ae9943086fa7e03e233cf5277 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt @@ -2,17 +2,15 @@ # Glob patterns are supported # app/bootstrap.php -app/code/Magento/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php -app/code/Magento/Adminhtml/Block/Customer/Edit/Tab/Account.php app/code/Magento/Adminhtml/Model/Observer.php app/code/Magento/Adminhtml/Block/Urlrewrite app/code/Magento/Adminhtml/Block/Page/System/Config/Robots/Reset.php -app/code/Magento/Adminhtml/Block/System/Store/Edit -app/code/Magento/Adminhtml/Block/System/Store/Edit.php app/code/Magento/Adminhtml/Controller/Report/Customer.php app/code/Magento/Adminhtml/Controller/Report/Product.php app/code/Magento/Adminhtml/Controller/Report/Product.php app/code/Magento/Adminhtml/Controller/Urlrewrite.php +app/code/Magento/Backend/Block/System/Store/Edit +app/code/Magento/Backend/Block/System/Store/Edit.php app/code/Magento/Bundle/Model/Plugin app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php @@ -39,6 +37,7 @@ app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php app/code/Magento/Centinel/Model/State/Jcb.php app/code/Magento/Checkout/Block/Cart/Link.php app/code/Magento/Checkout/Block/Link.php +app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php app/code/Magento/Cms/Controller/Router.php app/code/Magento/Cms/Model/Template/FilterProvider.php app/code/Magento/Core/data @@ -49,14 +48,11 @@ app/code/Magento/Core/Model/DataService app/code/Magento/Core/Model/Design.php app/code/Magento/Core/Model/Email/Template/Config app/code/Magento/Core/Model/Email/Template/Config.php -app/code/Magento/Core/Model/EntryPoint -app/code/Magento/Core/Model/AbstractEntryPoint.php app/code/Magento/Core/Model/Layout/Factory.php app/code/Magento/Core/Model/Layout/Update.php app/code/Magento/Core/Model/Layout/Argument app/code/Magento/Core/Model/Locale/Validator.php app/code/Magento/Core/Model/LocaleInterface.php -app/code/Magento/Core/Model/ObjectManager app/code/Magento/Core/Model/Page app/code/Magento/Core/Model/Page.php app/code/Magento/Core/Model/Resource/Theme @@ -78,6 +74,7 @@ app/code/Magento/Cron/Model/Config.php app/code/Magento/Cron/Model/ConfigInterface.php app/code/Magento/Directory/Helper app/code/Magento/Customer/Block/Account/{Authorization,Register}Link.php +app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php app/code/Magento/Customer/Model/Address/Config app/code/Magento/Customer/Model/Address/Config.php app/code/Magento/Directory/Model/Currency/DefaultLocator.php @@ -103,11 +100,7 @@ app/code/Magento/Index/Model/Indexer/Config.php app/code/Magento/Index/Model/Indexer/ConfigInterface.php app/code/Magento/Index/Model/Indexer/Factory.php app/code/Magento/Index/Model/Indexer/AbstractIndexer.php -app/code/Magento/Index/Model/EntryPoint/Shell.php -app/code/Magento/Index/Model/EntryPoint/Indexer.php app/code/Magento/Index/Model/Shell.php -app/code/Magento/Install/Model/EntryPoint -app/code/Magento/Log/Model/EntryPoint app/code/Magento/Log/Model/Resource/Helper.php app/code/Magento/Log/Model/Resource/Shell.php app/code/Magento/Log/Model/Shell.php @@ -148,7 +141,8 @@ lib/Magento/Backup/Db lib/Magento/Backup/Factory.php lib/Magento/Cache/Core.php lib/Magento/Convert -lib/Magento/Date.php +lib/Magento/Stdlib/DateTime.php lib/Magento/Object.php lib/Magento/App +lib/Magento/ObjectManager lib/Magento/View diff --git a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php index 64a3009dc115b517b2d38f9fcaf78e8a9743473c..c9c872acdb3b6b1eab60328d5c566532c69c0568 100644 --- a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php +++ b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php @@ -90,6 +90,9 @@ class Adminhtml extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\LocaleInterface */ protected $_localeMock; + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Math\Random */ + protected $_mathMock; + protected function setUp() { // These mocks are accessed via context @@ -103,9 +106,9 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $this->_eventManagerMock = $this->_makeMock('Magento\Event\ManagerInterface'); $this->_controllerMock = $this->_makeMock('Magento\App\FrontController'); $this->_dirMock = $this->_makeMock('Magento\App\Dir'); - $this->_loggerMock = $this->_makeMock('Magento\Core\Model\Logger'); + $this->_loggerMock = $this->_makeMock('Magento\Logger'); $this->_filesystemMock = $this->_makeMock('Magento\Filesystem'); - $this->_cacheMock = $this->_makeMock('Magento\Core\Model\CacheInterface'); + $this->_cacheMock = $this->_makeMock('Magento\App\CacheInterface'); $this->_storeConfigMock = $this->_makeMock('Magento\Core\Model\Store\Config'); $this->_storeManagerMock = $this->_makeMock('Magento\Core\Model\StoreManager'); $this->_helperFactoryMock = $this->_makeMock('Magento\Core\Model\Factory\Helper'); @@ -116,8 +119,14 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $authorizationMock = $this->_makeMock('Magento\AuthorizationInterface'); $cacheStateMock = $this->_makeMock('Magento\Core\Model\Cache\StateInterface'); $appMock = $this->_makeMock('Magento\Core\Model\App'); + $escaperMock = $this->_makeMock('Magento\Escaper'); + $filterManagerMock = $this->_makeMock('Magento\Filter\FilterManager'); $backendSessionMock = $this->_makeMock('Magento\Backend\Model\Session'); $this->_localeMock = $this->_makeMock('Magento\Core\Model\LocaleInterface'); + $appState = $this->_makeMock('Magento\App\State'); + $this->_mathMock = $this->_makeMock('Magento\Math\Random'); + + $appState->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $this->_translatorMock ->expects($this->any()) @@ -147,8 +156,12 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $templateFactoryMock, $authorizationMock, $appMock, + $appState, + $escaperMock, + $filterManagerMock, $backendSessionMock, - $this->_localeMock + $this->_localeMock, + $this->_mathMock ); } diff --git a/dev/tests/unit/framework/bootstrap.php b/dev/tests/unit/framework/bootstrap.php index 80d8bf189010b6df17e253fb5115d60a27ededf1..6f62ed8039eed51716b52d5a72aa5e52d4e53a92 100755 --- a/dev/tests/unit/framework/bootstrap.php +++ b/dev/tests/unit/framework/bootstrap.php @@ -25,7 +25,8 @@ define('BP', realpath(__DIR__ . '/../../../../')); define('TESTS_TEMP_DIR', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'tmp'); define('DS', DIRECTORY_SEPARATOR); -require BP . '/app/code/Magento/Core/functions.php'; + +require BP . '/app/functions.php'; require BP . '/app/autoload.php'; \Magento\Autoload\IncludePath::addIncludePath(array( __DIR__, diff --git a/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php b/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php index f1a4503a09df8d71260d5322b24b33b4790d0920..ea326c7cd0e6fcd509819ca78c50cd73e3f5315c 100644 --- a/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php +++ b/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php @@ -39,7 +39,7 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase 'layout' => 'Magento\View\LayoutInterface', 'eventManager' => 'Magento\Event\ManagerInterface', 'translator' => 'Magento\Core\Model\Translate', - 'cache' => 'Magento\Core\Model\CacheInterface', + 'cache' => 'Magento\App\CacheInterface', 'design' => 'Magento\View\DesignInterface', 'session' => 'Magento\Core\Model\Session', 'storeConfig' => 'Magento\Core\Model\Store\Config', @@ -53,7 +53,7 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase */ protected $_modelDependencies = array( 'eventDispatcher' => 'Magento\Event\ManagerInterface', - 'cacheManager' => 'Magento\Core\Model\CacheInterface', + 'cacheManager' => 'Magento\App\CacheInterface', 'resource' => 'Magento\Core\Model\Resource\AbstractResource', 'resourceCollection' => 'Magento\Data\Collection\Db' ); @@ -72,15 +72,17 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase } $area = 'frontend'; - /** @var $layoutMock \Magento\Core\Model\Layout */ - $layoutMock = $this->getMockBuilder('Magento\View\LayoutInterface')->getMockForAbstractClass(); - $layoutMock->expects($this->once()) - ->method('getArea') - ->will($this->returnValue($area)); + /** @var $appStateMock \Magento\App\State|\PHPUnit_Framework_MockObject_MockObject */ + $appStateMock = $this->getMock('Magento\App\State', array('getAreaCode'), array(), '', false); + $appStateMock->expects($this->once())->method('getAreaCode')->will($this->returnValue($area)); + + $context = $objectManager->getObject('Magento\Core\Block\Template\Context'); + $appStateProperty = new \ReflectionProperty('Magento\Core\Block\Template\Context', '_appState'); + $appStateProperty->setAccessible(true); + $appStateProperty->setValue($context, $appStateMock); - $arguments = array('layout' => $layoutMock); /** @var $template \Magento\Core\Block\Template */ - $template = $objectManager->getObject('Magento\Core\Block\Template', $arguments); + $template = $objectManager->getObject('Magento\Core\Block\Template', array('context' => $context)); $this->assertEquals($area, $template->getArea()); } diff --git a/dev/tests/unit/testsuite/Magento/Acl/Resource/ProviderTest.php b/dev/tests/unit/testsuite/Magento/Acl/Resource/ProviderTest.php index 77a9b25b8feb8e5925d71db486676c11d88927ff..99b0e80021e73b2d284b4329e1bcf74fd03c4bdb 100644 --- a/dev/tests/unit/testsuite/Magento/Acl/Resource/ProviderTest.php +++ b/dev/tests/unit/testsuite/Magento/Acl/Resource/ProviderTest.php @@ -38,23 +38,23 @@ class ProviderTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_configScopeMock; + protected $_treeBuilderMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\State|\PHPUnit_Framework_MockObject_MockObject */ - protected $_treeBuilderMock; + protected $_appState; protected function setUp() { $this->_configReaderMock = $this->getMock('Magento\Config\ReaderInterface'); - $this->_configScopeMock = $this->getMock('Magento\Config\ScopeInterface'); + $this->_appState = $this->getMock('Magento\App\State', array('getAreaCode'), array(), '', false); $this->_treeBuilderMock = $this->getMock('Magento\Acl\Resource\TreeBuilder', array(), array(), '', false); $this->_model = new \Magento\Acl\Resource\Provider( $this->_configReaderMock, - $this->_configScopeMock, - $this->_treeBuilderMock + $this->_treeBuilderMock, + $this->_appState ); } @@ -62,7 +62,7 @@ class ProviderTest extends \PHPUnit_Framework_TestCase { $aclResourceConfig['config']['acl']['resources'] = array('ExpectedValue'); $scope = 'scopeName'; - $this->_configScopeMock->expects($this->once())->method('getCurrentScope')->will($this->returnValue($scope)); + $this->_appState->expects($this->once())->method('getAreaCode')->will($this->returnValue($scope)); $this->_configReaderMock->expects($this->once()) ->method('read')->with($scope)->will($this->returnValue($aclResourceConfig)); $this->_treeBuilderMock->expects($this->once()) @@ -73,7 +73,7 @@ class ProviderTest extends \PHPUnit_Framework_TestCase public function testGetIfAclResourcesEmpty() { $scope = 'scopeName'; - $this->_configScopeMock->expects($this->once())->method('getCurrentScope')->will($this->returnValue($scope)); + $this->_appState->expects($this->once())->method('getAreaCode')->will($this->returnValue($scope)); $this->_configReaderMock->expects($this->once()) ->method('read')->with($scope)->will($this->returnValue(array())); $this->_treeBuilderMock->expects($this->never())->method('build'); diff --git a/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/SecurityTest.php b/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/SecurityTest.php index 785d51128692cb9efb23ae23e72af41b146d3652..efff85fdf5c3b5c089f18ddfde0312be1f87e2be 100644 --- a/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/SecurityTest.php +++ b/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/SecurityTest.php @@ -53,7 +53,7 @@ class SecurityTest extends \PHPUnit_Framework_TestCase protected function setUp() { //Prepare objects for constructor - $this->_cacheMock = $this->getMock('Magento\Core\Model\CacheInterface'); + $this->_cacheMock = $this->getMock('Magento\App\CacheInterface'); $this->_storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array('getConfig'), array(), '', false); $this->_curlFactoryMock = $this->getMock('Magento\HTTP\Adapter\CurlFactory', diff --git a/dev/tests/unit/testsuite/Magento/Adminhtml/Block/Page/System/Config/Robots/ResetTest.php b/dev/tests/unit/testsuite/Magento/Adminhtml/Block/Page/System/Config/Robots/ResetTest.php index 1fb038fd69ad1a1f3250d77ca406a15606e0c2a3..73fdb3df357034fe8522a3673cadda4c9bc668ea 100644 --- a/dev/tests/unit/testsuite/Magento/Adminhtml/Block/Page/System/Config/Robots/ResetTest.php +++ b/dev/tests/unit/testsuite/Magento/Adminhtml/Block/Page/System/Config/Robots/ResetTest.php @@ -70,7 +70,7 @@ class ResetTest extends \PHPUnit_Framework_TestCase ->method('get') ->with('Magento\Core\Model\Registry') ->will($this->returnValue($coreRegisterMock)); - \Magento\Core\Model\ObjectManager::setInstance($objectManagerMock); + \Magento\App\ObjectManager::setInstance($objectManagerMock); } /** diff --git a/dev/tests/unit/testsuite/Magento/Adminhtml/DashboardTest.php b/dev/tests/unit/testsuite/Magento/Adminhtml/DashboardTest.php index 43a5caa5ff40a923cd46c6a92973c0b3910cb292..5dfb0e594519c0ec85549c1e5657bab953833d37 100644 --- a/dev/tests/unit/testsuite/Magento/Adminhtml/DashboardTest.php +++ b/dev/tests/unit/testsuite/Magento/Adminhtml/DashboardTest.php @@ -128,11 +128,11 @@ class DashboardTest extends \PHPUnit_Framework_TestCase ->method('create') ->with('Magento\HTTP\ZendClient') ->will($this->throwException($exceptionMock)); - $loggerMock = $this->getMock('Magento\Core\Model\Logger', array('logException'), array(), '', false); + $loggerMock = $this->getMock('Magento\Logger', array('logException'), array(), '', false); $loggerMock->expects($this->once())->method('logException')->with($exceptionMock); $objectManager->expects($this->at(2)) ->method('get') - ->with('Magento\Core\Model\Logger') + ->with('Magento\Logger') ->will($this->returnValue($loggerMock)); $this->_response->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Adminhtml/Model/LayoutUpdate/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/Adminhtml/Model/LayoutUpdate/ValidatorTest.php index fcbfc7e2cf8a4b1d7e1dcbdf2bc23ed1560d7e59..31c776f5af88ce6098eeaac579f875e96394c73f 100644 --- a/dev/tests/unit/testsuite/Magento/Adminhtml/Model/LayoutUpdate/ValidatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Adminhtml/Model/LayoutUpdate/ValidatorTest.php @@ -46,7 +46,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase */ protected function _createValidator($layoutUpdate, $isSchemaValid = true) { - $modulesReader = $this->getMockBuilder('Magento\Core\Model\Config\Modules\Reader') + $modulesReader = $this->getMockBuilder('Magento\Module\Dir\Reader') ->disableOriginalConstructor() ->getMock(); $modulesReader->expects($this->exactly(2)) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/PrimaryTest.php b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/PrimaryTest.php similarity index 92% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/PrimaryTest.php rename to dev/tests/unit/testsuite/Magento/App/Config/FileResolver/PrimaryTest.php index 4363a073a3cfae20252db98cde91efbf765b1ab1..518b774b0d0e2128606dda878126db75b7f6b7cd 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/PrimaryTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/PrimaryTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\FileResolver; +namespace Magento\App\Config\FileResolver; class PrimaryTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Config\FileResolver\Primary + * @var \Magento\App\Config\FileResolver\Primary */ protected $_model; @@ -42,7 +42,7 @@ class PrimaryTest extends \PHPUnit_Framework_TestCase ->with(\Magento\App\Dir::CONFIG) ->will($this->returnValue($appConfigDir)); - $this->_model = new \Magento\Core\Model\Config\FileResolver\Primary($applicationDirsMock); + $this->_model = new \Magento\App\Config\FileResolver\Primary($applicationDirsMock); } /** diff --git a/app/code/Magento/Page/view/frontend/page_fragment.phtml b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/app/etc/config.xml similarity index 91% rename from app/code/Magento/Page/view/frontend/page_fragment.phtml rename to dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/app/etc/config.xml index aacde2c9dc2dffdbd78f06228fceea1431bc13a6..f6c9778e9154df6fc66b6b037ba8f87b5daba5de 100644 --- a/app/code/Magento/Page/view/frontend/page_fragment.phtml +++ b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/app/etc/config.xml @@ -1,4 +1,5 @@ -<?php +<?xml version="1.0"?> +<!-- /** * Magento * @@ -18,10 +19,11 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category design + * @category Magento * @package Magento_Core + * @subpackage unit_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -?> -<?php echo $this->getChildHtml() ?> \ No newline at end of file +--> +<config/> diff --git a/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/app/etc/custom/config.xml b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/app/etc/custom/config.xml new file mode 100644 index 0000000000000000000000000000000000000000..f6c9778e9154df6fc66b6b037ba8f87b5daba5de --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/app/etc/custom/config.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Core + * @subpackage unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config/> diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/_files/Acme/Subscriber/etc/module.xml b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/primary/app/etc/di.xml similarity index 91% rename from dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/_files/Acme/Subscriber/etc/module.xml rename to dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/primary/app/etc/di.xml index 3c8188df6d8f2ac409c069a7fb3834fe6c683c0f..b75f5d5381c9a5b50fbdae2e05c98c865e96fa52 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/_files/Acme/Subscriber/etc/module.xml +++ b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/primary/app/etc/di.xml @@ -23,6 +23,4 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<config> - <module name="Acme_Subscriber" version="0.0.1" active="true" /> -</config> +<config/> diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/_files/Acme/Subscriber/etc/module.xml b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/primary/app/etc/some_config/di.xml similarity index 91% rename from dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/_files/Acme/Subscriber/etc/module.xml rename to dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/primary/app/etc/some_config/di.xml index 0ca009521143366ed0fbdecca0a5ad71c8f39dd6..b75f5d5381c9a5b50fbdae2e05c98c865e96fa52 100644 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/_files/Acme/Subscriber/etc/module.xml +++ b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/_files/primary/app/etc/some_config/di.xml @@ -23,6 +23,4 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<config> - <module name="Acme_Subscriber" version="1.0.0.1" active="true" /> -</config> +<config/> diff --git a/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php b/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..204ab3ee6069447629772e1bb3331f26a00a25c9 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php @@ -0,0 +1,76 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\App\Config; + +class LoaderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\App\Config\Loader + */ + protected $_model; + + /** + * @var \Magento\App\Dir | \PHPUnit_Framework_MockObject_MockObject + */ + protected $_dirs; + + public function setUp() + { + $this->_dirs = $this->getMock('\Magento\App\Dir', array('getDir'), array(), '', false); + } + + public function testWithOneXmlFile() + { + $this->_dirs->expects($this->once())->method('getDir')->will($this->returnValue(__DIR__ . '/_files')); + $this->_model = new \Magento\App\Config\Loader($this->_dirs); + $expected = array( + 'resource' => 'resource name', + 'connection' => 'connection name', + 'other' => 'other value', + ); + $this->assertEquals($expected, $this->_model->load()); + } + + public function testWithTwoXmlFileMerging() + { + $this->_dirs->expects($this->once())->method('getDir')->will($this->returnValue(__DIR__ . '/_files')); + $this->_model = new \Magento\App\Config\Loader($this->_dirs, 'other/local_developer.xml'); + $expected = array( + 'resource' => 'resource name2', + 'connection' => 'connection name2', + 'other' => 'new other value', + 'new' => 'new value', + ); + $this->assertEquals($expected, $this->_model->load()); + } + + public function testWithoutXmlFiles() + { + $this->_dirs->expects($this->once())->method('getDir')->will($this->returnValue(__DIR__ . '/notExistFolder')); + $this->_model = new \Magento\App\Config\Loader($this->_dirs); + $this->assertEquals(array(), $this->_model->load()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/Config/_files/local.xml b/dev/tests/unit/testsuite/Magento/App/Config/_files/local.xml new file mode 100644 index 0000000000000000000000000000000000000000..e14230a3d40ec3b1f7dfcb18df22d7be3c258704 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/Config/_files/local.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <resource>resource name</resource> + <connection>connection name</connection> + <other>other value</other> +</config> diff --git a/dev/tests/unit/testsuite/Magento/App/Config/_files/other/local_developer.xml b/dev/tests/unit/testsuite/Magento/App/Config/_files/other/local_developer.xml new file mode 100644 index 0000000000000000000000000000000000000000..9b17bb0856a6407583fea0caaecd315eff0ceec2 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/Config/_files/other/local_developer.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <resource>resource name2</resource> + <connection>connection name2</connection> + <other>new other value</other> + <new>new value</new> +</config> diff --git a/dev/tests/unit/testsuite/Magento/App/ConfigTest.php b/dev/tests/unit/testsuite/Magento/App/ConfigTest.php new file mode 100644 index 0000000000000000000000000000000000000000..58724b2ce030006d2ca75f59df5c1c53dd486d91 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/ConfigTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App; + +class ConfigTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\App\Config + */ + protected $_config; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_loaderMock; + + protected function setUp() + { + $this->_loaderMock = $this->getMock('Magento\App\Config\Loader', array(), array(), '', false); + $params = array( + 'connection' => array('default' => array('connection_name')), + 'resource' => array('name' => array('default_setup')) + ); + $this->_loaderMock->expects($this->any())->method('load')->will($this->returnValue($params)); + $this->_config = new \Magento\App\Config( + array(), + $this->_loaderMock + ); + } + + /** + * @param string $connectionName + * @param array|null $connectionDetail + * @dataProvider getConnectionDataProvider + */ + public function testGetConnection($connectionDetail, $connectionName) + { + $this->assertEquals($connectionDetail, $this->_config->getConnection($connectionName)); + } + + public function getConnectionDataProvider() + { + return array( + 'connection_name_exist' => array(array('connection_name'), 'default'), + 'connection_name_not_exist' => array(null, 'new_default') + ); + } + + public function testGetConnections() + { + $this->assertEquals(array('default' => array('connection_name')), $this->_config->getConnections()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/CronTest.php b/dev/tests/unit/testsuite/Magento/App/CronTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e73c8d5e3168217a1b7a66ab730ba1eff89d63c4 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/CronTest.php @@ -0,0 +1,64 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App; + +class CronTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\App\Cron + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_eventManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_configScopeMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_stateMock; + + protected function setUp() + { + $this->_eventManagerMock = $this->getMock('Magento\Event\ManagerInterface'); + $this->_stateMock = $this->getMock('Magento\App\State', array(), array(), '', false); + $this->_model = new Cron( + $this->_eventManagerMock, + $this->_stateMock + ); + } + + public function testExecuteDispatchesCronEvent() + { + $this->_stateMock->expects($this->once())->method('setAreaCode')->with('crontab'); + $this->_eventManagerMock->expects($this->once())->method('dispatch')->with('default'); + $this->assertEquals(0, $this->_model->execute()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/Dir/VerificationTest.php b/dev/tests/unit/testsuite/Magento/App/Dir/VerificationTest.php index 3c6bc232a4e21cd3c7db8da07ae6864053085ee2..11a250abf171eb753faf33b58991df3ed27f5cc6 100644 --- a/dev/tests/unit/testsuite/Magento/App/Dir/VerificationTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Dir/VerificationTest.php @@ -69,7 +69,11 @@ class VerificationTest extends \PHPUnit_Framework_TestCase protected function _createModelForVerification($mode, $isExist, &$actualCreatedDirs, &$actualVerifiedDirs) { $dirs = new \Magento\App\Dir('base_dir'); - $appState = new \Magento\App\State(time(), $mode); + $appState = new \Magento\App\State( + $this->getMockForAbstractClass('Magento\Config\ScopeInterface', array(), '', false), + time(), + $mode + ); $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); $filesystem->expects($this->any()) @@ -151,7 +155,10 @@ class VerificationTest extends \PHPUnit_Framework_TestCase 'Cannot create or verify write access: base_dir/var/log, base_dir/var/session'); $dirs = new \Magento\App\Dir('base_dir'); - $appState = new \Magento\App\State(time()); + $appState = new \Magento\App\State( + $this->getMockForAbstractClass('Magento\Config\ScopeInterface', array(), '', false), + time() + ); $callback = function ($dir) { if (($dir == 'base_dir/var/log') || ($dir == 'base_dir/var/session')) { @@ -179,7 +186,10 @@ class VerificationTest extends \PHPUnit_Framework_TestCase 'Cannot create or verify write access: base_dir/var/log, base_dir/var/session'); $dirs = new \Magento\App\Dir('base_dir'); - $appState = new \Magento\App\State(time()); + $appState = new \Magento\App\State( + $this->getMockForAbstractClass('Magento\Config\ScopeInterface', array(), '', false), + time() + ); $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); $filesystem->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php b/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php new file mode 100644 index 0000000000000000000000000000000000000000..425626d29a7881ba67edd2f10d430db296ff90b4 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php @@ -0,0 +1,89 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App\EntryPoint; + +class EntryPointTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\App\EntryPoint\EntryPoint + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_objectManagerMock; + + /** + * @var string + */ + protected $_rootDir; + + /** + * @var array() + */ + protected $_parameters; + + protected function setUp() + { + $this->_parameters = array( + 'MAGE_MODE' => 'developer', + ); + $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); + $this->_rootDir = realpath(__DIR__ . '/../../../../../../../'); + $this->_model = new \Magento\App\EntryPoint\EntryPoint( + $this->_rootDir, + $this->_parameters, + $this->_objectManagerMock + ); + } + + public function testRunExecutesApplication() + { + $applicationName = '\Magento\App\TestApplication'; + $applicationMock = $this->getMock('\Magento\AppInterface'); + $applicationMock->expects($this->once())->method('execute')->will($this->returnValue(0)); + $this->_objectManagerMock->expects($this->once())->method('create')->with($applicationName, array()) + ->will($this->returnValue($applicationMock)); + + $this->assertEquals(0, $this->_model->run($applicationName)); + } + + public function testRunCatchesExceptionThrownByApplication() + { + $applicationName = '\Magento\App\TestApplication'; + $applicationMock = $this->getMock('\Magento\AppInterface'); + $applicationMock->expects($this->once()) + ->method('execute') + ->will($this->throwException(new \Exception('Something went wrong.'))); + $this->_objectManagerMock->expects($this->once()) + ->method('create') + ->with($applicationName, array()) + ->will($this->returnValue($applicationMock)); + // clean output + ob_start(); + $this->assertEquals(1, $this->_model->run($applicationName)); + ob_end_clean(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php b/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..beee931fd0cd4b2b495fce56c71f306df372a3ae --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php @@ -0,0 +1,130 @@ +<?php +/** + * Unit Test for \Magento\App\Error\Handler + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App\Error; + +class HandlerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_loggerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_dirMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_appStateMock; + + protected function setUp() + { + $this->_loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); + $this->_dirMock = $this->getMock('Magento\App\Dir', array(), array(BP), '', true); + $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); + } + + /** + * @covers \Magento\Error\Handler::__construct + * @covers \Magento\Error\Handler::processException + */ + public function testProcessExceptionPrint() + { + $handler = new \Magento\App\Error\Handler($this->_loggerMock, $this->_dirMock, $this->_appStateMock); + $this->_appStateMock->expects($this->any())->method('getMode') + ->will($this->returnValue(\Magento\App\State::MODE_DEVELOPER)); + $exception = new \Exception('TestMessage'); + + ob_start(); + $handler->processException($exception); + $actualResult = ob_get_contents(); + ob_end_clean(); + $this->assertRegExp('/TestMessage/', $actualResult); + } + + /** + * @covers \Magento\Error\Handler::__construct + * @covers \Magento\Error\Handler::processException + */ + public function testProcessExceptionReport() + { + $handler = new \Magento\App\Error\Handler($this->_loggerMock, $this->_dirMock, $this->_appStateMock); + $this->_appStateMock->expects($this->any())->method('getMode') + ->will($this->returnValue(\Magento\App\State::MODE_DEFAULT)); + $this->_dirMock->expects($this->atLeastOnce()) + ->method('getDir') + ->with(\Magento\App\Dir::PUB) + ->will($this->returnValue(dirname(__DIR__) . DS . '..' . DS . '_files')); + + $exception = new \Exception('TestMessage'); + $handler->processException($exception); + } + + /** + * @covers \Magento\Error\Handler::__construct + * @covers \Magento\Error\Handler::handler + * @throws \Exception + */ + public function testErrorHandlerLogging() + { + $handler = new \Magento\App\Error\Handler($this->_loggerMock, $this->_dirMock, $this->_appStateMock); + $this->_appStateMock->expects($this->any())->method('getMode') + ->will($this->returnValue(\Magento\App\State::MODE_DEFAULT)); + $this->_loggerMock->expects($this->once()) + ->method('log') + ->with($this->stringContains('testErrorHandlerLogging'), \Zend_Log::ERR); + set_error_handler(array($handler, 'handler')); + try { + trigger_error('testErrorHandlerLogging', E_USER_NOTICE); + restore_error_handler(); + } catch (\Exception $e) { + restore_error_handler(); + throw $e; + } + } + + /** + * @covers \Magento\Error\Handler::__construct + * @covers \Magento\Error\Handler::handler + * @expectedException \Exception + * @throws \Exception + */ + public function testErrorHandlerPrint() + { + $handler = new \Magento\App\Error\Handler($this->_loggerMock, $this->_dirMock, $this->_appStateMock); + $this->_appStateMock->expects($this->any())->method('getMode') + ->will($this->returnValue(\Magento\App\State::MODE_DEVELOPER)); + set_error_handler(array($handler, 'handler')); + try { + trigger_error('testErrorHandlerPrint', E_USER_NOTICE); + } catch (\Exception $e) { + restore_error_handler(); + throw $e; + } + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/FrontClass.php b/dev/tests/unit/testsuite/Magento/App/FrontClass.php similarity index 97% rename from dev/tests/unit/testsuite/Magento/Core/Model/FrontClass.php rename to dev/tests/unit/testsuite/Magento/App/FrontClass.php index 9fa02871d737743c336e089ff1a4a1b95ecaa09c..e869a008b809313435e0fa43c92b99c4745cb976 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/FrontClass.php +++ b/dev/tests/unit/testsuite/Magento/App/FrontClass.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\App; class FrontClass diff --git a/dev/tests/unit/testsuite/Magento/App/FrontControllerTest.php b/dev/tests/unit/testsuite/Magento/App/FrontControllerTest.php index 38335400c91e29bf98d64b02cc7e1d7ae2205ca7..f08a293fce9e045124401c39f85ebd8d0826f32d 100644 --- a/dev/tests/unit/testsuite/Magento/App/FrontControllerTest.php +++ b/dev/tests/unit/testsuite/Magento/App/FrontControllerTest.php @@ -31,11 +31,6 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase */ protected $_model; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_eventManager; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -58,48 +53,39 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - $this->_response = $this->getMock('Magento\App\ResponseInterface', array(), array(), '', false); - $this->_routerList = $this->getMock('Magento\App\RouterList', array('getRouters'), array(), '', false); - $this->_request = $this->getMock('Magento\App\RequestInterface', array('isDispatched', 'getModuleName', - 'setModuleName', 'getActionName', 'setActionName', 'getParam')); + $this->_response = $this->getMock('Magento\App\Response\Http', array(), array(), '', false); + $this->_request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); $this->_router = $this->getMock('Magento\App\Router\AbstractRouter', - array('setFront', 'match'), array(), '', false); - $this->_model = new \Magento\App\FrontController($this->_eventManager, $this->_response, $this->_routerList); + array('match'), array(), '', false); + $this->_routerList = $this->getMock('Magento\App\RouterList', array(), array(), '', false); + $this->_routerList->expects($this->any()) + ->method('getIterator')->will($this->returnValue($this->_routerList)); + $this->_model = new \Magento\App\FrontController($this->_response, $this->_routerList); } /** * @expectedException \LogicException + * @expectedExceptionMessage Front controller reached 100 router match iterations */ public function testDispatchThrowException() { - $this->_routerList->expects($this->any())->method('getRouters')->will($this->returnValue($this->_router)); - $this->_model->dispatch($this->_request); - $this->_eventManager->expects($this->never())->method('dispatch'); - } - - public function testWhenRequestDispatched() - { - $this->_request->expects($this->once())->method('isDispatched')->will($this->returnValue(true)); - $this->_routerList->expects($this->never())->method('getRouters'); - $this->_eventManager->expects($this->atLeastOnce())->method('dispatch'); + $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() { - $this->_router = $this->getMock('Magento\App\Router\AbstractRouter', - array('setFront', 'match'), array(), '', false); - $this->_routerList->expects($this->atLeastOnce())->method('getRouters') - ->will($this->returnValue(array($this->_router))); + $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)); $controllerInstance = $this->getMock('\Magento\App\ActionInterface'); $this->_router->expects($this->atLeastOnce())->method('match')->will($this->returnValue($controllerInstance)); $this->_request->expects($this->atLeastOnce())->method('getActionName')->will($this->returnValue('testString')); $controllerInstance->expects($this->atLeastOnce())->method('dispatch')->with('testString'); - $this->_model->dispatch($this->_request); } } diff --git a/dev/tests/unit/testsuite/Magento/App/ObjectManager/ConfigCacheTest.php b/dev/tests/unit/testsuite/Magento/App/ObjectManager/ConfigCacheTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f77c1db2f3d2d0a41a526739599032aa4fa8fa86 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/ObjectManager/ConfigCacheTest.php @@ -0,0 +1,66 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App\ObjectManager; +class ConfigCacheTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Magento\App\ObjectManager\ConfigCache + */ + protected $_configCache; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_cacheFrontendMock; + + protected function setUp() + { + $this->_cacheFrontendMock = $this->getMock('\Magento\Cache\FrontendInterface'); + $this->_configCache = new \Magento\App\ObjectManager\ConfigCache($this->_cacheFrontendMock); + } + + protected function tearDown() + { + unset($this->_configCache); + } + + public function testGet() + { + $key = 'key'; + $this->_cacheFrontendMock + ->expects($this->once()) + ->method('load') + ->with('diConfig' . $key) + ->will($this->returnValue(false)); + $this->assertEquals(false, $this->_configCache->get($key)); + } + + public function testSave() + { + $key = 'key'; + $config = array('config'); + $this->_cacheFrontendMock->expects($this->once())->method('save')->with(serialize($config), 'diConfig' . $key); + $this->_configCache->save($config, $key); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/ObjectManager/ConfigLoaderTest.php b/dev/tests/unit/testsuite/Magento/App/ObjectManager/ConfigLoaderTest.php similarity index 91% rename from dev/tests/unit/testsuite/Magento/Core/Model/ObjectManager/ConfigLoaderTest.php rename to dev/tests/unit/testsuite/Magento/App/ObjectManager/ConfigLoaderTest.php index ff9b13082200d2be347f8c3dd0ccc3ad6520ccc0..bcba0ebeca6d17c42e8ec99e2993f041e3f1ed68 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/ObjectManager/ConfigLoaderTest.php +++ b/dev/tests/unit/testsuite/Magento/App/ObjectManager/ConfigLoaderTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\ObjectManager; +namespace Magento\App\ObjectManager; class ConfigLoaderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\ObjectManager\ConfigLoader + * @var \Magento\App\ObjectManager\ConfigLoader */ protected $_model; @@ -47,7 +47,7 @@ class ConfigLoaderTest extends \PHPUnit_Framework_TestCase ); $this->_cacheMock = $this->getMock('Magento\Core\Model\Cache\Type\Config', array(), array(), '', false); - $this->_model = new \Magento\Core\Model\ObjectManager\ConfigLoader($this->_cacheMock, $this->_readerMock); + $this->_model = new \Magento\App\ObjectManager\ConfigLoader($this->_cacheMock, $this->_readerMock); } /** diff --git a/dev/tests/unit/testsuite/Magento/App/Request/HttpTest.php b/dev/tests/unit/testsuite/Magento/App/Request/HttpTest.php index 43be63bc46b38cbe3acd0840b160a639780c5130..51699cbe10221130ad5aca3f2dcdc0167a43f0e6 100644 --- a/dev/tests/unit/testsuite/Magento/App/Request/HttpTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Request/HttpTest.php @@ -38,7 +38,7 @@ class HttpTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_routerListMock = $this->getMock('\Magento\App\RouterList', array(), array(), '', false); + $this->_routerListMock = $this->getMock('Magento\App\Route\ConfigInterface'); } public function testGetOriginalPathInfoWithTestUri() @@ -122,8 +122,7 @@ class HttpTest extends \PHPUnit_Framework_TestCase public function testSetRouteNameWithRouter() { $router = $this->getMock('\Magento\App\Router\AbstractRouter', array(), array(), '', false); - $this->_routerListMock->expects($this->any())->method('getRouterByRoute')->will($this->returnValue($router)); - $router->expects($this->once())->method('getFrontNameByRoute')->will($this->returnValue('string')); + $this->_routerListMock->expects($this->any())->method('getRouteFrontName')->will($this->returnValue($router)); $this->_model = new \Magento\App\Request\Http($this->_routerListMock); $this->_model->setRouteName('RouterName'); $this->assertEquals('RouterName', $this->_model->getRouteName()); @@ -132,9 +131,7 @@ class HttpTest extends \PHPUnit_Framework_TestCase public function testSetRouteNameWithNullRouterValue() { $this->_model = new \Magento\App\Request\Http($this->_routerListMock); - $router = $this->getMock('\Magento\App\Router\AbstractRouter', array(), array(), '', false); - $this->_routerListMock->expects($this->once())->method('getRouterByRoute')->will($this->returnValue(null)); - $router->expects($this->never())->method('getFrontNameByRoute'); + $this->_routerListMock->expects($this->once())->method('getRouteFrontName')->will($this->returnValue(null)); $this->_model->setRouteName('RouterName'); } @@ -187,15 +184,11 @@ class HttpTest extends \PHPUnit_Framework_TestCase public function testGetRequestedRouteNameWithRewritePathInfo() { $this->_model = new \Magento\App\Request\Http($this->_routerListMock); - $routerAbstract = $this->getMock('\Magento\App\Router\AbstractRouter', array(), array(), '', false); $expected = 'TestValue'; $this->_model->setPathInfo($expected); $this->_model->rewritePathInfo($expected . '/other'); - $this->_routerListMock->expects($this->any())->method('getRouterByFrontName')->with($expected) - ->will($this->returnValue($routerAbstract)); - $routerAbstract->expects($this->any())->method('getRouteByFrontName')->with($expected) + $this->_routerListMock->expects($this->once())->method('getRouteByFrontName')->with($expected) ->will($this->returnValue($expected)); - $this->assertEquals($expected, $this->_model->getRequestedRouteName()); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/App/Resource/Config/ConverterTest.php similarity index 85% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/ConverterTest.php rename to dev/tests/unit/testsuite/Magento/App/Resource/Config/ConverterTest.php index f25035b2bb55bd6ce9d4b11fb6333e29c8631f2f..c16cdfaceb5ff50347a982d93419cf10254c7688 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Resource/Config/ConverterTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Config; +namespace Magento\App\Resource\Config; class ConverterTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Config\Converter + * @var \Magento\App\Resource\Config\Converter */ protected $_model; @@ -44,12 +44,9 @@ class ConverterTest extends \PHPUnit_Framework_TestCase { $this->_filePath = __DIR__ . '/_files' . DIRECTORY_SEPARATOR; $this->_source = new \DOMDocument(); - $this->_model = new \Magento\Core\Model\Resource\Config\Converter(); + $this->_model = new \Magento\App\Resource\Config\Converter(); } - /** - * @covers \Magento\Core\Model\Resource\Config\Converter::convert - */ public function testConvert() { $this->_source->loadXML(file_get_contents($this->_filePath . 'resources.xml')); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php similarity index 78% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/ReaderTest.php rename to dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php index 170cf6824fd6aeb85e8c34204549af17b63601ec..b5dae34873c3b76b17149e160958fae0e56ca390 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Config; +namespace Magento\App\Resource\Config; class ReaderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Config\Reader + * @var \Magento\App\Resource\Config\Reader */ protected $_model; @@ -66,18 +66,18 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->_fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $this->_validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); - $this->_schemaLocatorMock = $this->getMock('Magento\Core\Model\Resource\Config\SchemaLocator', + $this->_schemaLocatorMock = $this->getMock('Magento\App\Resource\Config\SchemaLocator', array(), array(), '', false); $this->_converterMock = $this->getMock( - 'Magento\Core\Model\Resource\Config\Converter', array(), array(), '', false + 'Magento\App\Resource\Config\Converter', array(), array(), '', false ); $this->_configLocalMock = $this->getMock( - 'Magento\Core\Model\Config\Local', array(), array(), '', false + 'Magento\App\Config', array(), array(), '', false ); - $this->_model = new \Magento\Core\Model\Resource\Config\Reader( + $this->_model = new \Magento\App\Resource\Config\Reader( $this->_fileResolverMock, $this->_converterMock, $this->_schemaLocatorMock, @@ -87,18 +87,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ); } - /** - * @covers \Magento\Core\Model\Resource\Config\Reader::read - */ public function testRead() { - $localConfig = array( - 'defaultSetup' => array( - 'name' => 'defaultSetup', - 'connection' => 'defaultConnection' - ) - ); - $modulesConfig = include ($this->_filePath . 'resources.php'); $expectedResult = array( @@ -112,14 +102,10 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ), 'defaultSetup' => array( 'name' => 'defaultSetup', - 'connection' => 'defaultConnection' + 'connection' => 'customConnection' ), ); - $this->_configLocalMock->expects($this->once()) - ->method('getResources') - ->will($this->returnValue($localConfig)); - $this->_fileResolverMock->expects($this->once()) ->method('get') ->will($this->returnValue(array($this->_filePath . 'resources.xml'))); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/App/Resource/Config/SchemaLocatorTest.php similarity index 58% rename from dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/SchemaLocatorTest.php rename to dev/tests/unit/testsuite/Magento/App/Resource/Config/SchemaLocatorTest.php index 438b0d050ae81c9e78db95a0a7c866050004abab..9ff830d4b9434415d893927ade79ead9dcb7f40f 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Resource/Config/SchemaLocatorTest.php @@ -21,37 +21,33 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Route\Config; +namespace Magento\App\Resource\Config; class SchemaLocatorTest extends \PHPUnit_Framework_TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var string */ - protected $_moduleReaderMock; + protected $_expected; /** - * @var \Magento\Core\Model\Route\Config\SchemaLocator + * @var \Magento\App\Resource\Config\SchemaLocator */ protected $_model; protected function setUp() { - $this->_moduleReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false - ); - $this->_moduleReaderMock->expects($this->any()) - ->method('getModuleDir')->with('etc', 'Magento_Core')->will($this->returnValue('schema_dir')); - $this->_model = new \Magento\Core\Model\Route\Config\SchemaLocator($this->_moduleReaderMock); + $this->_expected = BP . str_replace('\\', DIRECTORY_SEPARATOR, '\lib\Magento\App\etc\resources.xsd'); + $this->_model = new \Magento\App\Resource\Config\SchemaLocator(); } public function testGetSchema() { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'routes_merged.xsd', $this->_model->getSchema()); + $this->assertEquals($this->_expected, $this->_model->getSchema()); } public function testGetPerFileSchema() { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'routes.xsd', $this->_model->getPerFileSchema()); + $this->assertEquals($this->_expected, $this->_model->getPerFileSchema()); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/XsdTest.php b/dev/tests/unit/testsuite/Magento/App/Resource/Config/XsdTest.php similarity index 94% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/XsdTest.php rename to dev/tests/unit/testsuite/Magento/App/Resource/Config/XsdTest.php index 2f71bbdbbb30af3df886889397dcb92e1f1cc95e..fa4be927a4f3d2845d8987e8d6c324d9bb3a0773 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/XsdTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Resource/Config/XsdTest.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Config; +namespace Magento\App\Resource\Config; class XsdTest extends \PHPUnit_Framework_TestCase { @@ -38,7 +38,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_xsdSchema = BP . '/app/code/Magento/Core/etc/resources.xsd'; + $this->_xsdSchema = BP . '/lib/Magento/App/etc/resources.xsd'; $this->_xsdValidator = new \Magento\TestFramework\Utility\XsdValidator(); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/_files/invalidResourcesXmlArray.php b/dev/tests/unit/testsuite/Magento/App/Resource/Config/_files/invalidResourcesXmlArray.php similarity index 100% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/_files/invalidResourcesXmlArray.php rename to dev/tests/unit/testsuite/Magento/App/Resource/Config/_files/invalidResourcesXmlArray.php diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/_files/resources.php b/dev/tests/unit/testsuite/Magento/App/Resource/Config/_files/resources.php similarity index 100% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/_files/resources.php rename to dev/tests/unit/testsuite/Magento/App/Resource/Config/_files/resources.php diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/_files/resources.xml b/dev/tests/unit/testsuite/Magento/App/Resource/Config/_files/resources.xml similarity index 100% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/_files/resources.xml rename to dev/tests/unit/testsuite/Magento/App/Resource/Config/_files/resources.xml diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/_files/valid_resources.xml b/dev/tests/unit/testsuite/Magento/App/Resource/Config/_files/valid_resources.xml similarity index 100% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/_files/valid_resources.xml rename to dev/tests/unit/testsuite/Magento/App/Resource/Config/_files/valid_resources.xml diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/ResourceTest.php b/dev/tests/unit/testsuite/Magento/App/Resource/ConfigTest.php similarity index 88% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/ResourceTest.php rename to dev/tests/unit/testsuite/Magento/App/Resource/ConfigTest.php index 350e6033c75f6f6ccbf60142f95c84381ca58710..ddf48737c37b757cb047eef113644861006f8293 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/ResourceTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Resource/ConfigTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Resource; -class ResourceTest extends \PHPUnit_Framework_TestCase +class ConfigTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Config\Resource + * @var \Magento\App\Resource\Config */ protected $_model; @@ -56,7 +56,7 @@ class ResourceTest extends \PHPUnit_Framework_TestCase $this->_cacheMock = $this->getMock('Magento\Config\CacheInterface'); $this->_readerMock = $this->getMock( - 'Magento\Core\Model\Resource\Config\Reader', array(), array(), '', false + 'Magento\App\Resource\Config\Reader', array(), array(), '', false ); $this->_resourcesConfig = array( @@ -82,7 +82,7 @@ class ResourceTest extends \PHPUnit_Framework_TestCase ->method('load') ->will($this->returnValue(serialize($this->_resourcesConfig))); - $this->_model = new \Magento\Core\Model\Config\Resource( + $this->_model = new \Magento\App\Resource\Config( $this->_readerMock, $this->_scopeMock, $this->_cacheMock, @@ -91,7 +91,6 @@ class ResourceTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Config\Resource::getConnectionName * @dataProvider getConnectionNameDataProvider * @param string $resourceName * @param string $connectionName @@ -117,7 +116,7 @@ class ResourceTest extends \PHPUnit_Framework_TestCase ), array( 'resourceName' => 'brokenResourceName', - 'connectionName' => \Magento\Core\Model\Config\Resource::DEFAULT_SETUP_CONNECTION, + 'connectionName' => \Magento\App\Resource\Config::DEFAULT_SETUP_CONNECTION, ) ); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/App/Route/Config/ConverterTest.php similarity index 89% rename from dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/ConverterTest.php rename to dev/tests/unit/testsuite/Magento/App/Route/Config/ConverterTest.php index 85d133b4a4556905e1a35037493dc5dec5e538f8..026828f802e497b69493c58ac29fda0446e946f6 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Route/Config/ConverterTest.php @@ -21,18 +21,18 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Route\Config; +namespace Magento\App\Route\Config; class ConverterTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Route\Config\Converter + * @var \Magento\App\Route\Config\Converter */ protected $_model; protected function setUp() { - $this->_model = new \Magento\Core\Model\Route\Config\Converter(); + $this->_model = new \Magento\App\Route\Config\Converter(); } public function testConvert() diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/_files/routes.php b/dev/tests/unit/testsuite/Magento/App/Route/Config/_files/routes.php similarity index 95% rename from dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/_files/routes.php rename to dev/tests/unit/testsuite/Magento/App/Route/Config/_files/routes.php index 84b994d970eeeebeb09268a9409d3469e07ed9be..c038e4c4c125d3d7068c5cb15adbe83e7529455b 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/_files/routes.php +++ b/dev/tests/unit/testsuite/Magento/App/Route/Config/_files/routes.php @@ -33,8 +33,8 @@ return array( 'Magento_Catalog', 'Magento_Wishlist', 'Magento_Adminhtml', - 'Magento_GiftCard', - 'Magento_GiftCardAccount', + 'Magento_Customer', + 'Magento_Paypal', ), ), 'customer' => array( diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/_files/routes.xml b/dev/tests/unit/testsuite/Magento/App/Route/Config/_files/routes.xml similarity index 92% rename from dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/_files/routes.xml rename to dev/tests/unit/testsuite/Magento/App/Route/Config/_files/routes.xml index 2cce07cd5e1a23f2dc0f30b7ac44528cf3a41c59..5d9c5a47982f82834d75e100255270cf576dc8ed 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Route/Config/_files/routes.xml +++ b/dev/tests/unit/testsuite/Magento/App/Route/Config/_files/routes.xml @@ -30,8 +30,8 @@ <module name="Magento_Catalog" before="Magento_Adminhtml" /> <module name="Magento_Wishlist" before="Magento_Adminhtml" /> <module name="Magento_Sales" before="Magento_Catalog" /> - <module name="Magento_GiftCard" /> - <module name="Magento_GiftCardAccount" after="Magento_GiftCard" /> + <module name="Magento_Customer" /> + <module name="Magento_Paypal" after="Magento_Customer" /> </route> <route id="customer" frontName="customer"> <module name="Magento_Customer" before="Magento_Wishlist" /> diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Route/ConfigTest.php b/dev/tests/unit/testsuite/Magento/App/Route/ConfigTest.php similarity index 53% rename from dev/tests/unit/testsuite/Magento/Core/Model/Route/ConfigTest.php rename to dev/tests/unit/testsuite/Magento/App/Route/ConfigTest.php index 4ec644cfef5d929a9ad423b793f7c2bf172eff3a..ffaf1f1f5f7e2bca31ccf069a51b40203ea56909 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Route/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Route/ConfigTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Route; +namespace Magento\App\Route; class ConfigTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Route\Config + * @var \Magento\App\Route\Config */ protected $_config; @@ -40,38 +40,40 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected $_cacheMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_configScopeMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_areaList; + protected function setUp() { - $this->_readerMock = $this->getMock('Magento\Core\Model\Route\Config\Reader', array(), array(), '', false); + $this->_readerMock = $this->getMock('Magento\App\Route\Config\Reader', array(), array(), '', false); $this->_cacheMock = $this->getMock('Magento\Config\CacheInterface'); - $this->_config = new \Magento\Core\Model\Route\Config( + $this->_configScopeMock = $this->getMock('\Magento\Config\ScopeInterface'); + $this->_areaList = $this->getMock('\Magento\App\AreaList', array(), array(), '', false); + $this->_configScopeMock + ->expects($this->any()) + ->method('getCurrentScope') + ->will($this->returnValue('areaCode')); + $this->_config = new \Magento\App\Route\Config( $this->_readerMock, - $this->_cacheMock + $this->_cacheMock, + $this->_configScopeMock, + $this->_areaList ); } - public function testGetIfCacheIsArray() + public function testGetRouteFrontNameIfCacheIfRouterIdNotExist() { $this->_cacheMock->expects($this->once()) - ->method('load')->with('areaCode::RoutesConfig-routerCode') + ->method('load')->with('areaCode::RoutesConfig') ->will($this->returnValue(serialize(array('expected')))); - $this->assertEquals(array('expected'), $this->_config->getRoutes('areaCode', 'routerCode')); - } - - public function testGetIfKeyExist() - { - $this->_readerMock->expects($this->once()) - ->method('read')->with('areaCode')->will($this->returnValue(array())); - $this->assertEquals(array(), $this->_config->getRoutes('areaCode', 'routerCode')); + $this->assertEquals('routerCode', $this->_config->getRouteFrontName('routerCode')); } - public function testGetRoutes() - { - $areaConfig['routerCode']['routes'] = 'Expected Value'; - $this->_readerMock->expects($this->once()) - ->method('read')->with('areaCode')->will($this->returnValue($areaConfig)); - $this->_cacheMock->expects($this->once()) - ->method('save')->with(serialize('Expected Value'), 'areaCode::RoutesConfig-routerCode'); - $this->assertEquals('Expected Value', $this->_config->getRoutes('areaCode', 'routerCode')); - } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/RouterListTest.php b/dev/tests/unit/testsuite/Magento/App/RouterListTest.php similarity index 80% rename from dev/tests/unit/testsuite/Magento/Core/Model/RouterListTest.php rename to dev/tests/unit/testsuite/Magento/App/RouterListTest.php index 947dc27b876dd4e9b5ccf42b339e5ced7307548e..14a6969dadf21971ee5ac3e37e04306c1ece1d5a 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/RouterListTest.php +++ b/dev/tests/unit/testsuite/Magento/App/RouterListTest.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\App; class RouterListTest extends \PHPUnit_Framework_TestCase { @@ -55,7 +55,7 @@ class RouterListTest extends \PHPUnit_Framework_TestCase 'disable' => false, 'sortOrder' => 10 ), - 'defaultRouter' => array( + 'default' => array( 'instance' => 'DefaultClass', 'disable' => false, 'sortOrder' => 5 @@ -68,20 +68,12 @@ class RouterListTest extends \PHPUnit_Framework_TestCase public function testGetRoutes() { - $expectedResult = array( - 'defaultRouter' => new DefaultClass(), - 'frontendRouter' => new FrontClass(), - ); - + $expectedClass = new FrontClass(); $this->_objectManagerMock ->expects($this->at(0)) ->method('create') - ->will($this->returnValue(new DefaultClass())); - $this->_objectManagerMock - ->expects($this->at(1)) - ->method('create') - ->will($this->returnValue(new FrontClass())); + ->will($this->returnValue($expectedClass)); - $this->assertEquals($this->_model->getRouters(), $expectedResult); + $this->assertEquals($expectedClass, $this->_model->current('frontendRouter')); } } diff --git a/dev/tests/unit/testsuite/Magento/App/StateTest.php b/dev/tests/unit/testsuite/Magento/App/StateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..6a728fe65576549133a2012a40f8adf4c19e60dc --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/StateTest.php @@ -0,0 +1,90 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App; + +class StateTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\App\State + */ + protected $_model; + + /** + * @var \Magento\Config\ScopeInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_scopeMock; + + protected function setUp() + { + $this->_scopeMock = $this->getMockForAbstractClass( + 'Magento\Config\ScopeInterface', + array('setCurrentScope'), + '', + false + ); + $this->_model = new \Magento\App\State($this->_scopeMock, time()); + } + + public function testSetAreaCode() + { + $areaCode = 'some code'; + $this->_scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode); + $this->_model->setAreaCode($areaCode); + $this->setExpectedException('Magento\Exception'); + $this->_model->setAreaCode('any code'); + } + + public function testGetAreaCodeException() + { + $this->_scopeMock->expects($this->never())->method('setCurrentScope'); + $this->setExpectedException('Magento\Exception'); + $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()); + } + + public function testEmulateAreaCode() + { + $areaCode = 'original code'; + $emulatedCode = 'emulated code'; + $this->_scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode); + $this->_model->setAreaCode($areaCode); + $this->assertEquals( + $emulatedCode, + $this->_model->emulateAreaCode($emulatedCode, array($this, 'emulateAreaCodeCallback')) + ); + $this->assertEquals($this->_model->getAreaCode(), $areaCode); + } + + public function emulateAreaCodeCallback() + { + return $this->_model->getAreaCode(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Backend/App/Area/FrontNameResolverTest.php b/dev/tests/unit/testsuite/Magento/Backend/App/Area/FrontNameResolverTest.php index f3047d1b966b638ba27737c45d9576b24a2d23b4..3ddc6eb5cb65d088895fb06ca59fdd9ebdf1440c 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/App/Area/FrontNameResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/App/Area/FrontNameResolverTest.php @@ -43,7 +43,7 @@ class FrontNameResolverTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_configMock - = $this->getMock('\Magento\Core\Model\ConfigInterface', array('getValue', 'getNode', 'setNode', 'reinit')); + = $this->getMock('\Magento\Core\Model\ConfigInterface'); $this->_model = new \Magento\Backend\App\Area\FrontNameResolver($this->_configMock, $this->_defaultFrontName); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ExportTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ExportTest.php index e36220e4fe0a0be986d9858ffa7a6406dc362b83..4a67f14b30464809436ccf6218d7a116ac05e75c 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ExportTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ExportTest.php @@ -45,11 +45,9 @@ class ExportTest extends \PHPUnit_Framework_TestCase array(), array(), '', false, false ); - $coreHelper = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $factory = $this->getMock('Magento\Data\Form\Element\Factory', array(), array(), '', false); - $factoryColl = $this->getMock('Magento\Data\Form\Element\CollectionFactory', array(), array(), '', false); - $this->_object = new \Magento\Backend\Block\System\Config\Form\Field\Export( - $coreHelper, $factory, $factoryColl, $this->_helperFactoryMock + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_object = $objectManager->getObject('Magento\Backend\Block\System\Config\Form\Field\Export', array( + 'helperFactory' => $this->_helperFactoryMock) ); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/FieldArray/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/FieldArray/AbstractTest.php index 89c4d1b48e1e5e4b6f8614214dc99eaf750e3dad..e984fce11731440293644d5dbd572b8410256999 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/FieldArray/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/FieldArray/AbstractTest.php @@ -44,11 +44,9 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $block->expects($this->any()) ->method('escapeHtml') ->will($this->returnArgument(0)); - $coreHelper = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $factory = $this->getMock('Magento\Data\Form\Element\Factory', array(), array(), '', false); - $collectionFactory = $this->getMock('Magento\Data\Form\Element\CollectionFactory', array('create'), - array(), '', false); - $element = new \Magento\Data\Form\Element\Multiselect($coreHelper, $factory, $collectionFactory); + + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $element = $objectManager->getObject('Magento\Data\Form\Element\Multiselect'); $element->setValue(array( array( 'test' => 'test', diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/FormTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/FormTest.php index 6dd3c291b8ae1c6232218415c5bf4a6eed660655..8c109d795c061efa88b4ca2f1949314539d0c71f 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/FormTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/FormTest.php @@ -98,7 +98,7 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->_urlModelMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false, false); $configFactoryMock = $this->getMock('Magento\Backend\Model\Config\Factory', array(), array(), '', false, false); - $this->_formFactoryMock = $this->getMock('Magento\Data\Form\Factory', array('create'), + $this->_formFactoryMock = $this->getMock('Magento\Data\FormFactory', array('create'), array(), '', false, false); $this->_fieldsetFactoryMock = $this->getMock('Magento\Backend\Block\System\Config\Form\Fieldset\Factory', array(), array(), '', false, false diff --git a/dev/tests/unit/testsuite/Magento/Adminhtml/Block/System/Email/Template/EditTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Email/Template/EditTest.php similarity index 95% rename from dev/tests/unit/testsuite/Magento/Adminhtml/Block/System/Email/Template/EditTest.php rename to dev/tests/unit/testsuite/Magento/Backend/Block/System/Email/Template/EditTest.php index 434ae78c810cb73103eef04cf93b6596d414a263..62fcbfbbc8b618e95d75d630203b2b0bdd15c0a5 100644 --- a/dev/tests/unit/testsuite/Magento/Adminhtml/Block/System/Email/Template/EditTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Email/Template/EditTest.php @@ -25,12 +25,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Block\System\Email\Template; +namespace Magento\Backend\Block\System\Email\Template; class EditTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Adminhtml\Block\System\Email\Template\Edit + * @var \Magento\Backend\Block\System\Email\Template\Edit */ protected $_block; @@ -96,7 +96,7 @@ class EditTest extends \PHPUnit_Framework_TestCase 'emailConfig' => $this->_emailConfigMock, ); $arguments = $objectManager->getConstructArguments( - 'Magento\Adminhtml\Block\System\Email\Template\Edit', + 'Magento\Backend\Block\System\Email\Template\Edit', $params ); @@ -107,7 +107,7 @@ class EditTest extends \PHPUnit_Framework_TestCase $layoutMock->expects($this->any())->method('helper')->will($this->returnValue($helperMock)); - $this->_block = $objectManager->getObject('Magento\Adminhtml\Block\System\Email\Template\Edit', $arguments); + $this->_block = $objectManager->getObject('Magento\Backend\Block\System\Email\Template\Edit', $arguments); } public function testGetUsedCurrentlyForPaths() @@ -147,7 +147,7 @@ class EditTest extends \PHPUnit_Framework_TestCase $this->_configStructureMock->expects($this->any()) ->method('getElementByPathParts')->will($this->returnValueMap($map)); - $templateMock = $this->getMock('Magento\Adminhtml\Model\Email\Template', array(), array(), '', false, false); + $templateMock = $this->getMock('Magento\Backend\Model\Email\Template', array(), array(), '', false, false); $templateMock->expects($this->once()) ->method('getSystemConfigPathsWhereUsedCurrently') ->will($this->returnValue($this->_fixtureConfigPath)); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php index 9872fba8f15beefd860e35f347d44db26c877cfc..c648d6b3f8038f23d212a2caa8ea5b58418dcf4c 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php @@ -37,11 +37,6 @@ class ButtonTest extends \PHPUnit_Framework_TestCase */ protected $_layoutMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_helperMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -64,15 +59,8 @@ class ButtonTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_helperMock = - $this->getMock('Magento\Backend\Helper\Data', array('uniqHash'), array(), '', false, false); - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false); - $this->_layoutMock - ->expects($this->any()) - ->method('helper') - ->will($this->returnValue($this->_helperMock)); $this->_helperFactoryMock = $this->getMock( 'Magento\Core\Model\Factory\Helper', array('get'), array(), '', false, false @@ -93,7 +81,6 @@ class ButtonTest extends \PHPUnit_Framework_TestCase protected function tearDown() { unset($this->_layoutMock); - unset($this->_helperMock); unset($this->_buttonMock); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php index 8b35e0d36c5d975d6ddfe0812ea8dd45a0537f46..3bfe1e2654cce374472bea6be9915cccfff75a36 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php @@ -48,16 +48,11 @@ class GridTest extends \PHPUnit_Framework_TestCase * @covers \Magento\Backend\Block\Widget\Grid::getRssLists * @dataProvider addGetClearRssDataProvider */ - public function testAddGetClearRss($isUseStoreInUrl, $setStoreCount) + public function testAddGetClearRss($isUseStoreInUrl) { $helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $urlMock = $this->getMock('Magento\Core\Model\Url', array(), array(), '', false); - $urlMock->expects($this->at($setStoreCount)) - ->method('setStore'); - $urlMock->expects($this->any()) - ->method('getUrl') - ->will($this->returnValue('some_url')); $storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); $storeMock->expects($this->any()) @@ -73,14 +68,23 @@ class GridTest extends \PHPUnit_Framework_TestCase $appMock->expects($this->any()) ->method('getDefaultStoreView') ->will($this->returnValue($storeMock)); + $urlBuilderMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); - $contextMock = $this->getMock('\Magento\Backend\Block\Template\Context', array(), array(), '', false); + $contextMock = $this->getMock('Magento\Backend\Block\Template\Context', array(), array(), '', false); $contextMock->expects($this->any()) ->method('getStoreManager') ->will($this->returnValue($storeManagerMock)); $contextMock->expects($this->any()) ->method('getApp') ->will($this->returnValue($appMock)); + $contextMock->expects($this->any()) + ->method('getUrlBuilder') + ->will($this->returnValue($urlBuilderMock)); + + $urlBuilderMock->expects($this->any()) + ->method('getUrl') + ->will($this->returnValue('some_url')); + $block = new \Magento\Backend\Block\Widget\Grid($helperMock, $contextMock, $storeManagerMock, $urlMock); @@ -103,8 +107,8 @@ class GridTest extends \PHPUnit_Framework_TestCase public function addGetClearRssDataProvider() { return array( - array(true, 1), - array(false, 0), + array(true), + array(false) ); } } diff --git a/dev/tests/unit/testsuite/Magento/Adminhtml/Controller/System/AccountTest.php b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/AccountTest.php similarity index 96% rename from dev/tests/unit/testsuite/Magento/Adminhtml/Controller/System/AccountTest.php rename to dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/AccountTest.php index db832d341ef0ef9fa0f76c2be7b23a3d4d514180..89261dddbb047ffc368bce0fe9f167184929c412 100644 --- a/dev/tests/unit/testsuite/Magento/Adminhtml/Controller/System/AccountTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/AccountTest.php @@ -1,6 +1,6 @@ <?php /** - * Unit test for \Magento\Adminhtml\Controller\System\Account controller + * Unit test for \Magento\Backend\Controller\Adminhtml\System\Account controller * * Magento * @@ -25,11 +25,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Adminhtml\Controller\System; +namespace Magento\Backend\Controller\Adminhtml\System; class AccountTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Adminhtml\Controller\System\Account */ + /** @var \Magento\Backend\Controller\Adminhtml\System\Account */ protected $_controller; /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\RequestInterface */ @@ -138,7 +138,7 @@ class AccountTest extends \PHPUnit_Framework_TestCase $args = array('context' => $contextMock); $testHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_controller = $testHelper->getObject('Magento\Adminhtml\Controller\System\Account', $args); + $this->_controller = $testHelper->getObject('Magento\Backend\Controller\Adminhtml\System\Account', $args); } public function testSaveAction() diff --git a/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/Config/SaveTest.php b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/Config/SaveTest.php index a3342f3175ca1325584eb25655c055a0fc4773db..67a3a59f84aa163b39f592574156c6c69b71c9e3 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/Config/SaveTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Controller/Adminhtml/System/Config/SaveTest.php @@ -129,7 +129,7 @@ class SaveTest extends \PHPUnit_Framework_TestCase $configStructureMock, $this->_configFactoryMock, $this->_cacheMock, - null, + new \Magento\Stdlib\String, ) ); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Backend/Helper/DataTest.php index ea1b48b51ef13deca834d492de85cc252d0bbb1a..f22f08adfbfadb8f100eaa9c8f581eb5e42fffdb 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Helper/DataTest.php @@ -39,11 +39,6 @@ class DataTest extends \PHPUnit_Framework_TestCase */ protected $_configMock; - /** - * @var \Magento\Core\Model\Config\Primary - */ - protected $_primaryConfigMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -52,19 +47,16 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_configMock = $this->getMock('Magento\Core\Model\Config', array(), array(), '', false, false); - $this->_primaryConfigMock = - $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false, false); $this->_frontResolverMock = $this->getMock('\Magento\Backend\App\Area\FrontNameResolver', array(), array(), '', false); $this->_helper = new \Magento\Backend\Helper\Data( $this->getMock('Magento\Core\Helper\Context', array(), array(), '', false, false), - $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false, false), - $this->_primaryConfigMock, - $this->getMock('Magento\App\RouterList', array(), array(), '', false), + $this->getMock('\Magento\App\Route\Config', array(), array(), '', false), $this->getMock('Magento\Core\Model\App', array(), array(), '', false), $this->getMock('\Magento\Backend\Model\Url', array(), array(), '', false), $this->getMock('\Magento\Backend\Model\Auth', array(), array(), '', false), - $this->_frontResolverMock + $this->_frontResolverMock, + $this->getMock('\Magento\Math\Random', array(), array(), '', false) ); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php index f8a5fa537627490ce1d7c8f535eda6f690ad48d0..025f350bb0ec06312684226f4c325dc53e4b5f52 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php @@ -30,8 +30,8 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase $eventDispatcher = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $appState = $this->getMock('Magento\App\State', array(), array(), '', false); $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); - $cacheManager = $this->getMock('Magento\Core\Model\CacheInterface'); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $cacheManager = $this->getMock('Magento\App\CacheInterface'); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $context = new \Magento\Core\Model\Context( $logger, $eventDispatcher, diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php index 986df699b341ead315d0dc9f27ad2cb63ffcbbd8..795d2b5cec099520e290b5001fda8b7a86b5b2b5 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php @@ -26,7 +26,7 @@ namespace Magento\Backend\Model\Config\Backend; class EncryptedTest extends \PHPUnit_Framework_TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_helperMock; + protected $_encryptorMock; /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_configMock; @@ -56,11 +56,12 @@ class EncryptedTest extends \PHPUnit_Framework_TestCase ); $this->_configMock = $this->getMock('Magento\Core\Model\Config', array(), array(), '', false); $this->_helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); + $this->_encryptorMock = $this->getMock('Magento\Encryption\EncryptorInterface', array(), array(), '', false); $this->_model = $helper->getObject('Magento\Backend\Model\Config\Backend\Encrypted', array( - 'coreData' => $this->_helperMock, 'config' => $this->_configMock, 'context' => $contextMock, 'resource' => $this->_resourceMock, + 'encryptor' => $this->_encryptorMock )); } @@ -69,7 +70,8 @@ class EncryptedTest extends \PHPUnit_Framework_TestCase { $value = 'someValue'; $result = 'some value from parent class'; - $this->_helperMock->expects($this->once())->method('decrypt')->with($value)->will($this->returnValue($result)); + $this->_encryptorMock->expects($this->once())->method('decrypt')->with($value) + ->will($this->returnValue($result)); $this->assertEquals($result, $this->_model->processValue($value)); } @@ -93,7 +95,7 @@ class EncryptedTest extends \PHPUnit_Framework_TestCase ->method('getValue') ->with('some/path') ->will($this->returnValue('oldValue')); - $this->_helperMock->expects($this->once()) + $this->_encryptorMock->expects($this->once()) ->method('encrypt') ->with($valueToSave) ->will($this->returnValue('encrypted')); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php index 72c21528ce39df95aaa78002a270c7d92de65b82..15bebde7390db61e7a5b08b829dd2f454f090068 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php @@ -30,8 +30,8 @@ class SecureTest extends \PHPUnit_Framework_TestCase $eventDispatcher = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $appState = $this->getMock('Magento\App\State', array(), array(), '', false); $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); - $cacheManager = $this->getMock('Magento\Core\Model\CacheInterface'); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $cacheManager = $this->getMock('Magento\App\CacheInterface'); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $context = new \Magento\Core\Model\Context( $logger, $eventDispatcher, diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/SchemaLocatorTest.php index 3348c8c247a9338ca9935680d666185b2aabff57..4ba7c7a3d8dec5d218a4cff0d920428208ec773c 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/SchemaLocatorTest.php @@ -38,7 +38,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_moduleReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false + 'Magento\Module\Dir\Reader', array(), array(), '', false ); $this->_moduleReaderMock->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Source/Admin/PageTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Source/Admin/PageTest.php index 821880dbd85e23603abd1704e32afe5710b0e74a..df574e010a71a30ef43c7a6c110bb8f2242af0f2 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Source/Admin/PageTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Source/Admin/PageTest.php @@ -55,7 +55,7 @@ class PageTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $this->_menuModel = new \Magento\Backend\Model\Menu($logger); $this->_menuSubModel = new \Magento\Backend\Model\Menu($logger); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/BuilderTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/BuilderTest.php index 4af09d18f8218bfa582a88f139e1060baf532d01..93f2a00f737ac49f1df095df2d634d1d8b69127b 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/BuilderTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/BuilderTest.php @@ -50,7 +50,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase { $this->_factoryMock = $this->getMock("Magento\Backend\Model\Menu\Item\Factory", array(), array(), '', false); $this->_menuMock = $this->getMock('Magento\Backend\Model\Menu', array(), - array($this->getMock('Magento\Core\Model\Logger', array(), array(), '', false))); + array($this->getMock('Magento\Logger', array(), array(), '', false))); $this->_model = new \Magento\Backend\Model\Menu\Builder($this->_factoryMock, $this->_menuMock); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/SchemaLocatorTest.php index 8160d56b4d70f09578dd7fc6859251da0233f54f..663e2cafb397a8ddbe07a1a00968fcaa890db0e9 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Config/SchemaLocatorTest.php @@ -38,7 +38,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_moduleReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false + 'Magento\Module\Dir\Reader', array(), array(), '', false ); $this->_moduleReaderMock->expects($this->once()) ->method('getModuleDir')->with('etc', 'Magento_Backend')->will($this->returnValue('schema_dir')); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ConfigTest.php index 9e965e1495a2f8688dc104aac0e47178ddebc053..73adf6b5af40432cd7f58cdd2c85628119639c79 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ConfigTest.php @@ -93,7 +93,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase false, false); $this->_logger = $this->getMock( - 'Magento\Core\Model\Logger', array('addStoreLog', 'log', 'logException'), array(), '', false + 'Magento\Logger', array('addStoreLog', 'log', 'logException'), array(), '', false ); $this->_menuMock = $this->getMock('Magento\Backend\Model\Menu', array(), array(), '', false); @@ -110,6 +110,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_configReaderMock->expects($this->any())->method('read')->will($this->returnValue(array())); + $appState = $this->getMock('Magento\App\State', array('getAreaCode'), array(), '', false); + $appState->expects($this->any())->method('getAreaCode') + ->will($this->returnValue(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE)); + $this->_model = new \Magento\Backend\Model\Menu\Config( $this->_menuBuilderMock, $this->_directorMock, @@ -118,7 +122,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_cacheInstanceMock, $this->_eventManagerMock, $this->_logger, - $storeManagerMock + $storeManagerMock, + $appState ); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Director/DirectorTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Director/DirectorTest.php index 756a98e140f06604d5e41061496c7c6c8d3e787f..14f79704db3ec6d60e0052df0aa91930eb18db17 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Director/DirectorTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Director/DirectorTest.php @@ -64,7 +64,7 @@ class DirectorTest extends \PHPUnit_Framework_TestCase $this->_builderMock = $this->getMock('Magento\Backend\Model\Menu\Builder', array(), array(), '', false); $this->_logger = $this->getMock( - 'Magento\Core\Model\Logger', array('addStoreLog', 'log', 'logException'), array(), '', false + 'Magento\Logger', array('addStoreLog', 'log', 'logException'), array(), '', false ); $this->_commandMock = $this->getMock('Magento\Backend\Model\Menu\Builder\AbstractCommand', diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Filter/IteratorTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Filter/IteratorTest.php index e7d6610f94dc407619687be4cbb07936418c31df..8f368291dc9a5ef96ec02e7193e9dc065b7e75a8 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Filter/IteratorTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Filter/IteratorTest.php @@ -61,7 +61,7 @@ class IteratorTest extends \PHPUnit_Framework_TestCase $this->_items['item3']->expects($this->any())->method('isDisabled')->will($this->returnValue(false)); $this->_items['item3']->expects($this->any())->method('isAllowed')->will($this->returnValue(false)); - $loggerMock = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); $this->_menuModel = new \Magento\Backend\Model\Menu($loggerMock); $this->_filterIteratorModel = new \Magento\Backend\Model\Menu\Filter\Iterator($this->_menuModel->getIterator()); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php index 902dd9c56826792e640843a8a78a05e221d887c5..a550df6cd33c3887f557886be8727a74325ba348 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php @@ -93,7 +93,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase $this->_validatorMock = $this->getMock('Magento\Backend\Model\Menu\Item\Validator'); $this->_validatorMock->expects($this->any()) ->method('validate'); - $this->_moduleListMock = $this->getMock('Magento\App\ModuleListInterface'); + $this->_moduleListMock = $this->getMock('Magento\Module\ModuleListInterface'); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $helper->getObject('Magento\Backend\Model\Menu\Item', array( diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/MenuTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/MenuTest.php index 3309d3d76f4dd996c02de3a13b0479b41c58ca67..aaf8c4652c04da72f2c877d60e316cc7bda215d9 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/MenuTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/MenuTest.php @@ -35,7 +35,7 @@ class MenuTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -55,7 +55,7 @@ class MenuTest extends \PHPUnit_Framework_TestCase $this->_items['item3'] = $this->getMock('Magento\Backend\Model\Menu\Item', array(), array(), '', false); $this->_items['item3']->expects($this->any())->method('getId')->will($this->returnValue('item3')); - $this->_logger = $this->getMock('Magento\Core\Model\Logger', array('log'), array(), '', false); + $this->_logger = $this->getMock('Magento\Logger', array('log'), array(), '', false); $this->_model = new \Magento\Backend\Model\Menu($this->_logger); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Router/NoRouteHandlerTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Router/NoRouteHandlerTest.php index f13e8035a48343a0ea6f2dd22ccf529f15f954e7..97ea067968fad98aef543a5abf2b517965524bb1 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Router/NoRouteHandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Router/NoRouteHandlerTest.php @@ -61,7 +61,7 @@ class NoRouteHandlerTest extends \PHPUnit_Framework_TestCase $this->_requestMock ->expects($this->once()) ->method('setModuleName') - ->with('core') + ->with('admin') ->will($this->returnValue($this->_requestMock)); $this->_requestMock diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php index d7d8004226bf031e1c7164deef4aa85a1584c277..e79ef9f95b1ce7d8a85e0c4cf3c15c2e2584d17a 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php @@ -80,6 +80,11 @@ class UrlTest extends \PHPUnit_Framework_TestCase */ protected $_authSessionMock; + /** + * @var \Magento\Encryption\EncryptorInterface + */ + protected $_encryptor; + protected function setUp() { $this->_menuMock = $this->getMock('Magento\Backend\Model\Menu', array(), array(), '', false); @@ -120,13 +125,15 @@ class UrlTest extends \PHPUnit_Framework_TestCase $this->_authSessionMock = $this->getMock('Magento\Backend\Model\Auth\Session', array(), array(), '', false, false); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_encryptor = $this->getMock('Magento\Encryption\Encryptor', null, array(), '', false); $this->_model = $helper->getObject('Magento\Backend\Model\Url', array( 'coreStoreConfig' => $this->_storeConfigMock, 'backendHelper' => $helperMock, 'session' => $this->_coreSessionMock, 'menuConfig' => $this->_menuConfigMock, 'coreData' => $this->_coreDataMock, - 'authSession' => $this->_authSessionMock + 'authSession' => $this->_authSessionMock, + 'encryptor' => $this->_encryptor )); $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php index 9f33456ef03483fd098c26b3ebd20cc1865458d8..fc023bf4429d8fed61eae6078a61f6d7bf910d6c 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php @@ -98,7 +98,7 @@ class DataTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Captcha\Helper\Data::getConfigNode + * @covers \Magento\Captcha\Helper\Data::getConfig */ public function testGetConfigNode() { @@ -114,7 +114,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $factoryMock = $this->getMock('Magento\Captcha\Model\CaptchaFactory', array(), array(), '', false); $object = $this->_getHelper($store, $this->_getConfigStub(), $factoryMock); - $object->getConfigNode('enable'); + $object->getConfig('enable'); } public function testGetFonts() diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php index 46b7640828eeb5ca594329e138b1d119afb8081d..8806fdca25568d8fec04d99d36fd6f3ea25d1174 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php @@ -279,11 +279,11 @@ class DefaultTest extends \PHPUnit_Framework_TestCase { $helper = $this->getMockBuilder('Magento\Captcha\Helper\Data') ->disableOriginalConstructor() - ->setMethods(array('getConfigNode', 'getFonts', '_getWebsiteCode', 'getImgUrl')) + ->setMethods(array('getConfig', 'getFonts', '_getWebsiteCode', 'getImgUrl')) ->getMock(); $helper->expects($this->any()) - ->method('getConfigNode') + ->method('getConfig') ->will($this->returnCallback('Magento\Captcha\Model\DefaultTest::getConfigNodeStub')); $helper->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/GridTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/GridTest.php index c6fc8bdbdc19134ae32ab48f52dc4d22014a45d4..50bb19c79b91eaa3bcc5f629817559795181d1af 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/GridTest.php @@ -36,7 +36,7 @@ class GridTest extends \PHPUnit_Framework_TestCase ->method('getAttributeId') ->will($this->returnValue(2)); - $dirs = $this->getMock('Magento\App\Module\Dir', array(), array(), '', false); + $dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); $urlBuilder = $this->getMock('Magento\UrlInterface', array(), array(), '', false); $urlBuilder->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php index d32dd65321f0d25aa75187dad26280d89730551b..f4c98982f1fe887cf77215bf58dbecc117099193 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php @@ -50,7 +50,7 @@ class MatrixTest extends \PHPUnit_Framework_TestCase $data = array( 'application' => $this->_application, 'locale' => $this->_locale, - 'formFactory' => $this->getMock('Magento\Data\Form\Factory', array(), array(), '', false), + 'formFactory' => $this->getMock('Magento\Data\FormFactory', array(), array(), '', false), 'productFactory' => $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false), ); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php index 9dac38efc2d38e5a5995011db88c52738e310ad3..3ca7789496c14af52662c08534c9a6cfa91e8da1 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php @@ -43,12 +43,15 @@ class WeightTest extends \PHPUnit_Framework_TestCase public function testSetForm() { - $coreHelper = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $factory = $this->getMock('Magento\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactory = $this->getMock('Magento\Data\Form\Element\CollectionFactory', array('create'), array(), '', false); + $session = $this->getMock('\Magento\Core\Model\Session', array(), array(), '', false); - $form = new \Magento\Data\Form($factory, $collectionFactory); + $form = new \Magento\Data\Form($session, $factory, $collectionFactory); $helper = $this->getMock('Magento\Catalog\Helper\Product', array('getTypeSwitcherControlLabel'), array(), '', false, false @@ -73,13 +76,18 @@ class WeightTest extends \PHPUnit_Framework_TestCase ->with($this->equalTo($form)) ->will($this->returnSelf()); + $factory = $this->getMock('Magento\Data\Form\Element\Factory', array(), array(), '', false); $factory->expects($this->once()) ->method('create') ->with($this->equalTo('checkbox')) ->will($this->returnValue($this->_virtual)); - $this->_model = new \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Weight($coreHelper, $factory, - $collectionFactory, $helper); + $this->_model = $objectManager->getObject('\Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Weight', array( + 'factoryElement' => $factory, + 'factoryCollection' => $collectionFactory, + 'helper' => $helper, + )); + $this->_model->setForm($form); } } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/FlatTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/FlatTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e79291db67455d243cdabd94cbcea03cc766f765 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/FlatTest.php @@ -0,0 +1,37 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Helper\Product; + +class FlatTest extends \PHPUnit_Framework_TestCase +{ + public function testConstruct() + { + $flatFlag = $this->getMock('Magento\Catalog\Model\Product\Flat\Flag', array(), array(), '', false); + $flatFlag->expects($this->once())->method('loadSelf'); + + $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + $objectHelper->getObject('Magento\Catalog\Helper\Product\Flat', array('flatFlag' => $flatFlag)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/ReaderTest.php index 5539248f127a80aaca79edf29466139eafa2fd6e..4f257ee39f1ce60594b23a95d31b2f90883ee688 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/ReaderTest.php @@ -66,7 +66,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->_converter = $this->getMock('Magento\Catalog\Model\Attribute\Config\Converter', array('convert')); $moduleReader = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array('getModuleDir'), array(), '', false + 'Magento\Module\Dir\Reader', array('getModuleDir'), array(), '', false ); $moduleReader ->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/SchemaLocatorTest.php index a94bf4945eee628f9015fb8fb439ad988ca33c74..299b01a1bd0b096a3bf93e00d2db25c37df267db 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Attribute/Config/SchemaLocatorTest.php @@ -31,14 +31,14 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\Config\Modules\Reader|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Module\Dir\Reader|\PHPUnit_Framework_MockObject_MockObject */ protected $_moduleReader; protected function setUp() { $this->_moduleReader = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array('getModuleDir'), array(), '', false + 'Magento\Module\Dir\Reader', array('getModuleDir'), array(), '', false ); $this->_moduleReader ->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php index 4dcfce3d7688750f5c32287904d58e30930b7f1d..6339719cf9792386ea65cd2965073f93ae20ac55 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php @@ -47,7 +47,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase ->method('getAttributeCode') ->will($this->returnValue('category_ids')); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $model = new \Magento\Catalog\Model\Product\Attribute\Backend\Category($logger); $model->setAttribute($categoryAttribute); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php index 8518dc9469812c124cfc00d44bfd5d6e5bd17c8d..38a1e588417070fa91a9a06b5bb561d16d248228 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php @@ -48,7 +48,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase ->method('isPriceGlobal') ->will($this->returnValue(true)); - $loggerMock = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); $currencyFactoryMock = $this->getMock('Magento\Directory\Model\CurrencyFactory', array(), array(), '', false); $storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false); $productTypeMock = $this->getMock('Magento\Catalog\Model\Product\Type', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/ConfigurableTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/ConfigurableTest.php index a7022f10cd91a3fe0b4aa721aa629153f139b64d..e6e14033f9ed5da0fa0b50cb60ac6f571ce9906e 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/ConfigurableTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/ConfigurableTest.php @@ -52,7 +52,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); $confFactoryMock = $this->getMock('Magento\Catalog\Model\Resource\Product\Type\ConfigurableFactory', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/GroupedTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/GroupedTest.php index 4e93dbdc2f4d1ceb76964772d08b7e1f72a497b3..e89a63624dc430251b49c5f2dd78bb22351da291 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/GroupedTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/GroupedTest.php @@ -42,7 +42,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); $this->_model = $objectHelper->getObject('Magento\Catalog\Model\Product\Type\Grouped', array( 'eventManager' => $eventManager, diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php index a90a1eda776d0436e84fc130fc08b183a7071df8..3cc5eb8d84e8db53930c1be84d49eb688de116bb 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php @@ -42,7 +42,7 @@ class SimpleTest extends \PHPUnit_Framework_TestCase $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); $this->_model = $objectHelper->getObject('Magento\Catalog\Model\Product\Type\Simple', array( 'productFactory' => $productFactoryMock, diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php index 6166330f6d8b84654a170c5ded06007933d1a690..5f1bc3804e55764732068a1282a831bf3bd98e0b 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php @@ -42,7 +42,7 @@ class VirtualTest extends \PHPUnit_Framework_TestCase $coreRegistryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); $this->_model = $objectHelper->getObject('Magento\Catalog\Model\Product\Type\Virtual', array( 'eventManager' => $eventManager, diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/SchemaLocatorTest.php index b5875da0f678a06c86c7217812786ad0694be2b9..23f9e94c5587eb8fef5be917f781a2afa79cac75 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/SchemaLocatorTest.php @@ -38,7 +38,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_moduleReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false + 'Magento\Module\Dir\Reader', array(), array(), '', false ); $this->_moduleReaderMock->expects($this->once()) ->method('getModuleDir')->with('etc', 'Magento_Catalog')->will($this->returnValue('schema_dir')); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.php index e40fd2ecf957754f52bf75ede5bbdbce31222869..861299d133907bf6322df525d3cad36c28b753d7 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.php @@ -43,10 +43,25 @@ return array( 'model' => 'Instance_Type', 'composite' => false, 'index_priority' => 0, - 'can_use_qty_decimals' => false, + 'can_use_qty_decimals' => true, 'is_qty' => false, 'allowed_selection_types' => array( 'type_two' => 'type_two' ) + ), + 'type_three' => array( + 'name' => 'type_three', + 'label' => 'Label Three', + 'model' => 'Instance_Type', + 'composite' => false, + 'index_priority' => 20, + 'can_use_qty_decimals' => false, + 'is_qty' => false, + 'price_model' => 'Instance_Type_Three', + 'price_indexer' => 'Instance_Type_Three', + 'stock_indexer' => 'Instance_Type_Three', + 'allow_product_types' => array( + 'type_three' => 'type_three' + ) ) ); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.xml b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.xml index 6d71f197083dcca142bbed33bb9d4bcca0563741..b9966347d098afa199b343a2f7f5d3f355a5ce99 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.xml +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.xml @@ -38,4 +38,13 @@ <type name="type_two" /> </allowedSelectionTypes> </type> + <type name="type_three" label="Label Three" modelInstance="Instance_Type" composite="false" indexPriority="20" canUseQtyDecimals="false" isQty="false"> + <priceModel instance="Instance_Type_Three" /> + <indexerModel instance="Instance_Type_Three" /> + <false/> + <stockIndexerModel instance="Instance_Type_Three" /> + <allowProductTypes> + <type name="type_three" /> + </allowProductTypes> + </type> </config> diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/AbstractTest.php index a09bd8234bf62f28559d2ccd122c0ad907e3abfd..138452d2b373aefe705cefe037585b457fd42075 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/AbstractTest.php @@ -104,7 +104,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase 'Magento\Catalog\Model\Resource\AbstractResource', array('getAttributesByCode'), array( - $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false, false), + $this->getMock('Magento\App\Resource', array(), array(), '', false, false), $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false, false), $this->getMock('Magento\Eav\Model\Entity\Attribute\Set', array(), array(), '', false, false), $this->getMock('Magento\Core\Model\LocaleInterface'), diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Category/TreeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Category/TreeTest.php index b7b02ff0d133420733bb107a12a6fadcf91e114f..c0cd7ae4b51826a20873be9239447a1d92a2d7c6 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Category/TreeTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Category/TreeTest.php @@ -52,7 +52,7 @@ class TreeTest extends \PHPUnit_Framework_TestCase $select->expects($this->once())->method('from')->with('catalog_category_entity'); $connection = $this->getMock('Magento\DB\Adapter\AdapterInterface'); $connection->expects($this->once())->method('select')->will($this->returnValue($select)); - $this->_resource = $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false); + $this->_resource = $this->getMock('Magento\App\Resource', array(), array(), '', false); $this->_resource ->expects($this->once()) ->method('getConnection') @@ -87,9 +87,7 @@ class TreeTest extends \PHPUnit_Framework_TestCase ->with('catalog_category') ->will($this->returnValue($attributes)) ; - $collection = $this->getMock( - 'Magento\Catalog\Model\Resource\Category\Collection', array(), array(), '', false - ); + $collection = $this->getCollectionMock(); $collection->expects($this->once())->method('addAttributeToSelect')->with($attributes); $this->_collectionFactory ->expects($this->once()) @@ -100,4 +98,30 @@ class TreeTest extends \PHPUnit_Framework_TestCase // Makes sure the value is calculated only once $this->assertSame($collection, $this->_model->getCollection()); } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function getCollectionMock() + { + return $this->getMock('Magento\Catalog\Model\Resource\Category\Collection', array(), array(), '', false); + } + + public function testSetCollection() + { + $collection = $this->getCollectionMock(); + $this->_model->setCollection($collection); + + $this->assertSame($collection, $this->_model->getCollection()); + } + + public function testCallCleaningDuringSetCollection() + { + /** @var \Magento\Catalog\Model\Resource\Category\Tree $model */ + $model = $this->getMock('Magento\Catalog\Model\Resource\Category\Tree', array('_clean'), array(), '', false); + $model->expects($this->once())->method('_clean')->will($this->returnSelf()); + + $this->assertEquals($model, $model->setCollection($this->getCollectionMock())); + $this->assertEquals($model, $model->setCollection($this->getCollectionMock())); + } } diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php index 18da746a4527fcfb27ee8ba8c766af6c61ce86e7..96db86e4a28f2bdeee8802af37e81fab7955f154 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php @@ -63,7 +63,6 @@ class StockTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_coreHelperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $this->_factoryElementMock = $this->getMock('Magento\Data\Form\Element\Factory', array(), array(), '', false); $this->_collectionFactoryMock = $this->getMock('Magento\Data\Form\Element\CollectionFactory', array(), array(), '', false); @@ -74,7 +73,6 @@ class StockTest extends \PHPUnit_Framework_TestCase $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_block = $objectManagerHelper->getObject('Magento\CatalogInventory\Block\Adminhtml\Form\Field\Stock', array( - 'coreData' => $this->_coreHelperMock, 'factoryElement' => $this->_factoryElementMock, 'factoryCollection' => $this->_collectionFactoryMock, 'factoryText' => $this->_factoryTextMock, @@ -91,11 +89,11 @@ class StockTest extends \PHPUnit_Framework_TestCase $this->_qtyMock->expects($this->once())->method('setForm') ->with($this->isInstanceOf('Magento\Data\Form\Element\AbstractElement')); - $this->_block->setForm(new \Magento\Data\Form\Element\Text( - $this->_coreHelperMock, - $this->_factoryElementMock, - $this->_collectionFactoryMock - )); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_block->setForm($objectManager->getObject('Magento\Data\Form\Element\Text', array( + 'factoryElement' => $this->_factoryElementMock, + 'factoryCollection' => $this->_collectionFactoryMock + ))); } public function testSetValue() diff --git a/dev/tests/unit/testsuite/Magento/Code/Generator/ClassTest.php b/dev/tests/unit/testsuite/Magento/Code/Generator/ClassTest.php deleted file mode 100644 index c2825d3a3e5beaa99c69107151ffaeff91f0234a..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Code/Generator/ClassTest.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Code - * @subpackage unit_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Code\Generator; - -class ClassTest extends \PHPUnit_Framework_TestCase -{ - /** - * Test class name for generation test - */ - const TEST_CLASS_NAME = 'Magento\Code\Generator\TestAsset\TestGenerationClass'; - - /** - * Expected arguments for test class constructor - * - * @var array - */ - protected $_expectedArguments = array( - 0 => 'Magento\Code\Generator\TestAsset\ParentClass', - 1 => 'Magento\Code\Generator\TestAsset\SourceClass', - 2 => 'Not_Existing_Class', - ); - - public function testGenerateForConstructor() - { - $generatorMock = $this->getMock('Magento\Code\Generator', array('generateClass'), array(), '', false); - foreach ($this->_expectedArguments as $order => $class) { - $generatorMock->expects($this->at($order)) - ->method('generateClass') - ->with($class); - } - - $classGenerator = new \Magento\Code\Generator\ClassGenerator($generatorMock); - $classGenerator->generateForConstructor(self::TEST_CLASS_NAME); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Code/Model/File/Validator/NotProtectedExtensionTest.php b/dev/tests/unit/testsuite/Magento/Code/Model/File/Validator/NotProtectedExtensionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..140374337599508259f8a8e702ba54f0b645ec9a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/Model/File/Validator/NotProtectedExtensionTest.php @@ -0,0 +1,86 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Code\Model\File\Validator; + +class NotProtectedExtensionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Core\Model\File\Validator\NotProtectedExtension + */ + protected $_model; + + /** + * @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_coreStoreConfig; + + /** + * @var string + */ + protected $_protectedList = 'exe,php,jar'; + + protected function setUp() + { + $this->_coreStoreConfig = $this->getMock('\Magento\Core\Model\Store\Config', array('getConfig'), + array(), '', false); + $this->_coreStoreConfig->expects($this->atLeastOnce())->method('getConfig')->with($this->equalTo( + \Magento\Core\Model\File\Validator\NotProtectedExtension::XML_PATH_PROTECTED_FILE_EXTENSIONS + ), $this->equalTo(null))->will($this->returnValue($this->_protectedList)); + $this->_model = new \Magento\Core\Model\File\Validator\NotProtectedExtension($this->_coreStoreConfig); + } + public function testGetProtectedFileExtensions() + { + $this->assertEquals($this->_protectedList, $this->_model->getProtectedFileExtensions()); + } + + public function testInitialization() + { + $property = new \ReflectionProperty( + '\Magento\Core\Model\File\Validator\NotProtectedExtension', + '_messageTemplates' + ); + $property->setAccessible(true); + $defaultMess = array('protectedExtension' + => __('File with an extension "%value%" is protected and cannot be uploaded')); + $this->assertEquals($defaultMess, $property->getValue($this->_model)); + + $property = new \ReflectionProperty( + '\Magento\Core\Model\File\Validator\NotProtectedExtension', + '_protectedFileExtensions' + ); + $property->setAccessible(true); + $protectedList = array('exe', 'php', 'jar'); + $this->assertEquals($protectedList, $property->getValue($this->_model)); + } + + public function testIsValid() + { + $this->assertTrue($this->_model->isValid('html')); + $this->assertTrue($this->_model->isValid('jpg')); + $this->assertFalse($this->_model->isValid('php')); + $this->assertFalse($this->_model->isValid('jar')); + $this->assertFalse($this->_model->isValid('exe')); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Code/Plugin/GeneratorTest/SimpleObjectManager.php b/dev/tests/unit/testsuite/Magento/Code/Plugin/GeneratorTest/SimpleObjectManager.php index 2111dadcde8c6d6756bb0d45b19410fc5326a782..f7ef6d18559001817b9bb6d9f4ed8cafd9d0d7cd 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Plugin/GeneratorTest/SimpleObjectManager.php +++ b/dev/tests/unit/testsuite/Magento/Code/Plugin/GeneratorTest/SimpleObjectManager.php @@ -25,6 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Code\Plugin\GeneratorTest; +use Magento\ObjectManager; /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -64,4 +65,16 @@ class SimpleObjectManager implements \Magento\ObjectManager public function configure(array $configuration) { } + + /** + * Set factory + * + * @param ObjectManager\Factory $factory + */ + public function setFactory(ObjectManager\Factory $factory) + { + + } + + } diff --git a/dev/tests/unit/testsuite/Magento/Code/Validator/ConstructorIntegrityTest.php b/dev/tests/unit/testsuite/Magento/Code/Validator/ConstructorIntegrityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..008756fe0c4e211fd54796d9e78fc09b5fc7028f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/Validator/ConstructorIntegrityTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Code\Validator; + +require_once __DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Three/Test.php'; +require_once __DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Two/Test.php'; +require_once __DIR__ . '/../_files/app/code/Magento/SomeModule/Model/One/Test.php'; +require_once __DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Four/Test.php'; +require_once __DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Five/Test.php'; +require_once __DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Six/Test.php'; + +class ConstructorIntegrityTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Code\Validator\ConstructorIntegrity + */ + protected $_model; + + protected function setUp() + { + $this->_model = new \Magento\Code\Validator\ConstructorIntegrity(); + } + + public function testValidateIfParentClassExist() + { + $this->assertEquals(true, $this->_model->validate('Magento\SomeModule\Model\One\Test')); + } + + public function testValidateIfClassHasParentConstructCall() + { + $this->assertEquals(true, $this->_model->validate('Magento\SomeModule\Model\Two\Test')); + } + + public function testValidateIfClassHasArgumentsQtyEqualToParentClass() + { + $this->assertEquals(true, $this->_model->validate('Magento\SomeModule\Model\Three\Test')); + } + + public function testValidateIfClassHasExtraArgumentInTheParentConstructor() + { + $fileName = realpath(__DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Four/Test.php'); + $this->setExpectedException( + '\Magento\Code\ValidationException', + 'Extra parameters passed to parent construct: $factory. File: ' . $fileName + ); + $this->_model->validate('Magento\SomeModule\Model\Four\Test'); + } + + public function testValidateIfClassHasMissingRequiredArguments() + { + $fileName = realpath(__DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Five/Test.php'); + $this->setExpectedException( + '\Magento\Code\ValidationException', + 'Missed required argument factory in parent::__construct call. File: ' . $fileName + ); + $this->_model->validate('Magento\SomeModule\Model\Five\Test'); + } + + public function testValidateIfClassHasIncompatibleArguments() + { + $fileName = realpath(__DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Six/Test.php'); + $this->setExpectedException( + '\Magento\Code\ValidationException', + 'Incompatible argument type: Required type: Magento\SomeModule\Model\Proxy. ' . + 'Actual type: Magento\SomeModule\Model\ElementFactory; File: ' . $fileName + ); + $this->_model->validate('Magento\SomeModule\Model\Six\Test'); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/ElementFactory.php b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/ElementFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..83e0a1a5a7a5901f90ed9c0cdfe3f5d0447511d9 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/ElementFactory.php @@ -0,0 +1,28 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SomeModule\Model; +class ElementFactory +{ + +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Five/Test.php b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Five/Test.php new file mode 100644 index 0000000000000000000000000000000000000000..1b0eb26211dc399891253731ebabe97790d98d79 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Five/Test.php @@ -0,0 +1,42 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SomeModule\Model\Five; + +require_once __DIR__ . '/../Three/Test.php'; +require_once __DIR__ . '/../Proxy.php'; + +class Test extends \Magento\SomeModule\Model\Three\Test +{ + /** + * @var \Magento\SomeModule\Model\Proxy + */ + protected $_proxy; + + public function __construct( + \Magento\SomeModule\Model\Proxy $proxy + ) { + parent::__construct($proxy); + } + +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Four/Test.php b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Four/Test.php new file mode 100644 index 0000000000000000000000000000000000000000..5117bc9847f2781939d2d5c1504abe4c10ae73a6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Four/Test.php @@ -0,0 +1,43 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SomeModule\Model\Four; + +require_once __DIR__ . '/../One/Test.php'; +require_once __DIR__ . '/../ElementFactory.php'; +require_once __DIR__ . '/../Proxy.php'; +class Test extends \Magento\SomeModule\Model\One\Test +{ + /** + * @var \Magento\SomeModule\Model\ElementFactory + */ + protected $_factory; + + public function __construct( + \Magento\SomeModule\Model\Proxy $proxy, + \Magento\SomeModule\Model\ElementFactory $factory + ) { + $this->_factory = $factory; + parent::__construct($proxy, $factory); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/One/Test.php b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/One/Test.php new file mode 100644 index 0000000000000000000000000000000000000000..01a3d1fde21977ebff9ee8147ecc008b625b89be --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/One/Test.php @@ -0,0 +1,39 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SomeModule\Model\One; + +require_once __DIR__ . '/../Proxy.php'; +class Test +{ + /** + * @var \Magento\SomeModule\Model\Proxy + */ + protected $_proxy; + + public function __construct( + \Magento\SomeModule\Model\Proxy $proxy + ) { + $this->_proxy = $proxy; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Proxy.php b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Proxy.php new file mode 100644 index 0000000000000000000000000000000000000000..162034334814896f2d13909301532fdcde82db25 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Proxy.php @@ -0,0 +1,28 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SomeModule\Model; +class Proxy +{ + +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Six/Test.php b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Six/Test.php new file mode 100644 index 0000000000000000000000000000000000000000..706c6cc747a39542a44073c8232e12467a243ca0 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Six/Test.php @@ -0,0 +1,43 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SomeModule\Model\Six; + +require_once __DIR__ . '/../One/Test.php'; +require_once __DIR__ . '/../Proxy.php'; +require_once __DIR__ . '/../ElementFactory.php'; +class Test extends \Magento\SomeModule\Model\One\Test +{ + /** + * @var \Magento\SomeModule\Model\ElementFactory + */ + protected $_factory; + + public function __construct( + \Magento\SomeModule\Model\Proxy $proxy, + \Magento\SomeModule\Model\ElementFactory $factory + ) { + $this->_factory = $factory; + parent::__construct($factory); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Three/Test.php b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Three/Test.php new file mode 100644 index 0000000000000000000000000000000000000000..b555eb94a3cb304a6f54f8d066b3ed9248f98863 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Three/Test.php @@ -0,0 +1,48 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SomeModule\Model\Three; + +require_once __DIR__ . '/../Two/Test.php'; +require_once __DIR__ . '/../ElementFactory.php'; +require_once __DIR__ . '/../Proxy.php'; +class Test extends \Magento\SomeModule\Model\Two\Test +{ + /** + * @var \Magento\SomeModule\Model\ElementFactory + */ + protected $_factory; + + /** + * @var \Magento\SomeModule\Model\Proxy + */ + protected $_proxy; + + public function __construct( + \Magento\SomeModule\Model\Proxy $proxy, + \Magento\SomeModule\Model\ElementFactory $factory + ) { + $this->_factory = $factory; + parent::__construct($proxy); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Two/Test.php b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Two/Test.php new file mode 100644 index 0000000000000000000000000000000000000000..d93f87e1b806bbc9f39a03731667efe2f2ac2905 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/_files/app/code/Magento/SomeModule/Model/Two/Test.php @@ -0,0 +1,41 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\SomeModule\Model\Two; + +require_once __DIR__ . '/../One/Test.php'; +require_once __DIR__ . '/../Proxy.php'; +class Test extends \Magento\SomeModule\Model\One\Test +{ + /** + * @var \Magento\SomeModule\Model\Proxy + */ + protected $_proxy; + + public function __construct( + \Magento\SomeModule\Model\Proxy $proxy, + $data = array() + ) { + $this->_proxy = $proxy; + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Config/ValidationStateTest.php b/dev/tests/unit/testsuite/Magento/Config/ValidationStateTest.php index 58782327e435029a66e26372a872539e25c3d01b..61daa02be5c2aa478f2abf652c78773d11ce470f 100644 --- a/dev/tests/unit/testsuite/Magento/Config/ValidationStateTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/ValidationStateTest.php @@ -32,7 +32,7 @@ class ValidationStateTest extends \PHPUnit_Framework_TestCase */ public function testIsValidated($appMode, $expectedResult) { - $model = new \Magento\Core\Model\Config\ValidationState($appMode); + $model = new \Magento\App\Config\ValidationState($appMode); $this->assertEquals($model->isValidated(), $expectedResult); } diff --git a/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php b/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php new file mode 100644 index 0000000000000000000000000000000000000000..1ca647e71f2558abf772b59bd0ebf76ed20c41b5 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php @@ -0,0 +1,83 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Convert; + +class ConvertArrayTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Convert\ConvertArray + */ + protected $_model; + + protected function setUp() + { + $this->_model = new \Magento\Convert\ConvertArray; + } + + public function testAssocToXml() + { + $data = array( + 'one' => 1, + 'two' => array( + 'three' => 3, + 'four' => '4', + ), + ); + $result = $this->_model->assocToXml($data); + $expectedResult = <<<XML +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<_><one>1</one><two><three>3</three><four>4</four></two></_> + +XML; + $this->assertInstanceOf('SimpleXMLElement', $result); + $this->assertEquals($expectedResult, $result->asXML()); + } + + /** + * @param array $array + * @param string $rootName + * @expectedException \Magento\Exception + * @dataProvider assocToXmlExceptionDataProvider + */ + public function testAssocToXmlException($array, $rootName = '_') + { + $this->_model->assocToXml($array, $rootName); + } + + /** + * @return array + */ + public function assocToXmlExceptionDataProvider() + { + return array( + array(array(), ''), + array(array(), 0), + array(array(1, 2, 3)), + array(array('root' => 1), 'root'), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php b/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php new file mode 100644 index 0000000000000000000000000000000000000000..7f94572ad5bb77f4f881be8ef226eb3655d49009 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Convert; + +class XmlTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Convert\Xml + */ + protected $_model; + + protected function setUp() + { + $this->_model = new \Magento\Convert\Xml; + } + + public function testXmlToAssoc() + { + $xmlstr = <<<XML +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<_><one>1</one><two><three>3</three><four>4</four></two></_> +XML; + $result = $this->_model->xmlToAssoc(new \SimpleXMLElement($xmlstr)); + $this->assertEquals(array('one' => '1', 'two' => array('three' => '3', 'four' => '4')), $result); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandlerTest.php b/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandlerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..fd2763214efe2ecfdd1b4cb6ad75146bd28dd24f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandlerTest.php @@ -0,0 +1,60 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\App\FrontController\Plugin; + +class DispatchExceptionHandlerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Core\App\FrontController\Plugin\DispatchExceptionHandler + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_storeManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_dirMock; + + protected function setUp() + { + $this->_storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_dirMock = $this->getMock('\Magento\App\Dir', array(), array(), '', false); + $this->_model = new DispatchExceptionHandler( + $this->_storeManagerMock, + $this->_dirMock + ); + } + + public function testAroundDispatch() + { + $invocationChainMock = $this->getMock('\Magento\Code\Plugin\InvocationChain', array(), array(), '', false); + $arguments = array(); + $invocationChainMock->expects($this->once())->method('proceed')->with($arguments); + $this->_model->aroundDispatch($arguments, $invocationChainMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/InstallTest.php b/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/InstallTest.php index 751a223ef5a40178659bd8fac740c18cfcba45c7..644200b3d53bb11dc231b2d51b5dee3440687e61 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/InstallTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/InstallTest.php @@ -25,7 +25,7 @@ namespace Magento\Core\App\FrontController\Plugin; class InstallTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\App\FrontController\Plugin\Install + * @var \Magento\Module\FrontController\Plugin\Install */ protected $_model; @@ -53,10 +53,10 @@ class InstallTest extends \PHPUnit_Framework_TestCase { $this->_appStateMock = $this->getMock('\Magento\App\State', array(), array(), '', false); $this->_cacheMock = $this->getMock('\Magento\Cache\FrontendInterface'); - $this->_dbUpdaterMock = $this->getMock('\Magento\App\UpdaterInterface'); + $this->_dbUpdaterMock = $this->getMock('\Magento\Module\UpdaterInterface'); $this->_invocationChainMock = $this->getMock('\Magento\Code\Plugin\InvocationChain', array(), array(), '', false); - $this->_model = new \Magento\Core\App\FrontController\Plugin\Install( + $this->_model = new \Magento\Module\FrontController\Plugin\Install( $this->_appStateMock, $this->_cacheMock, $this->_dbUpdaterMock diff --git a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/RequestPreprocessorTest.php b/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/RequestPreprocessorTest.php index f3d62062b849d88ef61a74a5f535c91d481bb4e7..9f4b51dc8ce468c5fe03820508cd1b92ac87a727 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/RequestPreprocessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/RequestPreprocessorTest.php @@ -22,6 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Core\App\FrontController\Plugin; + class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase { /** @@ -29,11 +30,6 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase */ protected $_model; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_rewriteServiceMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -49,11 +45,6 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase */ protected $_urlMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_backendDataMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -80,20 +71,15 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase $this->_requestMock = $this->getMock('\Magento\App\Request\Http', array(), array(), '', false); $this->_invocationChainMock = $this->getMock('\Magento\Code\Plugin\InvocationChain', array(), array(), '', false); - $this->_rewriteServiceMock = - $this->getMock('\Magento\Core\App\Request\RewriteService', array(), array(), '', false); $this->_storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManager', array(), array(), '', false); $this->_appStateMock = $this->getMock('\Magento\App\State', array(), array(), '', false); $this->_urlMock = $this->getMock('\Magento\Core\Model\Url', array(), array(), '', false); - $this->_backendDataMock = $this->getMock('\Magento\Backend\Helper\Data', array(), array(), '', false); - $this->_storeConfigMock = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false);; + $this->_storeConfigMock = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false); $this->_model = new \Magento\Core\App\FrontController\Plugin\RequestPreprocessor( - $this->_rewriteServiceMock, $this->_storeManagerMock, $this->_appStateMock, $this->_urlMock, - $this->_backendDataMock, $this->_storeConfigMock, $this->getMock('\Magento\App\ResponseFactory', array(), array(), '', false) ); @@ -104,7 +90,6 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(false)); $this->_requestMock->expects($this->once())->method('setDispatched')->with(false); $this->_storeConfigMock->expects($this->never())->method('getConfig'); - $this->_rewriteServiceMock->expects($this->once())->method('applyRewrites')->with($this->_requestMock); $this->_invocationChainMock->expects($this->once())->method('proceed')->with(array($this->_requestMock)); $this->_model->aroundDispatch(array($this->_requestMock), $this->_invocationChainMock); } @@ -114,9 +99,8 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->_requestMock->expects($this->once())->method('setDispatched')->with(false); $this->_storeConfigMock->expects($this->once())->method('getConfig')->with('web/url/redirect_to_base'); - $this->_rewriteServiceMock->expects($this->once())->method('applyRewrites')->with($this->_requestMock); $this->_invocationChainMock->expects($this->once())->method('proceed')->with(array($this->_requestMock)); - $this->_requestMock->expects($this->never())->method('getPathInfo'); + $this->_requestMock->expects($this->never())->method('getRequestUri'); $this->_model->aroundDispatch(array($this->_requestMock), $this->_invocationChainMock); } @@ -127,16 +111,15 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase $this->_storeConfigMock ->expects($this->once())->method('getConfig') ->with('web/url/redirect_to_base')->will($this->returnValue(302)); - $this->_requestMock->expects($this->once())->method('getPathInfo')->will($this->returnValue('node/')); - $this->_backendDataMock->expects($this->once())->method('getAreaFrontName')->will($this->returnValue('node')); - $this->_storeManagerMock->expects($this->never())->method('getStore'); - $this->_rewriteServiceMock->expects($this->once())->method('applyRewrites')->with($this->_requestMock); + $this->_storeManagerMock->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($this->_storeMock)); + $this->_storeMock->expects($this->once())->method('getBaseUrl'); $this->_invocationChainMock->expects($this->once())->method('proceed')->with(array($this->_requestMock)); - + $this->_requestMock->expects($this->never())->method('getRequestUri'); $this->_model->aroundDispatch(array($this->_requestMock), $this->_invocationChainMock); } - public function testAroundDispatchIfBaseUrlNotExists() { $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); @@ -144,15 +127,11 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase $this->_storeConfigMock ->expects($this->once())->method('getConfig') ->with('web/url/redirect_to_base')->will($this->returnValue(302)); - $this->_requestMock->expects($this->once())->method('getPathInfo')->will($this->returnValue('node/')); - $this->_backendDataMock->expects($this->once())->method('getAreaFrontName')->will($this->returnValue('node1')); $this->_storeManagerMock ->expects($this->any())->method('getStore')->will($this->returnValue($this->_storeMock)); $this->_storeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue(false)); $this->_requestMock->expects($this->never())->method('getRequestUri'); - $this->_rewriteServiceMock->expects($this->once())->method('applyRewrites')->with($this->_requestMock); $this->_invocationChainMock->expects($this->once())->method('proceed')->with(array($this->_requestMock)); - $this->_model->aroundDispatch(array($this->_requestMock), $this->_invocationChainMock); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/EntryPoint/MediaTest.php b/dev/tests/unit/testsuite/Magento/Core/App/MediaTest.php similarity index 84% rename from dev/tests/unit/testsuite/Magento/Core/Model/EntryPoint/MediaTest.php rename to dev/tests/unit/testsuite/Magento/Core/App/MediaTest.php index 1d9f4a315880625a26c3eb4695e33d20b49e065a..1de5691a351b55ffff6c5f2d683abca0fdfecbd0 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/EntryPoint/MediaTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/App/MediaTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\EntryPoint; +namespace Magento\Core\App; class MediaTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\EntryPoint\Media + * @var \Magento\Core\App\Media */ protected $_model; @@ -50,11 +50,6 @@ class MediaTest extends \PHPUnit_Framework_TestCase */ protected $_dirVerificationMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_config; - /** * @var callable */ @@ -75,11 +70,6 @@ class MediaTest extends \PHPUnit_Framework_TestCase */ protected $_mediaDirectory = 'mediaDirectory'; - /** - * @var string - */ - protected $_relativeFileName = 'relativeFileName'; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -87,7 +77,6 @@ class MediaTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_config = $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false); $this->_requestMock = $this->getMock('Magento\Core\Model\File\Storage\Request', array(), array(), '', false); $this->_closure = function () { return true; @@ -107,17 +96,16 @@ class MediaTest extends \PHPUnit_Framework_TestCase array('Magento\Core\Model\File\Storage\Request', $this->_requestMock), array('Magento\Core\Model\File\Storage\Synchronization', $this->_sync), ); - - $this->_model = new \Magento\Core\Model\EntryPoint\Media( - $this->_config, + $this->_model = new \Magento\Core\App\Media( + $this->_appState, + $this->_objectManagerMock, $this->_requestMock, + $this->_responseMock, $this->_closure, + 'baseDir', + 'mediaDirectory', 'var', - $this->_mediaDirectory, - 'cacheFile', - $this->_relativeFileName, - $this->_objectManagerMock, - $this->_responseMock + 'params' ); $this->_objectManagerMock->expects($this->any())->method('get')->will($this->returnValueMap($map)); } @@ -132,28 +120,28 @@ class MediaTest extends \PHPUnit_Framework_TestCase $this->_appState->expects($this->once())->method('isInstalled')->will($this->returnValue(false)); $this->_responseMock->expects($this->once())->method('sendNotFound'); $this->_requestMock->expects($this->never())->method('getPathInfo'); - $this->_model->processRequest(); + $this->assertEquals(-1, $this->_model->execute()); } public function testProcessRequestCreatesConfigFileMediaDirectoryIsNotProvided() { - $this->_model = new \Magento\Core\Model\EntryPoint\Media( - $this->_config, + $this->_model = new \Magento\Core\App\Media( + $this->_appState, + $this->_objectManagerMock, $this->_requestMock, + $this->_responseMock, $this->_closure, - 'var', + 'baseDir', false, - 'cacheFile', - 'relativeFileName', - $this->_objectManagerMock, - $this->_responseMock + 'var', + 'params' ); $this->_appState->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->_objectManagerMock->expects($this->once())->method('create') ->with('Magento\Core\Model\File\Storage\Config') ->will($this->returnValue($this->_configMock)); $this->_configMock->expects($this->once())->method('save'); - $this->_model->processRequest(); + $this->assertEquals(-1, $this->_model->execute()); } @@ -162,16 +150,25 @@ class MediaTest extends \PHPUnit_Framework_TestCase $this->_closure = function () { return false; }; - $this->_model = new \Magento\Core\Model\EntryPoint\Media( - $this->_config, $this->_requestMock, $this->_closure, 'var', false, 'cacheFile', 'relativeFileName', - $this->_objectManagerMock, $this->_responseMock); + $this->_model = new \Magento\Core\App\Media( + $this->_appState, + $this->_objectManagerMock, + $this->_requestMock, + $this->_responseMock, + $this->_closure, + 'baseDir', + false, + 'var', + 'params' + ); $this->_appState->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->_responseMock->expects($this->once())->method('sendNotFound'); $this->_requestMock->expects($this->once())->method('getPathInfo'); $this->_objectManagerMock->expects($this->once())->method('create') ->with('Magento\Core\Model\File\Storage\Config') ->will($this->returnValue($this->_configMock)); - $this->_model->processRequest(); + $this->_configMock->expects($this->once())->method('getAllowedResources')->will($this->returnValue(false)); + $this->assertEquals(-1, $this->_model->execute()); } @@ -182,7 +179,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase $this->_requestMock->expects($this->once())->method('getPathInfo'); $this->_responseMock->expects($this->once())->method('sendNotFound'); $this->_requestMock->expects($this->never())->method('getFilePath'); - $this->_model->processRequest(); + $this->assertEquals(-1, $this->_model->execute()); } public function testProcessRequestReturnsFileIfItsProperlySynchronized() @@ -196,7 +193,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase ->method('getFilePath')->will($this->returnValue(realpath($filePath))); $this->_responseMock->expects($this->once())->method('sendFile')->with($filePath); $this->_responseMock->expects($this->never())->method('sendNotFound'); - $this->_model->processRequest(); + $this->assertEquals(0, $this->_model->execute()); } public function testProcessRequestReturnsNotFoundIfFileIsNotSynchronized() @@ -209,6 +206,6 @@ class MediaTest extends \PHPUnit_Framework_TestCase ->method('getFilePath')->will($this->returnValue('non_existing_file_name')); $this->_responseMock->expects($this->never())->method('sendFile'); $this->_responseMock->expects($this->once())->method('sendNotFound'); - $this->_model->processRequest(); + $this->assertEquals(-1, $this->_model->execute()); } } diff --git a/dev/tests/unit/testsuite/Magento/App/Module/ResourceResolver/_files/Module/data/module_first_setup/.gitignore b/dev/tests/unit/testsuite/Magento/Core/App/_files/.gitignore similarity index 100% rename from dev/tests/unit/testsuite/Magento/App/Module/ResourceResolver/_files/Module/data/module_first_setup/.gitignore rename to dev/tests/unit/testsuite/Magento/Core/App/_files/.gitignore diff --git a/dev/tests/unit/testsuite/Magento/Core/Block/TemplateTest.php b/dev/tests/unit/testsuite/Magento/Core/Block/TemplateTest.php index da0aba30b632f16b50a2cd2979739e157dcf95a0..45ecad0fe63c19dcfba0e4b53dac65abed09e77c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Block/TemplateTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Block/TemplateTest.php @@ -70,16 +70,20 @@ class TemplateTest extends \PHPUnit_Framework_TestCase ->with('phtml') ->will($this->returnValue($this->_templateEngine)); - $context = $this->getMock('\Magento\Core\Block\Template\Context', array(), array(), '', false); + $appState = $this->getMock('Magento\App\State', array('getAreaCode'), array(), '', false); + $appState->expects($this->any())->method('getAreaCode')->will($this->returnValue('frontend')); + + $context = $this->getMock('Magento\Core\Block\Template\Context', array(), array(), '', false); $context->expects($this->any())->method('getEngineFactory')->will($this->returnValue($enginePool)); $context->expects($this->any())->method('getDirs')->will($this->returnValue($dirs)); $context->expects($this->any())->method('getFilesystem')->will($this->returnValue($this->_filesystem)); $context->expects($this->any())->method('getViewFileSystem')->will($this->returnValue($this->_viewFileSystem)); + $context->expects($this->any())->method('getAppState')->will($this->returnValue($appState)); $this->_block = new \Magento\Core\Block\Template( $this->getMock('\Magento\Core\Helper\Data', array(), array(), '', false), $context, - array('template' => 'template.phtml', 'area' => 'frontend', 'module_name' => 'Fixture_Module') + array('template' => 'template.phtml', 'module_name' => 'Fixture_Module') ); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Controller/Request/HttpTest.php b/dev/tests/unit/testsuite/Magento/Core/Controller/Request/HttpTest.php index ea3b74f9a8cd09369940775b502b5263b45ad310..573c3ab53de5b9f84d2ec9c33f3cb3f61a061bd8 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Controller/Request/HttpTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Controller/Request/HttpTest.php @@ -36,7 +36,7 @@ class HttpTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_routerListMock = $this->getMock('\Magento\App\RouterList', array(), array(), '', false); + $this->_routerListMock = $this->getMock('\Magento\App\Route\ConfigInterface'); $this->_model = new \Magento\App\Request\Http($this->_routerListMock); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/AbstractActionTest.php b/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/AbstractActionTest.php index 3e3349b41dcba52f1f868cfecba9a0080fab7354..10a92e5847a406cc0d9c963e05675c56457e3ecd 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/AbstractActionTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/AbstractActionTest.php @@ -90,7 +90,7 @@ class AbstractActionTest extends \PHPUnit_Framework_TestCase */ public function testResponseHeaders() { - $routerListMock = $this->getMock('\Magento\App\RouterList', array(), array(), '', false); + $routerListMock = $this->getMock('Magento\App\Route\ConfigInterface'); $request = new \Magento\App\Request\Http($routerListMock); $response = new \Magento\App\Response\Http(); $response->headersSentThrowsException = false; diff --git a/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/Action/ForwardTest.php b/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/Action/ForwardTest.php index b16faca10714fc5b5125bc72ba82c77a56594eb2..4ab9a3a2f97dc1a5ca7456719aa01eb7d5715fd3 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/Action/ForwardTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/Action/ForwardTest.php @@ -54,7 +54,7 @@ class ForwardTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_routerListMock = $this->getMock('\Magento\App\RouterList', array(), array(), '', false); + $this->_routerListMock = $this->getMock('Magento\App\Route\ConfigInterface'); $this->_request = new \Magento\App\Request\Http($this->_routerListMock); $this->_response = new \Magento\App\Response\Http(); diff --git a/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/Action/RedirectTest.php b/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/Action/RedirectTest.php index d94b9d6a3121fd39d155a86b21cf4d2446fe396d..0c5d634213d72153e9545bd6b88c23f90921c420 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/Action/RedirectTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Controller/Varien/Action/RedirectTest.php @@ -54,7 +54,7 @@ class RedirectTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_routerListMock = $this->getMock('\Magento\App\RouterList', array(), array(), '', false); + $this->_routerListMock = $this->getMock('Magento\App\Route\ConfigInterface', array(), array(), '', false); $this->_request = new \Magento\App\Request\Http($this->_routerListMock); $this->_response = new \Magento\App\Response\Http(); diff --git a/dev/tests/unit/testsuite/Magento/Core/Helper/StringTest.php b/dev/tests/unit/testsuite/Magento/Core/Helper/StringTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0c4b1f06b2f504426fc3b60bc04c05e15027298a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Helper/StringTest.php @@ -0,0 +1,108 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @subpackage unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\Helper; + +class StringTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Core\Helper\String + */ + protected $_helper; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + protected function setUp() + { + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_helper = $this->_objectManager->getObject('Magento\Core\Helper\String'); + } + + /** + * @param string $testString + * @param string $expected + * + * @dataProvider upperCaseWordsDataProvider + */ + public function testUpperCaseWords($testString, $expected) + { + $string = new \Magento\Stdlib\String; + $actual = $string->upperCaseWords($testString); + $this->assertEquals($expected, $actual); + } + + /** + * @return array + */ + public function upperCaseWordsDataProvider() + { + return array( + array( + 'test test2', + 'Test_Test2', + ), + array( + 'test_test2', + 'Test_Test2', + ), + array( + 'test_test2 test3', + 'Test_Test2_Test3', + ), + ); + } + + /** + * @param string $testString + * @param string $sourceSeparator + * @param string $destinationSeparator + * @param string $expected + * + * @dataProvider upperCaseWordsWithSeparatorsDataProvider + */ + public function testUpperCaseWordsWithSeparators($testString, $sourceSeparator, $destinationSeparator, $expected) + { + $string = new \Magento\Stdlib\String; + $actual = $string->upperCaseWords($testString, $sourceSeparator, $destinationSeparator); + $this->assertEquals($expected, $actual); + } + + /** + * @return array + */ + public function upperCaseWordsWithSeparatorsDataProvider() + { + return array( + array( + 'test test2_test3\test4|test5', + '|', + '\\', + 'Test\Test2_test3\test4\Test5', + ), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Helper/Url/RewriteTest.php b/dev/tests/unit/testsuite/Magento/Core/Helper/Url/RewriteTest.php index dce225407c372620b883ee0457c93f503fc2f6b8..4a1b7694ef1a28744dac6aa194cc5b66e0b34ddf 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Helper/Url/RewriteTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Helper/Url/RewriteTest.php @@ -51,7 +51,7 @@ class RewriteTest extends \PHPUnit_Framework_TestCase ->with('Magento\Core\Model\Registry') ->will($this->returnValue($coreRegisterMock)); - \Magento\Core\Model\ObjectManager::setInstance($objectManagerMock); + \Magento\App\ObjectManager::setInstance($objectManagerMock); } /** diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/App/StateTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/App/StateTest.php index 482e65b0fc550d1a3d77f5bacb7606d4c24bbba7..8c6c83c1a177a00978a95b0ac1c93ecf9373be14 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/App/StateTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/App/StateTest.php @@ -40,7 +40,11 @@ class StateTest extends \PHPUnit_Framework_TestCase */ public function testConstructor($mode) { - $model = new \Magento\App\State(time(), $mode); + $model = new \Magento\App\State( + $this->getMockForAbstractClass('Magento\Config\ScopeInterface', array(), '', false), + time(), + $mode + ); $this->assertEquals($mode, $model->getMode()); } @@ -68,6 +72,10 @@ class StateTest extends \PHPUnit_Framework_TestCase */ public function testConstructorException() { - new \Magento\App\State(time(), "unknown mode"); + new \Magento\App\State( + $this->getMockForAbstractClass('Magento\Config\ScopeInterface', array(), '', false), + time(), + "unknown mode" + ); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/AppTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/AppTest.php index bbb792414c3cc5d927399a673a08b8a0a01ff202..aff4c08f3aa0f6b60c860ca0c76faa31dd172369 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/AppTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/AppTest.php @@ -78,7 +78,7 @@ class AppTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_configMock = $this->getMock('Magento\Core\Model\Config', array(), array(), '', false, false); - $this->_cacheMock = $this->getMock('Magento\Core\Model\CacheInterface'); + $this->_cacheMock = $this->getMock('Magento\App\CacheInterface'); $this->_objectManagerMock = $this->getMock('Magento\ObjectManager', array(), array(), '', false, false); $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); $this->_eventManagerMock = $this->getMock('Magento\Event\ManagerInterface'); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Cache/Frontend/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Cache/Frontend/FactoryTest.php index 6c4a7a4050574fc9fbf28416c8881320acb0aa98..1b73bf6e5fe7a4c3c5a21ea408028f7b4654be41 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Cache/Frontend/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Cache/Frontend/FactoryTest.php @@ -186,7 +186,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase array(\Magento\App\Dir::CONFIG, 'CONFIG_DIR'), ); $dirs = $this->getMock('Magento\App\Dir', array('getDir'), array(), '', false); - $resource = $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false); + $resource = $this->getMock('Magento\App\Resource', array(), array(), '', false); $dirs->expects($this->any()) ->method('getDir') ->will($this->returnValueMap($map)); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php index 8a8ad1355aab256225f2b47bdef5299b5f2479c4..e0b9688faedb27cf46c1cd9deeee15e3b7b7ffb7 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php @@ -41,7 +41,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase ->with(\Magento\App\Dir::CONFIG) ->will($this->returnValue($appConfigDir)); - $moduleReader = $this->getMock('Magento\Core\Model\Config\Modules\Reader', array(), + $moduleReader = $this->getMock('Magento\Module\Dir\Reader', array(), array('getConfigurationFiles'), '', false); $moduleReader->expects($this->any()) ->method('getConfigurationFiles') diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ReaderTest.php index 7bc8ad2524f61a478b74ab2dd82399e47ce5bcdb..fe3dc9253507de0b931fd047c2bca4eb2952b966 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ReaderTest.php @@ -50,10 +50,17 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->_filePath = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; $this->_fileResolverMock = $this->getMock('Magento\Config\FileResolverInterface'); $this->_converterMock = $this->getMock('Magento\Core\Model\Config\Initial\Converter'); - + $schemaLocatorMock = + $this->getMock('Magento\Core\Model\Config\Initial\SchemaLocator', array(), array(), '', false); + $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); + $validationStateMock->expects($this->once())->method('isValidated')->will($this->returnValue(true)); + $schemaFile = $this->_filePath . 'config.xsd'; + $schemaLocatorMock->expects($this->once())->method('getSchema')->will($this->returnValue($schemaFile)); $this->_model = new \Magento\Core\Model\Config\Initial\Reader( $this->_fileResolverMock, - $this->_converterMock + $this->_converterMock, + $schemaLocatorMock, + $validationStateMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/XsdTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/XsdTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3b25882a3eeec0312e6b1b57da13fa4e9e57b432 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/XsdTest.php @@ -0,0 +1,71 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\Model\Config\Initial; + +class XsdTest extends \PHPUnit_Framework_TestCase +{ + /** + * Path to xsd schema file + * @var string + */ + protected $_xsdSchema; + + /** + * @var \Magento\TestFramework\Utility\XsdValidator + */ + protected $_xsdValidator; + + protected function setUp() + { + $this->_xsdSchema = BP . '/app/code/Magento/Core/etc/config.xsd'; + $this->_xsdValidator = new \Magento\TestFramework\Utility\XsdValidator(); + } + + /** + * @param string $xmlString + * @param array $expectedError + * @dataProvider schemaCorrectlyIdentifiesInvalidXmlDataProvider + */ + public function testSchemaCorrectlyIdentifiesInvalidXml($xmlString, $expectedError) + { + $actualError = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString); + $this->assertEquals($expectedError, $actualError); + } + + public function testSchemaCorrectlyIdentifiesValidXml() + { + $xmlString = file_get_contents(__DIR__ . '/_files/valid_config.xml'); + $actualResult = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString); + $this->assertEmpty($actualResult); + } + + /** + * Data provider with invalid xml array according to config.xsd + */ + public function schemaCorrectlyIdentifiesInvalidXmlDataProvider() + { + return include(__DIR__ . '/_files/invalidConfigXmlArray.php'); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/_files/config.xsd b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/_files/config.xsd new file mode 100644 index 0000000000000000000000000000000000000000..970496d7273165cc44c26bee92c873fa48457282 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/_files/config.xsd @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:element name="config" type="xs:string"/> +</xs:schema> \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/_files/invalidConfigXmlArray.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/_files/invalidConfigXmlArray.php new file mode 100644 index 0000000000000000000000000000000000000000..829752bba382009c52cc248a319d73f07599d3e0 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/_files/invalidConfigXmlArray.php @@ -0,0 +1,29 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +return array( + 'with_notallowed_handle' => array( + '<?xml version="1.0"?><config><notallowe></notallowe></config>', + array("Element 'notallowe': This element is not expected. Expected is one of ( default, stores, websites ).")), +); diff --git a/app/design/frontend/magento_backup/Magento_PaypalUk/layput/override/paypaluk_express_review_details.xml b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/_files/valid_config.xml similarity index 84% rename from app/design/frontend/magento_backup/Magento_PaypalUk/layput/override/paypaluk_express_review_details.xml rename to dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/_files/valid_config.xml index 4f46c82923b71d07308f026147531375317704df..dafd3fe3e082161b230dbefe37d3e9d0eb65fe0d 100644 --- a/app/design/frontend/magento_backup/Magento_PaypalUk/layput/override/paypaluk_express_review_details.xml +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/_files/valid_config.xml @@ -23,6 +23,14 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Page\Block\Html" name="root" output="1" template="page_fragment.phtml"/> -</layout> +<config> + <default> + <some></some> + </default> + <websites> + <some></some> + </websites> + <stores> + <some></some> + </stores> +</config> diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/LoaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/LoaderTest.php deleted file mode 100644 index 5f1c890819d045d8c2dfa0a9bcdb4c837d4d6f67..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/LoaderTest.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php -/** - * Test class for \Magento\Core\Model\Config\Loader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Core\Model\Config; - -class LoaderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\Config\Loader - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_primaryConfigMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_modulesReaderMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_baseConfigMock; - - protected function setUp() - { - $this->_primaryConfigMock = $this->getMock( - 'Magento\Core\Model\Config\Primary', array(), array(), '', false, false - ); - - $this->_modulesReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false, false - ); - - $this->_baseConfigMock = $this->getMock( - 'Magento\Core\Model\Config\Base', array(), array(), '', false, false - ); - - $this->_model = new \Magento\Core\Model\Config\Loader( - $this->_primaryConfigMock, - $this->_modulesReaderMock - ); - } - - public function testLoadWithEmptyConfig() - { - /** Test load initial xml */ - $this->_baseConfigMock->expects($this->once())->method('getNode')->will($this->returnValue(null)); - $this->_baseConfigMock->expects($this->once())->method('loadString')->with('<config></config>'); - - /** Test extends config with primary config values */ - $this->_baseConfigMock->expects($this->once())->method('extend')->with($this->_primaryConfigMock); - - /** Test loading of DB provider specific config files */ - $this->_modulesReaderMock->expects($this->once()) - ->method('loadModulesConfiguration') - ->with(array('config.xml'), $this->_baseConfigMock); - - /** Test merging of all config data */ - $this->_baseConfigMock->expects($this->once())->method('applyExtends'); - - $this->_model->load($this->_baseConfigMock); - } - - /** - * @depends testLoadWithEmptyConfig - */ - public function testLoadWithNotEmptyConfig() - { - /** Test load initial xml */ - $this->_baseConfigMock->expects($this->once())->method('getNode')->will($this->returnValue('some value')); - $this->_baseConfigMock->expects($this->never())->method('loadString'); - - $this->_model->load($this->_baseConfigMock); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/PrimaryTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/PrimaryTest.php deleted file mode 100644 index a70e5482023724474c69370eddb2c326237d27c4..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/PrimaryTest.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Config; - -class PrimaryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\Config\Primary - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_dirMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_loaderMock; - - /** - * @var string - */ - protected $_configString; - - protected function setUp() - { - $this->_dirMock = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $this->_dirMock->expects($this->any())->method('getDir')->will($this->returnValueMap(array( - array(\Magento\App\Dir::DI, '/path_to_root/var/di'), - array(\Magento\App\Dir::ROOT, '/path_to_root'), - ))); - $this->_loaderMock = $this->getMock('Magento\Core\Model\Config\LoaderInterface'); - $that = $this; - $this->_loaderMock->expects($this->once())->method('load')->will($this->returnCallback( - function ($config) use ($that) { - $testConfig = new \Magento\Core\Model\Config\Base($that->getConfigString()); - $config->getNode()->extend($testConfig->getNode()); - } - )); - } - - protected function tearDown() - { - unset($this->_dirMock); - unset($this->_loaderMock); - unset($this->_model); - } - - public function getConfigString() - { - return $this->_configString; - } - - public function testGetDefinitionPathReturnsDefaultPathIfNothingSpecified() - { - $this->_model = new \Magento\Core\Model\Config\Primary(BP, array(), $this->_dirMock, $this->_loaderMock); - $expectedPath = '/path_to_root/var/di'; - $this->assertEquals($expectedPath, $this->_model->getDefinitionPath()); - } - - public function testGetDefinitionPathReturnsAbsolutePath() - { - $this->_configString = '<config><global><di>' - . '<definitions><path>customPath</path></definitions>' - . '</di></global></config>'; - $this->_model = new \Magento\Core\Model\Config\Primary(BP, array(), $this->_dirMock, $this->_loaderMock); - $this->assertEquals('customPath', $this->_model->getDefinitionPath()); - } - - public function testGetDefinitionPathReturnsRelativePath() - { - $this->_configString = '<config><global><di>' - . '<definitions><relativePath>customPath</relativePath></definitions>' - . '</di></global></config>'; - $this->_model = new \Magento\Core\Model\Config\Primary(BP, array(), $this->_dirMock, $this->_loaderMock); - $expectedPath = '/path_to_root' . DIRECTORY_SEPARATOR . 'customPath'; - $this->assertEquals($expectedPath, $this->_model->getDefinitionPath()); - } - - public function getDefinitionFormatReturnsConfiguredFormat() - { - $this->_configString = '<config><global><di>' - . '<definitions><format>igbinary</format></definitions>' - . '</di></global></config>'; - $this->_model = new \Magento\Core\Model\Config\Primary(BP, array(), $this->_dirMock, $this->_loaderMock); - $this->assertEquals('igbinary', $this->_model->getDefinitionFormat()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/StorageTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/StorageTest.php deleted file mode 100644 index 27d15f1d4f8554ba6d6f1674f8a096e1b850c40f..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/StorageTest.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Test class for \Magento\Core\Model\Config\Storage - */ -namespace Magento\Core\Model\Config; - -class StorageTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\Config\Storage - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_configMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_cacheMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_loaderMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_factoryMock; - - protected function setUp() - { - $this->_configMock = $this->getMock('Magento\Core\Model\ConfigInterface', - array(), array(), '', false, false); - $this->_cacheMock = $this->getMock('Magento\Core\Model\Config\Cache', - array(), array(), '', false, false); - $this->_loaderMock = $this->getMock('Magento\Core\Model\Config\Loader', - array(), array(), '', false, false); - $this->_factoryMock = $this->getMock('Magento\Core\Model\Config\BaseFactory', - array(), array(), '', false, false); - $this->_model = new \Magento\Core\Model\Config\Storage($this->_cacheMock, $this->_loaderMock, - $this->_factoryMock); - } - - public function testGetConfigurationWithData() - { - $this->_cacheMock->expects($this->once())->method('load')->will($this->returnValue($this->_configMock)); - $this->_factoryMock->expects($this->never())->method('create'); - $this->_loaderMock->expects($this->never())->method('load'); - $this->_cacheMock->expects($this->never())->method('save'); - $this->_model->getConfiguration(); - } - - public function testGetConfigurationWithoutData() - { - $mockConfigBase = $this->getMockBuilder('Magento\Core\Model\Config\Base') - ->disableOriginalConstructor() - ->getMock(); - $this->_cacheMock->expects($this->once())->method('load')->will($this->returnValue(false)); - $this->_factoryMock->expects($this->once())->method('create')->will($this->returnValue($mockConfigBase)); - $this->_loaderMock->expects($this->once())->method('load'); - $this->_cacheMock->expects($this->once())->method('save'); - $this->_model->getConfiguration(); - } - - public function testRemoveCache() - { - $this->_cacheMock->expects($this->once())->method('clean'); - $this->_model->removeCache(); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/XsdTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/XsdTest.php index d84f823d7c6980af8cf4d3c77b539efef42ceed2..d797793ad2a919f6413c06ae69e50f6c46117241 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/XsdTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/XsdTest.php @@ -38,7 +38,8 @@ class XsdTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_xsdSchema = BP . '/app/code/Magento/Core/etc/routes.xsd'; + $this->_xsdSchema = BP . '/lib/Magento/App/etc/routes.xsd'; + $this->_xsdValidator = new \Magento\TestFramework\Utility\XsdValidator(); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/ConfigTest.php deleted file mode 100644 index 1c410e317092430bac5d41cc5600a83667dd8702..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/ConfigTest.php +++ /dev/null @@ -1,144 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @subpackage unit_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model; - -class ConfigTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\Config - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_configScopeMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManagerMock; - - /** - * @var \Magento\App\ModuleListInterface - */ - protected $_moduleListMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_sectionPoolMock; - - protected function setUp() - { - $xml = '<config> - <default> - <first> - <custom> - <node>value</node> - </custom> - </first> - </default> - </config>'; - - $areas = array('adminhtml' => array( - 'base_controller' => 'base_controller', - 'routers' => array( - 'admin' => array( - 'class' => 'class' - ) - ), - 'frontName' => 'backend' - )); - - $configBase = new \Magento\Core\Model\Config\Base($xml); - $this->_objectManagerMock = $this->getMock('Magento\Core\Model\ObjectManager', array(), array(), '', false); - $configStorageMock = $this->getMock('Magento\Core\Model\Config\StorageInterface'); - $configStorageMock->expects($this->any())->method('getConfiguration')->will($this->returnValue($configBase)); - $modulesReaderMock = $this->getMock('Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false); - $this->_configScopeMock = $this->getMock('Magento\Config\ScopeInterface'); - $this->_moduleListMock = $this->getMock('Magento\App\ModuleListInterface'); - $this->_sectionPoolMock = $this->getMock('Magento\Core\Model\Config\SectionPool', array(), array(), '', false); - - $this->_model = new \Magento\Core\Model\Config( - $this->_objectManagerMock, - $configStorageMock, - $modulesReaderMock, - $this->_moduleListMock, - $this->_configScopeMock, - $this->_sectionPoolMock, - $areas - ); - } - public function testSetNodeData() - { - $this->_model->setNode('some/custom/node', 'true'); - - $actual = (string)$this->_model->getNode('some/custom/node'); - $this->assertEquals('true', $actual); - } - - public function testGetNode() - { - $this->assertInstanceOf( - 'Magento\Core\Model\Config\Element', - $this->_model->getNode('default/first/custom/node') - ); - } - - public function testSetValue() - { - $scope = 'default'; - $scopeCode = null; - $value = 'test'; - $path = 'test/path'; - $sectionMock = $this->getMock('Magento\Core\Model\Config\Data', array(), array(), '', false); - $this->_sectionPoolMock->expects($this->once()) - ->method('getSection') - ->with($scope, $scopeCode) - ->will($this->returnValue($sectionMock)); - $sectionMock->expects($this->once()) - ->method('setValue') - ->with($path, $value); - $this->_model->setValue($path, $value); - } - - public function testGetValue() - { - $path = 'test/path'; - $scope = 'default'; - $scopeCode = null; - $sectionMock = $this->getMock('Magento\Core\Model\Config\Data', array(), array(), '', false); - $this->_sectionPoolMock->expects($this->once())->method('getSection')->with($scope, $scopeCode) - ->will($this->returnValue($sectionMock)); - $sectionMock->expects($this->once()) - ->method('getValue') - ->with($path); - $this->_model->getValue($path); - } - -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php index af51f9031579c7cfb3bdd8d10d4c6b7ac04a0801..e217d93ecdb24057754fc6de8d64b174c6214ab0 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php @@ -40,7 +40,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase { $path = array(__DIR__, '..', '_files', 'service_calls.xml'); $path = realpath(implode('/', $path)); - $this->_modulesReaderMock = $this->getMockBuilder('Magento\Core\Model\Config\Modules\Reader') + $this->_modulesReaderMock = $this->getMockBuilder('Magento\Module\Dir\Reader') ->disableOriginalConstructor() ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/ConfigTest.php index 9c0fa242e0debbd4d73c9efb89f653b33195dffe..f1c845a423632a36704d25f130a27cb28a1672fb 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/ConfigTest.php @@ -55,8 +55,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->method('createReader') ->will($this->returnValue($reader)); - /** @var \Magento\Core\Model\Config\Modules\Reader $modulesReaderMock */ - $modulesReaderMock = $this->getMockBuilder('Magento\Core\Model\Config\Modules\Reader') + /** @var \Magento\Module\Dir\Reader $modulesReaderMock */ + $modulesReaderMock = $this->getMockBuilder('Magento\Module\Dir\Reader') ->disableOriginalConstructor() ->getMock(); $modulesReaderMock->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/Config/ReaderTest.php index 0ab2abcd808daa7118e33b6b2be273a395891546..49cc3d2ef2e501a84a7f7e6b1270c84ece16b94f 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/Config/ReaderTest.php @@ -36,7 +36,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase protected $_converter; /** - * @var \Magento\App\Module\Dir\ReverseResolver|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Module\Dir\ReverseResolver|\PHPUnit_Framework_MockObject_MockObject */ protected $_moduleDirResolver; @@ -56,7 +56,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->_converter = $this->getMock('Magento\Core\Model\Email\Template\Config\Converter', array('convert')); $moduleReader = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array('getModuleDir'), array(), '', false + 'Magento\Module\Dir\Reader', array('getModuleDir'), array(), '', false ); $moduleReader ->expects($this->once()) @@ -69,7 +69,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $validationState->expects($this->once())->method('isValidated')->will($this->returnValue(false)); $this->_moduleDirResolver = $this->getMock( - 'Magento\App\Module\Dir\ReverseResolver', array(), array(), '', false + 'Magento\Module\Dir\ReverseResolver', array(), array(), '', false ); $this->_model = new \Magento\Core\Model\Email\Template\Config\Reader( diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/Config/SchemaLocatorTest.php index f9de2073af2e9af9ca8ce3a7613ca94fabc33e0e..39aa0ba809757fb35d5cf2fd3a0935847325c99c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/Config/SchemaLocatorTest.php @@ -31,14 +31,14 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\Config\Modules\Reader|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Module\Dir\Reader|\PHPUnit_Framework_MockObject_MockObject */ protected $_moduleReader; protected function setUp() { $this->_moduleReader = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array('getModuleDir'), array(), '', false + 'Magento\Module\Dir\Reader', array('getModuleDir'), array(), '', false ); $this->_moduleReader ->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/ConfigTest.php index f619f5d19ff261638fa947f5fb48e7d7e0c1a24e..0c254fbeefc4bcedf159cc02304cbe83c269f156 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Email/Template/ConfigTest.php @@ -36,7 +36,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected $_dataStorage; /** - * @var \Magento\Core\Model\Config\Modules\Reader|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Module\Dir\Reader|\PHPUnit_Framework_MockObject_MockObject */ protected $_moduleReader; @@ -51,7 +51,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(require __DIR__ . '/Config/_files/email_templates_merged.php')) ; $this->_moduleReader = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array('getModuleDir'), array(), '', false + 'Magento\Module\Dir\Reader', array('getModuleDir'), array(), '', false ); $this->_model = new \Magento\Core\Model\Email\Template\Config($this->_dataStorage, $this->_moduleReader); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/EncryptionTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/EncryptionTest.php deleted file mode 100644 index 733948afa11e0e4d320425e1bdc692ddd44d61bc..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/EncryptionTest.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Core\Model; - -class EncryptionTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider setHelperGetHashDataProvider - */ - public function testSetHelperGetHash($input) - { - $helper = $this->getMockBuilder('Magento\Core\Helper\Data') - ->disableOriginalConstructor() - ->setMockClassName('Magento_Core_Helper_Data_Stub') - ->getMock(); - $objectManager = $this->getMock('Magento\ObjectManager'); - $objectManager->expects($this->once()) - ->method('get') - ->with($this->stringContains('Magento_Core_Helper_Data_Stub')) - ->will($this->returnValue($helper)); - $coreConfig = $this->getMock('Magento\Core\Model\Config', array(), array(), '', false); - - /** - * @var \Magento\Core\Model\Encryption - */ - $model = new \Magento\Core\Model\Encryption($objectManager, $coreConfig, 'cryptKey'); - $model->setHelper($input); - $model->getHash('password', 1); - } - - /** - * @return array - */ - public function setHelperGetHashDataProvider() - { - $helper = $this->getMockBuilder('Magento\Core\Helper\Data') - ->disableOriginalConstructor() - ->setMockClassName('Magento_Core_Helper_Data_Stub') - ->getMock(); - return array( - 'string' => array('Magento_Core_Helper_Data_Stub'), - 'object' => array($helper), - ); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testSetHelperException() - { - $objectManager = $this->getMock('Magento\ObjectManager'); - $coreConfig = $this->getMock('Magento\Core\Model\Config', array(), array(), '', false); - - /** - * @var \Magento\Core\Model\Encryption - */ - $model = new \Magento\Core\Model\Encryption($objectManager, $coreConfig); - /** Mock object is not instance of \Magento\Code\Helper\Data and should not pass validation */ - $input = $this->getMock('Magento\Code\Helper\Data', array(), array(), '', false); - $model->setHelper($input); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/EntryPoint/CronTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/EntryPoint/CronTest.php deleted file mode 100644 index 7e8366b4de94a2a40889b51768a251e33fde96fd..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/EntryPoint/CronTest.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\EntryPoint; - -class CronTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManagerMock; - - protected function setUp() - { - $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); - $config = $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false); - - $this->_model = new \Magento\Core\Model\EntryPoint\Cron($config, $this->_objectManagerMock); - } - - public function testProcessRequest() - { - $appMock = $this->getMock('Magento\Core\Model\App', array(), array(), '', false); - $eventManagerMock = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - $configScopeMock = $this->getMock('Magento\Config\Scope', array(), array(), '', false); - - $map = array( - array('Magento\Core\Model\App', $appMock), - array('Magento\Event\ManagerInterface', $eventManagerMock), - array('Magento\Config\ScopeInterface', $configScopeMock), - ); - - $this->_objectManagerMock->expects($this->any())->method('get')->will($this->returnValueMap($map)); - - $appMock->expects($this->once())->method('setUseSessionInUrl')->with(false); - $appMock->expects($this->once())->method('requireInstalledInstance'); - - $configScopeMock->expects($this->once())->method('setCurrentScope')->with('crontab'); - $eventManagerMock->expects($this->once())->method('dispatch')->with('default'); - - $this->_model->processRequest(); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/MediaTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/MediaTest.php new file mode 100644 index 0000000000000000000000000000000000000000..17e6d421d17c859569d6805e4c94822e7c83264e --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/MediaTest.php @@ -0,0 +1,105 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\Model\File\Storage; + +/** + * Class MediaTest + */ +class MediaTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Core\Model\File\Storage\File + */ + protected $_model; + /** + * @var \Magento\Core\Helper\File\Media + */ + protected $_loggerMock; + + /** + * @var \Magento\Core\Helper\Context + */ + protected $_storageHelperMock; + + /** + * @var \Magento\Core\Model\Date + */ + protected $_mediaHelperMock; + + /** + * @var \Magento\Core\Model\Resource\File\Storage\File + */ + protected $_fileUtilityMock; + + protected function setUp() + { + $this->_loggerMock = + $this->getMock('Magento\Logger', array(), array(), '', false); + $this->_storageHelperMock = + $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); + $this->_mediaHelperMock = + $this->getMock('Magento\Core\Helper\File\Media', array(), array(), '', false); + $this->_fileUtilityMock = + $this->getMock('Magento\Core\Model\Resource\File\Storage\File', array(), array(), '', false); + + $this->_model = new \Magento\Core\Model\File\Storage\File( + $this->_loggerMock, + $this->_storageHelperMock, + $this->_mediaHelperMock, + $this->_fileUtilityMock + ); + } + + protected function tearDown() + { + unset($this->_model); + } + + public function testCollectDataSuccess() + { + $this->_fileUtilityMock + ->expects($this->any()) + ->method('getStorageData') + ->will($this->returnValue(array('files' => array('value1', 'value2')))); + $this->assertEmpty(array_diff($this->_model->collectData(0, 1), array('value1'))); + } + + public function testCollectDataFailureWrongType() + { + $this->_fileUtilityMock + ->expects($this->any()) + ->method('getStorageData') + ->will($this->returnValue(array('files' => array('value1', 'value2')))); + $this->assertFalse($this->_model->collectData(0, 1, 'some-wrong-key')); + } + + public function testCollectDataFailureEmptyDataWasGiven() + { + $this->_fileUtilityMock + ->expects($this->any()) + ->method('getStorageData') + ->will($this->returnValue(array('files' => array()))); + $this->assertFalse($this->_model->collectData(0, 1)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/UpdateTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/UpdateTest.php index 72c0d9d41cca8a94e0af806e50a1ce5d289bbcb0..eafcc7b703e0eac7593e9e3cb48f43704da09947 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/UpdateTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/UpdateTest.php @@ -38,22 +38,27 @@ class UpdateTest extends \PHPUnit_Framework_TestCase { $resourceModel = $this->getMock( 'Magento\Core\Model\Resource\Layout\Update', - array('formatDate', 'getIdFieldName', 'beginTransaction', 'save', 'addCommitCallback', 'commit'), + array('__wakeup', 'formatDate', 'getIdFieldName', 'beginTransaction', 'save', 'addCommitCallback', + 'commit'), array(), '', false ); $resourceModel->expects($this->once()) + ->method('addCommitCallback') + ->will($this->returnSelf()); + $dateTime = $this->getMock('\Magento\Stdlib\DateTime', array(), array()); + $dateTime->expects($this->once()) ->method('formatDate') ->with($this->isType('int')) ->will($this->returnValue(self::TEST_FORMATTED_TIME)); - $resourceModel->expects($this->once()) - ->method('addCommitCallback') - ->will($this->returnSelf()); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); /** @var $model \Magento\Core\Model\Layout\Update */ - $model = $helper->getObject('Magento\Core\Model\Layout\Update', array('resource' => $resourceModel)); + $model = $helper->getObject('Magento\Core\Model\Layout\Update', array( + 'resource' => $resourceModel, + 'dateTime' => $dateTime + )); $model->setId(0); // set any data to set _hasDataChanges flag $model->save(); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Locale/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Locale/ValidatorTest.php index abe9072459e1f223396185465d3ed34cfb5f7cb6..8e1dfeafe24fee949619de3bdcbf50c98445f65c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Locale/ValidatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Locale/ValidatorTest.php @@ -36,8 +36,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $coreConfig = $this->getMock('Magento\Core\Model\Config', array(), array(), '', false); - $localeConfigMock = $this->getMock('Magento\Core\Model\Locale\Config', array(), array($coreConfig)); + $localeConfigMock = $this->getMock('Magento\Core\Model\Locale\Config', array(), array(), '', false); $localeConfigMock->expects($this->any()) ->method('getAllowedLocales') ->will($this->returnValue(array('en_US', 'de_DE', 'es_ES'))); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/ModuleManagerTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/ModuleManagerTest.php index e144aa99cb712456147ac8ca78a595b39472b7b9..42969fe2e1aa7dd915b8b3017e4b8d8aab432776 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/ModuleManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/ModuleManagerTest.php @@ -48,7 +48,7 @@ class ModuleManagerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_moduleList = $this->getMockForAbstractClass('Magento\App\ModuleListInterface'); + $this->_moduleList = $this->getMockForAbstractClass('Magento\Module\ModuleListInterface'); $this->_storeConfig = $this->getMockForAbstractClass('Magento\Core\Model\Store\ConfigInterface'); $this->_model = new \Magento\Core\Model\ModuleManager($this->_storeConfig, $this->_moduleList, array( 'Module_DisabledOutputOne' => self::XML_PATH_OUTPUT_ENABLED, diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Page/Asset/MergedTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Page/Asset/MergedTest.php index fe4dd87fa6a957420df89fbac08871113dc6cc36..fa4f329c34ef35ed4486e49f4aa212eaece1378e 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Page/Asset/MergedTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Page/Asset/MergedTest.php @@ -73,7 +73,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase $this->_assetJsTwo->expects($this->any())->method('getSourceFile') ->will($this->returnValue('/pub/script_two.js')); - $this->_logger = $this->getMock('Magento\Core\Model\Logger', array('logException'), array(), '', false); + $this->_logger = $this->getMock('Magento\Logger', array('logException'), array(), '', false); $this->_dirs = $this->getMock('Magento\App\Dir', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Page/Asset/MinifiedTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Page/Asset/MinifiedTest.php index 63c7e93aebd22e22eb4a6df0c1c25385d2ef7943..69d22a86f5cda897841aa951a44b25d19e3d32bc 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Page/Asset/MinifiedTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Page/Asset/MinifiedTest.php @@ -47,7 +47,7 @@ class MinifiedTest extends \PHPUnit_Framework_TestCase protected $_viewUrl; /** - * @var \Magento\Core\Model\Logger|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Logger|PHPUnit_Framework_MockObject_MockObject */ protected $_logger; @@ -66,7 +66,7 @@ class MinifiedTest extends \PHPUnit_Framework_TestCase ); $this->_minifier = $this->getMock('Magento\Code\Minifier', array('getMinifiedFile'), array(), '', false); $this->_viewUrl = $this->getMock('Magento\Core\Model\View\Url', array(), array(), '', false); - $this->_logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $this->_logger = $this->getMock('Magento\Logger', array(), array(), '', false); $this->_model = new \Magento\Core\Model\Page\Asset\Minified($this->_asset, $this->_minifier, $this->_viewUrl, $this->_logger diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/SchemaLocatorTest.php deleted file mode 100644 index 0effbc4eb8370d0965636a979f56aa31b87e1517..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Config/SchemaLocatorTest.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Resource\Config; - -class SchemaLocatorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_modulesReaderMock; - - /** - * @var \Magento\Core\Model\Resource\Config\SchemaLocator - */ - protected $_model; - - protected function setUp() - { - $this->_modulesReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false - ); - - $this->_modulesReaderMock->expects($this->once()) - ->method('getModuleDir') - ->with('etc', 'Magento_Core') - ->will($this->returnValue('some_path')); - - $this->_model = new \Magento\Core\Model\Resource\Config\SchemaLocator($this->_modulesReaderMock); - } - - /** - * @covers \Magento\Core\Model\Resource\Config\SchemaLocator::getSchema - */ - public function testGetSchema() - { - $expectedSchemaPath = 'some_path' . DIRECTORY_SEPARATOR . 'resources.xsd'; - $this->assertEquals($expectedSchemaPath, $this->_model->getSchema()); - } - - /** - * @covers \Magento\Core\Model\Resource\Config\SchemaLocator::getPerFileSchema - */ - public function testGetPerFileSchema() - { - $this->assertNull($this->_model->getPerFileSchema()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php index 4cf96e755744042f53a52b59162fbf3d5a20ea0c..42fd76b180a7708a04e764ddd132777c2f6c7901 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php @@ -38,13 +38,13 @@ class AbstractTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\Resource|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Resource|PHPUnit_Framework_MockObject_MockObject */ protected $_resource; protected function setUp() { - $this->_resource = $this->getMock('Magento\Core\Model\Resource', + $this->_resource = $this->getMock('Magento\App\Resource', array('getConnection'), array(), '', false, false ); $this->_model = $this->getMock( @@ -76,7 +76,9 @@ class AbstractTest extends \PHPUnit_Framework_TestCase public function testGetConnectionInMemoryCaching() { $dir = $this->getMock('Magento\App\Dir', array(), array(), '', false); - $connection = new \Magento\DB\Adapter\Pdo\Mysql($dir, array( + $string = $this->getMock('Magento\Stdlib\String', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); + $connection = new \Magento\DB\Adapter\Pdo\Mysql($dir, $string, $dateTime, array( 'dbname' => 'test_dbname', 'username' => 'test_username', 'password' => 'test_password', diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php index 11b80a0be25f8185d531c0b25766ad9a356c4394..66ba811362cb5a247b545f5b469d2d7f96815cb8 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php @@ -89,7 +89,7 @@ abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase $resource = $this->getMockForAbstractClass('Magento\Core\Model\Resource\Db\AbstractDb', array(), '', false, true, - true, array('getReadConnection', 'getMainTable', 'getTable')); + true, array('getReadConnection', 'getMainTable', 'getTable', '__wakeup')); $resource->expects($this->any()) ->method('getReadConnection') ->will($this->returnValue($connection)); @@ -126,7 +126,8 @@ abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase $datetime = new \DateTime(); $storeInterval = new \DateInterval('P' . self::TEST_DAYS_BEFORE . 'D'); $datetime->sub($storeInterval); - $expectedDate = \Magento\Date::formatDate($datetime->getTimestamp()); + $dateTimeLib = new \Magento\Stdlib\DateTime; + $expectedDate = $dateTimeLib->formatDate($datetime->getTimestamp()); $this->_expectedConditions['data'][1][1]['lt'] = $expectedDate; $collection->addUpdatedDaysBeforeFilter(self::TEST_DAYS_BEFORE); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/Link/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/Link/CollectionTest.php index 7325f6ec32a3c1080fa58dc664c1c52e62d7e875..f31f926ac647f360194bb8618f751068e2e62919 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/Link/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/Link/CollectionTest.php @@ -51,9 +51,10 @@ class CollectionTest extends \Magento\Core\Model\Resource\Layout\AbstractTestCas return new \Magento\Core\Model\Resource\Layout\Link\Collection( $eventManager, - $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false), + $this->getMock('Magento\Logger', array(), array(), '', false), $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'), $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false), + $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true), $this->_getResource($select) ); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/Update/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/Update/CollectionTest.php index 5207f571fb812d58522075688cf6955909aea7ed..dcedd3551462cbf17b8d4c38f1b0c19b3eb8e96d 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/Update/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/Update/CollectionTest.php @@ -42,9 +42,10 @@ class CollectionTest return new \Magento\Core\Model\Resource\Layout\Update\Collection( $eventManager, - $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false), + $this->getMock('Magento\Logger', array(), array(), '', false), $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'), $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false), + $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true), $this->_getResource($select) ); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/SessionTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/SessionTest.php index 4126cb942bbcba6ab8b48bb0ba19dd6c2e0c9adc..11ca61ffb1392e23ca2ca6d233c48d11e73318f4 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/SessionTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/SessionTest.php @@ -98,7 +98,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase */ protected function _prepareResourceMock($connection) { - $resource = $this->getMock('Magento\Core\Model\Resource', array('getTableName', 'getConnection'), + $resource = $this->getMock('Magento\App\Resource', array('getTableName', 'getConnection'), array(), '', false, false); $resource->expects($this->once()) ->method('getTableName') diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php index 71fa50d2e0532fc64e2b266ac839b39ef7506b3e..e296da35ad54215f7473507ec2b5a71025dd7daf 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php @@ -151,7 +151,7 @@ class MigrationTest extends \PHPUnit_Framework_TestCase */ public function testAppendClassAliasReplace() { - $moduleListMock = $this->getMock('Magento\App\ModuleListInterface'); + $moduleListMock = $this->getMock('Magento\Module\ModuleListInterface'); $moduleListMock->expects($this->once()) ->method('getModule') ->will($this->returnValue(array())); @@ -163,14 +163,14 @@ class MigrationTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false))); $contextMock->expects($this->once()) ->method('getResourceModel') - ->will($this->returnValue($this->getMock('Magento\Core\Model\Resource', array(), array(), '', false))); + ->will($this->returnValue($this->getMock('Magento\App\Resource', array(), array(), '', false))); $contextMock->expects($this->once()) ->method('getLogger') - ->will($this->returnValue($this->getMock('Magento\Core\Model\Logger', array(), array(), '', false))); + ->will($this->returnValue($this->getMock('Magento\Logger', array(), array(), '', false))); $contextMock->expects($this->once()) ->method('getModulesReader') ->will($this->returnValue( - $this->getMock('Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false) + $this->getMock('Magento\Module\Dir\Reader', array(), array(), '', false) )); $contextMock->expects($this->once()) ->method('getModuleList') @@ -233,15 +233,15 @@ class MigrationTest extends \PHPUnit_Framework_TestCase $tableRowsCount = count($tableData); $setupModel = new \Magento\Core\Model\Resource\Setup\Migration( - $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false, false), + $this->getMock('Magento\App\Resource', array(), array(), '', false, false), $this->getMock('Magento\Filesystem', array(), array(), '', false), $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false), $this->getMock('Magento\App\Dir', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false), + $this->getMock('Magento\Logger', array(), array(), '', false), $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), $this->getMock('Magento\Core\Model\Config', array(), array(), '', false, false), - $this->getMock('Magento\App\ModuleListInterface'), - $this->getMock('Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false, false), + $this->getMock('Magento\Module\ModuleListInterface'), + $this->getMock('Magento\Module\Dir\Reader', array(), array(), '', false, false), $this->getMock('Magento\Core\Model\Resource\Resource', array(), array(), '', false), $this->getMock('Magento\Core\Model\Resource\Theme\CollectionFactory', array(), array(), '', false), $this->getMock('Magento\Core\Model\Theme\CollectionFactory', array(), array(), '', false), diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Store/Storage/DefaultTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Store/Storage/DefaultTest.php index bb9dea385ac2b3233b4b76e3432fb2f55086121c..6759bc3952319bb626c48aa0606f164985a4924c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Store/Storage/DefaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Store/Storage/DefaultTest.php @@ -22,16 +22,15 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Core\Model\Store\Storage; /** * Test class for \Magento\Core\Model\Store\Storage\DefaultStorage */ -namespace Magento\Core\Model\Store\Storage; - class DefaultTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Store\Storage\DefaultStorage + * @var DefaultStorage */ protected $_model; @@ -91,7 +90,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase $this->_storeFactoryMock->expects($this->once()) ->method('create') ->will($this->returnValue($this->_storeMock)); - $this->_model = new \Magento\Core\Model\Store\Storage\DefaultStorage( + $this->_model = new DefaultStorage( $this->_storeFactoryMock, $this->_websiteFactoryMock, $this->_groupFactoryMock @@ -131,6 +130,12 @@ class DefaultTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('Magento\Core\Model\Website', $this->_model->getWebsite($websiteId)); } + public function testGetWebsiteEmptyString() + { + $websiteId = ''; + $this->assertInstanceOf('Magento\Core\Model\Website', $this->_model->getWebsite($websiteId)); + } + public function testGetWebsitesWithDefault() { $withDefault = true; diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Store/StorageFactoryTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Store/StorageFactoryTest.php index 6bd253b05721dc2d858a9b8f003d187e24cd562a..bc1a3078196b9f78df174a0ebedf777878b9f155 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Store/StorageFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Store/StorageFactoryTest.php @@ -51,11 +51,6 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase */ protected $_logMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_configMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -91,17 +86,9 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase $this->_arguments = array('test' => 'argument'); $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); $this->_eventManagerMock = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - $this->_logMock = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); - $this->_configMock = $this->getMock('Magento\Core\Model\ConfigInterface', array(), array(), '', false); - $this->_appMock = $this->getMockForAbstractClass( - 'Magento\Core\Model\AppInterface', - [], - '', - false, - false, - false, - ['setUseSessionInUrl'] - ); + $this->_logMock = $this->getMock('Magento\Logger', array(), array(), '', false); + $this->_appMock + = $this->getMock('\Magento\Core\Model\AppInterface'); $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); $this->_storage = $this->getMock('Magento\Core\Model\Store\StorageInterface'); @@ -109,7 +96,6 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase $this->_objectManagerMock, $this->_eventManagerMock, $this->_logMock, - $this->_configMock, $this->_appMock, $this->_appStateMock, $this->_defaultStorage, @@ -149,11 +135,15 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase ->method('getStore') ->will($this->returnValue($store)); - $store->expects($this->once()) + $store->expects($this->at(0)) ->method('getConfig') - ->with(\Magento\Core\Model\Session\AbstractSession::XML_PATH_USE_FRONTEND_SID) + ->with($this->equalTo(\Magento\Core\Model\Session\AbstractSession::XML_PATH_USE_FRONTEND_SID)) ->will($this->returnValue(true)); + $store->expects($this->at(1)) + ->method('getConfig') + ->with($this->equalTo('dev/log/active')) + ->will($this->returnValue(true)); $this->_objectManagerMock ->expects($this->once()) @@ -164,8 +154,10 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase $this->_eventManagerMock->expects($this->once())->method('dispatch')->with('core_app_init_current_store_after'); $this->_logMock ->expects($this->once()) - ->method('initForStore') - ->with($store, $this->_configMock); + ->method('unsetLoggers'); + $this->_logMock + ->expects($this->exactly(2)) + ->method('addStreamLog'); $this->_appMock->expects($this->once()) ->method('setUseSessionInUrl')->with(true); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Customization/PathTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Customization/PathTest.php index 0daccfaaadcd0c1f888b331912a7d8914496e549..69de1bb17ca3e2dbe7dc94931b295621e40e9cc5 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Customization/PathTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Customization/PathTest.php @@ -47,9 +47,18 @@ class PathTest extends \PHPUnit_Framework_TestCase */ protected $_theme; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_appState; + protected function setUp() { $this->_theme = $this->getMock('Magento\Core\Model\Theme', null, array(), '', false); + $this->_appState = $this->getMock('Magento\App\State', array('getAreaCode'), array(), '', false); + $appStateProperty = new \ReflectionProperty('\Magento\Core\Model\Theme', '_appState'); + $appStateProperty->setAccessible(true); + $appStateProperty->setValue($this->_theme, $this->_appState); $this->_dir = $this->getMock('Magento\App\Dir', array(), array(), '', false); $this->_model = new \Magento\Core\Model\Theme\Customization\Path($this->_dir); } @@ -82,7 +91,7 @@ class PathTest extends \PHPUnit_Framework_TestCase */ public function testGetThemeFilesPath() { - $this->_theme->setArea('area51'); + $this->_appState->expects($this->any())->method('getAreaCode')->will($this->returnValue('area51')); $this->_dir->expects($this->once())->method('getDir')->with(\Magento\App\Dir::THEMES) ->will($this->returnValue('/themes_dir')); $expectedPath = implode( diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/VirtualTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/VirtualTest.php index a8cfbbc9bbebe0d82f21b243b3b691de806abf67..ed175d0244068f3fda52edf0d9a9652bb5b1e9a6 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/VirtualTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/VirtualTest.php @@ -69,6 +69,10 @@ class VirtualTest extends \PHPUnit_Framework_TestCase { $theme = $this->getMock('Magento\Core\Model\Theme', array('getStagingVersion'), array(), '', false, false); $theme->expects($this->once())->method('getStagingVersion')->will($this->returnValue(null)); + $appState = $this->getMock('Magento\App\State', array('getAreaCode'), array(), '', false); + $appState->expects($this->any())->method('getAreaCode')->will($this->returnValue('fixture_area')); + $appStateProperty = new \ReflectionProperty('Magento\Core\Model\Theme', '_appState'); + $appStateProperty->setAccessible(true); /** @var $theme \Magento\Object */ $theme->setData(array( 'id' => 'fixture_theme_id', @@ -76,9 +80,9 @@ class VirtualTest extends \PHPUnit_Framework_TestCase 'theme_title' => 'fixture_theme_title', 'preview_image' => 'fixture_preview_image', 'is_featured' => 'fixture_is_featured', - 'area' => 'fixture_area', 'type' => \Magento\Core\Model\Theme::TYPE_VIRTUAL )); + $appStateProperty->setValue($theme, $appState); $themeStaging = $this->getMock('Magento\Core\Model\Theme', array('setData', 'save'), array(), '', false, false); $themeStaging->expects($this->at(0))->method('setData')->with(array( @@ -88,9 +92,9 @@ class VirtualTest extends \PHPUnit_Framework_TestCase 'theme_title' => 'fixture_theme_title - Staging', 'preview_image' => 'fixture_preview_image', 'is_featured' => 'fixture_is_featured', - 'area' => 'fixture_area', 'type' => \Magento\Core\Model\Theme::TYPE_STAGING, )); + $appStateProperty->setValue($themeStaging, $appState); $themeStaging->expects($this->at(1))->method('save'); $themeFactory = $this->getMock('Magento\Core\Model\ThemeFactory', array('create'), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ImageTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ImageTest.php index f836d3d75ff824880843e1e33d1891e4a18af053..603b03a6e015cbd95d3a081d40f7676e28308e46 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ImageTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ImageTest.php @@ -67,7 +67,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase $this->_themeMock = $this->getMock('Magento\Core\Model\Theme', null, array(), '', false, false); $this->_uploaderMock = $this->getMock('Magento\Core\Model\Theme\Image\Uploader', array(), array(), 'UploaderProxy', false, false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false, false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false, false); $this->_model = new \Magento\Core\Model\Theme\Image( $this->_filesystemMock, @@ -134,7 +134,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Core\Model\Image\Factory', array(), array(), '', false, false), $this->_uploaderMock, $this->_getImagePathMock(), - $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false, false), + $this->getMock('Magento\Logger', array(), array(), '', false, false), $this->_themeMock ); $this->assertNotEmpty($themeImage); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/UrlTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/UrlTest.php index 6388dd0cc7bf0e4d2bb0c654d15f94651d8f25c3..93c822b6d8562c5f96d65aeef772039615363a50 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/UrlTest.php @@ -37,14 +37,17 @@ class UrlTest extends \PHPUnit_Framework_TestCase */ protected $_model; + + protected $_sessionMock; + protected function setUp() { + $this->_sessionMock = $this->getMock('Magento\Core\Model\Session\AbstractSession', array(), array(), '', false); $this->_model = new \Magento\Core\Model\Url( - $this->getMock('Magento\App\RouterListInterface'), + $this->getMock('\Magento\App\Route\ConfigInterface'), $this->getMock('Magento\App\Request\Http', array(), array(), '', false), $this->getMock('Magento\Core\Model\Url\SecurityInfoInterface'), $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false), - $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false, false), $this->getMock('Magento\Core\Model\App', array(), array(), '', false, false), $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false, false), $this->getMock('Magento\Core\Model\Session', array(), array(), '', false, false) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Validator/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Validator/FactoryTest.php index f7e695a2f462606de5bec1f22ca5a3fb1f05a99f..88bd8eaa7ab41fb3f117ba65238d00c64892ff17 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Validator/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Validator/FactoryTest.php @@ -33,7 +33,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase protected $_objectManager; /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_config; @@ -75,7 +75,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($this->_validatorConfig)); // Config mock - $this->_config = $this->getMockBuilder('Magento\Core\Model\Config\Modules\Reader') + $this->_config = $this->getMockBuilder('Magento\Module\Dir\Reader') ->setMethods(array('getConfigurationFiles')) ->disableOriginalConstructor() ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php b/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3cca4b93b7bb94c3a6a03d0667eab0c3958d3944 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php @@ -0,0 +1,52 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Cron\App\Cron\Plugin; + +class ApplicationInitializerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Cron\App\Cron\Plugin\ApplicationInitializer + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_applicationMock; + + protected function setUp() + { + $this->_applicationMock = $this->getMock('Magento\Core\Model\AppInterface'); + $this->_model = new ApplicationInitializer( + $this->_applicationMock + ); + } + + public function testBeforeExecutePerformsRequiredChecks() + { + $this->_applicationMock->expects($this->once())->method('requireInstalledInstance'); + $this->_applicationMock->expects($this->once())->method('setUseSessionInUrl')->with(false); + $this->_model->beforeExecute(array()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/XmlTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/XmlTest.php index 69bcebe30c935b0b53bc4e66b68814661ef2a8ad..8a4b131003efaca5e6d8acafe0c982423fa88009 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/XmlTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/XmlTest.php @@ -46,7 +46,7 @@ class XmlTest extends \PHPUnit_Framework_TestCase $schema = $this->getMockBuilder('Magento\Cron\Model\Config\SchemaLocator') ->disableOriginalConstructor() ->getMock(); - $validator = $this->getMockBuilder('Magento\Core\Model\Config\ValidationState') + $validator = $this->getMockBuilder('\Magento\Config\ValidationStateInterface') ->disableOriginalConstructor() ->getMock(); $this->_xmlReader = new \Magento\Cron\Model\Config\Reader\Xml($fileResolver, $converter, $schema, $validator); diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/SchemaLocatorTest.php index 40df84d5809daff2b91d409de7737c25f7d7ac82..b2739a0f270935e2de31f934bb470b1dffa41be7 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/SchemaLocatorTest.php @@ -42,7 +42,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->_moduleReaderMock = $this->getMockBuilder('Magento\Core\Model\Config\Modules\Reader') + $this->_moduleReaderMock = $this->getMockBuilder('Magento\Module\Dir\Reader') ->disableOriginalConstructor() ->getMock(); $this->_moduleReaderMock->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php index f4fcbf3a320ce48b3f220ee5947405d854ef50d6..65446f35993db6f2ffff1384cbb3663712197c84 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php @@ -36,7 +36,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected $_observer; /** - * @var \Magento\Core\Model\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */ protected $_objectManager; @@ -63,7 +63,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->_objectManager = $this->getMockBuilder('Magento\Core\Model\ObjectManager') + $this->_objectManager = $this->getMockBuilder('Magento\App\ObjectManager') ->disableOriginalConstructor() ->getMock(); $this->_app = $this->getMockBuilder('Magento\Core\Model\App') diff --git a/dev/tests/unit/testsuite/Magento/Adminhtml/Controller/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php similarity index 93% rename from dev/tests/unit/testsuite/Magento/Adminhtml/Controller/CustomerTest.php rename to dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index e00c0a8668c68c6711ad5e8b47996505c20d094b..6cc18143e8475a1f0baca5d50aeeb75b117ce4ff 100644 --- a/dev/tests/unit/testsuite/Magento/Adminhtml/Controller/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -1,6 +1,6 @@ <?php /** - * Unit test for \Magento\Adminhtml\Controller\Customer controller + * Unit test for \Magento\Customer\Controller\Adminhtml\Index controller * * Magento * @@ -26,11 +26,11 @@ */ /** - * Class \Magento\Adminhtml\Controller\CustomerTest + * Class \Magento\Customer\Controller\Adminhtml\IndexTest */ -namespace Magento\Adminhtml\Controller; +namespace Magento\Customer\Controller\Adminhtml; -class CustomerTest extends \PHPUnit_Framework_TestCase +class IndexTest extends \PHPUnit_Framework_TestCase { /** * Request mock instance @@ -49,14 +49,14 @@ class CustomerTest extends \PHPUnit_Framework_TestCase /** * Instance of mocked tested object * - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Adminhtml\Controller\Customer + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Customer\Controller\Adminhtml\Index */ protected $_testedObject; /** * ObjectManager mock instance * - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\ObjectManager + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\ObjectManager */ protected $_objectManager; @@ -93,7 +93,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase ->with($this->equalTo('X-Frame-Options')) ->will($this->returnValue(true)); - $this->_objectManager = $this->getMockBuilder('Magento\Core\Model\ObjectManager') + $this->_objectManager = $this->getMockBuilder('Magento\App\ObjectManager') ->disableOriginalConstructor() ->setMethods(array('get', 'create')) ->getMock(); @@ -141,7 +141,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase $args = array('context' => $contextMock); $helperObjectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_testedObject = $helperObjectManager->getObject('Magento\Adminhtml\Controller\Customer', $args); + $this->_testedObject = $helperObjectManager->getObject('Magento\Customer\Controller\Adminhtml\Index', $args); } /** @@ -157,7 +157,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase ); $this->_helper->expects($this->once()) ->method('getUrl') - ->with($this->equalTo('adminhtml/customer'), $this->equalTo(array())) + ->with($this->equalTo('customer/index'), $this->equalTo(array())) ->will($this->returnValue($redirectLink)); $this->_response->expects($this->once())->method('setRedirect')->with($this->equalTo($redirectLink)); @@ -187,7 +187,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase $this->_helper->expects($this->any()) ->method('getUrl') - ->with($this->equalTo('adminhtml/customer'), $this->equalTo(array())) + ->with($this->equalTo('customer/index'), $this->equalTo(array())) ->will($this->returnValue($redirectLink)); $this->_response->expects($this->once())->method('setRedirect')->with($this->equalTo($redirectLink)); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/ReaderTest.php index 7438c40eb2c8fc3f47615000a3d1904f53b40284..7568b457434a3ea01548e8aad61f1e31c3fa281b 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/ReaderTest.php @@ -66,7 +66,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->_converter = $this->getMock('Magento\Customer\Model\Address\Config\Converter', array('convert')); $moduleReader = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array('getModuleDir'), array(), '', false + 'Magento\Module\Dir\Reader', array('getModuleDir'), array(), '', false ); $moduleReader->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/SchemaLocatorTest.php index 4f1f4b418f0b3da9940425eb8746cd90971452c4..cf7be744842a3a5fa261eb4f4f23bce0042f5b36 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Address/Config/SchemaLocatorTest.php @@ -32,7 +32,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\Config\Modules\Reader|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Module\Dir\Reader|PHPUnit_Framework_MockObject_MockObject */ protected $_moduleReader; @@ -50,7 +50,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase { $this->_xsdFile = $this->_xsdDir . '/address_formats.xsd'; $this->_moduleReader = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array('getModuleDir'), array(), '', false + 'Magento\Module\Dir\Reader', array('getModuleDir'), array(), '', false ); $this->_moduleReader ->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php index 36493d26c95967a2c00c9ed6e59da3c413cd8f18..291820d962e582ff0f522c7e94b5f50744c429c2 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php @@ -37,9 +37,6 @@ class CustomerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Customer\Helper\Data */ protected $_customerData; - /** @var \Magento\Core\Helper\Data */ - protected $_coreData; - /** @var \Magento\Core\Model\Website|\PHPUnit_Framework_MockObject_MockObject */ protected $_website; @@ -73,10 +70,6 @@ class CustomerTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->setMethods(array('getResetPasswordLinkExpirationPeriod')) ->getMock(); - $this->_coreData = $this->getMockBuilder('Magento\Core\Helper\Data') - ->disableOriginalConstructor() - ->setMethods(array()) - ->getMock(); $this->_website = $this->getMockBuilder('Magento\Core\Model\Website') ->disableOriginalConstructor() ->setMethods(array('getStoreIds', '__wakeup')) @@ -103,6 +96,10 @@ class CustomerTest extends \PHPUnit_Framework_TestCase ->getMock(); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $encryptor = $this->getMockBuilder('\Magento\Encryption\EncryptorInterface') + ->disableOriginalConstructor() + ->setMethods(array()) + ->getMock(); $this->_storeManager = $this->getMockBuilder('Magento\Core\Model\StoreManager') ->disableOriginalConstructor() @@ -118,7 +115,6 @@ class CustomerTest extends \PHPUnit_Framework_TestCase $this->_model = new \Magento\Customer\Model\Customer( $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), $this->_customerData, - $this->_coreData, $this->_contextMock, $coreRegistry, $this->_senderMock, @@ -133,6 +129,9 @@ class CustomerTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Core\Model\Email\InfoFactory', array(), array(), '', false), $this->getMock('Magento\Customer\Model\GroupFactory', array(), array(), '', false), $this->getMock('Magento\Customer\Model\AttributeFactory', array(), array(), '', false), + $encryptor, + new \Magento\Math\Random, + new \Magento\Stdlib\DateTime, $this->_collectionMock, array() ); diff --git a/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php b/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php index 7a555a7d50422e81000a8173ab31144ebfc31776..dde697b6e56cca0d20b651306efb90044df9c622 100644 --- a/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php +++ b/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php @@ -38,7 +38,7 @@ class DbTest extends \PHPUnit_Framework_TestCase { $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $this->_collection = new \Magento\Data\Collection\Db($logger, $fetchStrategy, $entityFactory); } @@ -252,7 +252,7 @@ class DbTest extends \PHPUnit_Framework_TestCase { $fetchStrategy = $this->getMock('Magento\Data\Collection\Db\FetchStrategyInterface'); $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $collection = $this->getMock( 'Magento\Data\Collection\Db', array('_logQuery'), diff --git a/dev/tests/unit/testsuite/Magento/Data/Form/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Data/FormFactoryTest.php similarity index 73% rename from dev/tests/unit/testsuite/Magento/Data/Form/FactoryTest.php rename to dev/tests/unit/testsuite/Magento/Data/FormFactoryTest.php index ed73af499f357a88c7046a9b925a46e6be49c21b..8bec99ac5f251ef04e001220656502bc097f1233 100644 --- a/dev/tests/unit/testsuite/Magento/Data/Form/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Data/FormFactoryTest.php @@ -22,32 +22,26 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Data\Form; +namespace Magento\Data; /** - * Tests for \Magento\Data\Form\Factory + * Tests for \Magento\Data\FormFactory */ -class FactoryTest extends \PHPUnit_Framework_TestCase +class FormFactoryTest extends \PHPUnit_Framework_TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $_objectManagerMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_sessionMock; - protected function setUp() { $this->_objectManagerMock = $this->getMock('Magento\ObjectManager\ObjectManager', array(), array(), '', false); - $this->_sessionMock = $this->getMock('Magento\Core\Model\Session', array(), array(), '', false); } /** * @expectedException \Magento\Exception - * @expectedExceptionMessage WrongClass doesn't extends \Magento\Data\Form + * @expectedExceptionMessage WrongClass doesn't extend \Magento\Data\Form */ public function testWrongTypeException() { @@ -56,7 +50,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase $formMock = $this->getMock($className, array(), array(), '', false); $this->_objectManagerMock->expects($this->once())->method('create')->will($this->returnValue($formMock)); - $formFactory = new Factory($this->_objectManagerMock, $this->_sessionMock, $className); + $formFactory = new FormFactory($this->_objectManagerMock, $className); $formFactory->create(); } @@ -68,11 +62,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase ->method('create') ->with($className) ->will($this->returnValue($formMock)); - $formMock->expects($this->once()) - ->method('setSession') - ->with($this->_sessionMock); - $formFactory = new Factory($this->_objectManagerMock, $this->_sessionMock, $className); + $formFactory = new FormFactory($this->_objectManagerMock, $className); $this->assertSame($formMock, $formFactory->create()); } } diff --git a/dev/tests/unit/testsuite/Magento/Data/FormTest.php b/dev/tests/unit/testsuite/Magento/Data/FormTest.php index 76cd58b11add0f6331e5cd64adec98cd9eb0e6c9..6abaafa466fff3e819e889da6eaee06547e3290d 100644 --- a/dev/tests/unit/testsuite/Magento/Data/FormTest.php +++ b/dev/tests/unit/testsuite/Magento/Data/FormTest.php @@ -25,7 +25,7 @@ namespace Magento\Data; /** - * Tests for \Magento\Data\Form\Factory + * Tests for \Magento\Data\FormFactory * @SuppressWarnings(PHPMD.LongVariable) */ class FormTest extends \PHPUnit_Framework_TestCase @@ -40,6 +40,11 @@ class FormTest extends \PHPUnit_Framework_TestCase */ protected $_factoryCollectionMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_sessionMock; + /** * @var \Magento\Data\Form */ @@ -52,30 +57,20 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->_factoryCollectionMock = $this->getMock('Magento\Data\Form\Element\CollectionFactory', array('create'), array(), '', false); $this->_factoryCollectionMock->expects($this->any())->method('create')->will($this->returnValue(array())); + $this->_sessionMock = $this->getMock( + 'Magento\Core\Model\Session', array('getFormKey'), array(), '', false + ); - $this->_form = new Form($this->_factoryElementMock, $this->_factoryCollectionMock); - } - - /** - * @expectedException \Magento\Exception - */ - public function testRenderWithoutSetSession() - { - $this->_form->setUseContainer(true); - $this->_form->setMethod('post'); - $this->_form->toHtml(); + $this->_form = new Form($this->_sessionMock, $this->_factoryElementMock, $this->_factoryCollectionMock); } public function testFormKeyUsing() { $formKey = 'form-key'; - $sessionMock = $this->getMock('Magento\Core\Model\Session\AbstractSession', array('getFormKey'), array(), '', - false); - $sessionMock->expects($this->once())->method('getFormKey')->will($this->returnValue($formKey)); + $this->_sessionMock->expects($this->once())->method('getFormKey')->will($this->returnValue($formKey)); $this->_form->setUseContainer(true); $this->_form->setMethod('post'); - $this->_form->setSession($sessionMock); $this->assertContains($formKey, $this->_form->toHtml()); } } diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/SaveTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/SaveTest.php index f8c985b0dccd1559023aa481be608469610c63b7..2c9601dc93eccf81ca67154696a426c8ef660a01 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/SaveTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Toolbar/Buttons/SaveTest.php @@ -43,41 +43,33 @@ class SaveTest extends \PHPUnit_Framework_TestCase protected function setUp() { - // 1. Get helper mock - /** @var $helper \Magento\Backend\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */ - $helper = $this->getMock('Magento\Backend\Helper\Data', array('escapeHtml'), array(), '', false); - $helper->expects($this->any()) + /** @var $escaper \Magento\Escaper|\PHPUnit_Framework_MockObject_MockObject */ + $escaper = $this->getMockBuilder('Magento\Escaper') + ->disableOriginalConstructor() + ->setMethods(array('escapeHtml')) + ->getMock(); + $escaper->expects($this->any()) ->method('escapeHtml') ->will($this->returnArgument(0)); - // 2. Inject helper to helper factory - /** @var $helperFactory \Magento\Core\Model\Factory\Helper|\PHPUnit_Framework_MockObject_MockObject */ - $helperFactory = $this->getMock('Magento\Core\Model\Factory\Helper', array('get'), array(), '', false); - $helperFactory->expects($this->any()) - ->method('get') - ->with('Magento\Backend\Helper\Data') - ->will($this->returnValue($helper)); - - // 3. Get service mock - /** @var $service \Magento\Backend\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */ - $service = $this->getMock('Magento\Backend\Helper\Data', array('escapeHtml'), array(), '', false); - - // 4. Get URL model /** @var $urlBuilder \Magento\Core\Model\Url|\PHPUnit_Framework_MockObject_MockObject */ $urlBuilder = $this->getMock('Magento\Core\Model\Url', array('getUrl'), array(), '', false); $urlBuilder->expects($this->any()) ->method('getUrl') ->will($this->returnValue($this->_url)); - //5. Run functionality - $testHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $data = array( - 'helperFactory' => $helperFactory, - 'service' => $service, - 'urlBuilder' => $urlBuilder + $context = $this->getMockBuilder('Magento\Backend\Block\Template\Context') + ->disableOriginalConstructor() + ->setMethods(array('getEscaper', 'getUrlBuilder')) + ->getMock(); + $context->expects($this->any())->method('getEscaper')->will($this->returnValue($escaper)); + $context->expects($this->any())->method('getUrlBuilder')->will($this->returnValue($urlBuilder)); + + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_block = $objectManager->getObject( + 'Magento\DesignEditor\Block\Adminhtml\Editor\Toolbar\Buttons\Save', + array('context' => $context) ); - $this->_block = $testHelper->getObject('Magento\DesignEditor\Block\Adminhtml\Editor\Toolbar\Buttons\Save', - $data); } /** @@ -88,12 +80,10 @@ class SaveTest extends \PHPUnit_Framework_TestCase */ public function testInit($theme, $expected, $expectedOptions) { - $block = $this->_block; - - $block->setTheme($theme); - $block->init(); - $data = $block->getData(); - $options = $block->getOptions(); + $this->_block->setTheme($theme); + $this->_block->init(); + $data = $this->_block->getData(); + $options = $this->_block->getOptions(); $mainAction = json_decode($data['data_attribute']['mage-init'], true); if ($mainAction['button']['eventData']['confirm'] !== false) { @@ -140,8 +130,8 @@ class SaveTest extends \PHPUnit_Framework_TestCase 'event' => 'assign', 'target' => 'body', 'eventData' => array( - 'theme_id' => 123, - 'confirm' => array() + 'theme_id' => 123, + 'confirm' => array() ) ) ), @@ -154,9 +144,9 @@ class SaveTest extends \PHPUnit_Framework_TestCase 'event' => 'save', 'target' => 'body', 'eventData' => array( - 'theme_id' => 123, - 'save_url' => $this->_url, - 'confirm' => array() + 'theme_id' => 123, + 'save_url' => $this->_url, + 'confirm' => array() ) ) ), @@ -169,9 +159,9 @@ class SaveTest extends \PHPUnit_Framework_TestCase 'event' => 'save', 'target' => 'body', 'eventData' => array( - 'theme_id' => 123, - 'save_url' => $this->_url, - 'confirm' => array() + 'theme_id' => 123, + 'save_url' => $this->_url, + 'confirm' => array() ) ), ), @@ -183,7 +173,7 @@ class SaveTest extends \PHPUnit_Framework_TestCase 'eventData' => array( 'theme_id' => 123, 'save_url' => $this->_url, - 'confirm' => array() + 'confirm' => array() ) ), ), @@ -194,7 +184,7 @@ class SaveTest extends \PHPUnit_Framework_TestCase 'eventData' => array( 'theme_id' => 123, 'save_url' => $this->_url, - 'confirm' => array() + 'confirm' => array() ) ), ) @@ -211,11 +201,8 @@ class SaveTest extends \PHPUnit_Framework_TestCase { // 1. Get theme mock $stagingTheme = $this->_getThemeMock(\Magento\Core\Model\Theme::TYPE_STAGING); - - $block = $this->_block; - - $block->setTheme($stagingTheme); - $block->init(); + $this->_block->setTheme($stagingTheme); + $this->_block->init(); } /** diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/CustomTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/CustomTest.php index bd69efb763d40869bc430e6c43e9ffd6d7d0e8f1..a0aeaa2ce10ed9187b29687c0ccf94af9fff100c 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/CustomTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/CustomTest.php @@ -71,7 +71,7 @@ class CustomTest extends \PHPUnit_Framework_TestCase 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Code\Custom', array( 'config' => $this->getMock('Magento\Core\Model\Config', array(), array(), '', false), - 'formFactory' => $this->getMock('Magento\Data\Form\Factory', array(), array(), '', false), + 'formFactory' => $this->getMock('Magento\Data\FormFactory', array(), array(), '', false), 'urlBuilder' => $this->_urlBuilder, 'themeContext' => $this->_themeContext )); diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/JsTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/JsTest.php index 95cb6d6f3e7cc0b774c92306bdba240bc37436bc..0eea369a3fd6e5b890d3474de887c80c86e5cc4e 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/JsTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/JsTest.php @@ -72,7 +72,7 @@ class JsTest extends \PHPUnit_Framework_TestCase array( 'urlBuilder' => $this->_urlBuilder, 'themeContext' => $this->_themeContext, - 'formFactory' => $this->getMock('Magento\Data\Form\Factory', array(), array(), '', false), + 'formFactory' => $this->getMock('Magento\Data\FormFactory', array(), array(), '', false), )); $this->_model = $this->getMock( 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Code\Js', diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php index 10837f626e8a1481587e3a303486f33e073cb5c1..05b1b85f2125b00534133625305a6282c6ee96b0 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php @@ -59,7 +59,6 @@ class StandardTest extends \PHPUnit_Framework_TestCase * @param \Magento\App\RequestInterface $request * @param bool $isVde * @param bool $isLoggedIn - * @param bool $isConfiguration * @param array $routers * @param string|null $matchedValue * @@ -69,11 +68,10 @@ class StandardTest extends \PHPUnit_Framework_TestCase \Magento\App\RequestInterface $request, $isVde, $isLoggedIn, - $isConfiguration, array $routers = array(), $matchedValue = null ) { - $this->_model = $this->_prepareMocksForTestMatch($request, $isVde, $isLoggedIn, $isConfiguration, $routers); + $this->_model = $this->_prepareMocksForTestMatch($request, $isVde, $isLoggedIn, $routers); $this->assertEquals($matchedValue, $this->_model->match($request)); if ($isVde && $isLoggedIn) { @@ -96,7 +94,7 @@ class StandardTest extends \PHPUnit_Framework_TestCase 'vde' => 'vde router', ); - $routerListMock = $this->getMock('Magento\App\RouterListInterface'); + $routerListMock = $this->getMock('\Magento\App\Route\ConfigInterface'); // test data to verify routers match logic $matchedRequest = $this->getMock('Magento\App\Request\Http', @@ -109,7 +107,7 @@ class StandardTest extends \PHPUnit_Framework_TestCase // method "match" will be invoked for this router because it's first in the list $matchedRouter = $this->getMock( - 'Magento\Core\Controller\Varien\Router\Base', array(), array(), '', false + 'Magento\Core\App\Router\Base', array(), array(), '', false ); $matchedRouter->expects($this->once()) ->method('match') @@ -118,7 +116,7 @@ class StandardTest extends \PHPUnit_Framework_TestCase // method "match" will not be invoked for this router because controller will be found by first router $notMatchedRouter = $this->getMock( - 'Magento\Core\Controller\Varien\Router\Base', array(), array(), '', false + 'Magento\Core\App\Router\Base', array(), array(), '', false ); $notMatchedRouter->expects($this->never()) ->method('match'); @@ -136,7 +134,6 @@ class StandardTest extends \PHPUnit_Framework_TestCase ), '$isVde' => false, '$isLoggedIn' => true, - '$isConfiguration' => false, ), 'not logged as admin' => array( '$request' => $this->getMock( @@ -144,7 +141,6 @@ class StandardTest extends \PHPUnit_Framework_TestCase ), '$isVde' => true, '$isLoggedIn' => false, - '$isConfiguration' => false, ), 'no matched routers' => array( '$request' => $this->getMock( @@ -152,14 +148,12 @@ class StandardTest extends \PHPUnit_Framework_TestCase ), '$isVde' => true, '$isLoggedIn' => true, - '$isConfiguration' => false, '$routers' => $excludedRouters ), 'matched routers' => array( '$request' => $matchedRequest, '$isVde' => true, '$isLoggedIn' => true, - '$isConfiguration' => true, '$routers' => $matchedRouters, '$matchedValue' => $matchedController, ), @@ -170,7 +164,6 @@ class StandardTest extends \PHPUnit_Framework_TestCase * @param \Magento\App\RequestInterface $request * @param bool $isVde * @param bool $isLoggedIn - * @param bool $isConfiguration * @param array $routers * @return \Magento\DesignEditor\Controller\Varien\Router\Standard */ @@ -178,7 +171,6 @@ class StandardTest extends \PHPUnit_Framework_TestCase \Magento\App\RequestInterface $request, $isVde, $isLoggedIn, - $isConfiguration, array $routers ) { // default mocks - not affected on method functionality @@ -186,9 +178,8 @@ class StandardTest extends \PHPUnit_Framework_TestCase $helperMock = $this->_getHelperMock($isVde); $backendSessionMock = $this->_getBackendSessionMock($isVde, $isLoggedIn); $stateMock = $this->_getStateModelMock($routers); - $configurationMock = $this->_getConfigurationMock($isVde, $isLoggedIn, $isConfiguration); - $callback = function ($name) use ($helperMock, $backendSessionMock, $stateMock, $configurationMock) { + $callback = function ($name) use ($helperMock, $backendSessionMock, $stateMock) { switch ($name) { case 'Magento\DesignEditor\Helper\Data': return $helperMock; @@ -196,8 +187,6 @@ class StandardTest extends \PHPUnit_Framework_TestCase return $backendSessionMock; case 'Magento\DesignEditor\Model\State': return $stateMock; - case 'Magento\Core\Model\Config': - return $configurationMock; default: return null; } @@ -207,9 +196,17 @@ class StandardTest extends \PHPUnit_Framework_TestCase ->method('get') ->will($this->returnCallback($callback)); - $frontControllerMock = $this->getMock('Magento\App\FrontController', array(), array(), '', false); $rewriteServiceMock = $this->getMock('Magento\Core\App\Request\RewriteService', array(), array(), '', false); - $routerListMock = $this->getMock('Magento\App\RouterListInterface'); + $routerListMock = $this->getMock('Magento\App\RouterListInterface', + array( + 'getRouters', + 'current', + 'next', + 'key', + 'valid', + 'rewind' + ) + ); if ($isVde && $isLoggedIn) { $rewriteServiceMock->expects($this->once()) @@ -221,24 +218,20 @@ class StandardTest extends \PHPUnit_Framework_TestCase } $router = new \Magento\DesignEditor\Controller\Varien\Router\Standard( - $routerListMock, $this->getMock('Magento\App\ActionFactory', array(), array(), '', false), - $objectManager, - $this->getMock('Magento\Filesystem', array(), array(), '', false), - $this->getMock('Magento\Core\Model\App', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Route\Config', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Url\SecurityInfoInterface'), - $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Config', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Url', array(), array(), '', false), - $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false), + $this->getMock('Magento\App\DefaultPathInterface'), + $this->getMock('Magento\App\ResponseFactory', array(), array(), '', false), + $this->getMock('Magento\App\Route\Config', array(), array(), '', false), $this->getMock('Magento\App\State', array(), array(), '', false), + $this->getMock('Magento\UrlInterface'), + $this->getMock('Magento\Core\Model\StoreManagerInterface'), + $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false), + $this->getMock('Magento\Core\Model\Url\SecurityInfoInterface'), + $routerListMock, + $objectManager, $rewriteServiceMock, - 'frontend', - 'Magento\Core\Controller\Varien\Action', - 'vde' + 'frontend' ); - $router->setFront($frontControllerMock); return $router; } @@ -286,39 +279,4 @@ class StandardTest extends \PHPUnit_Framework_TestCase return $stateModel; } - - /** - * @param bool $isVde - * @param bool $isLoggedIn - * @param bool $isConfiguration - * @return \PHPUnit_Framework_MockObject_MockObject - */ - protected function _getConfigurationMock($isVde, $isLoggedIn, $isConfiguration) - { - $configuration = $this->getMock('Magento\Core\Model\Config', array(), array(), '', false); - - if ($isVde && $isLoggedIn) { - $configurationData = null; - if ($isConfiguration) { - $configurationData = self::VDE_CONFIGURATION_DATA; - } - $configuration->expects($this->at(0)) - ->method('getNode') - ->with(\Magento\DesignEditor\Model\Area::AREA_VDE) - ->will($this->returnValue($configurationData)); - - if ($isConfiguration) { - $elementMock = $this->getMock('stdClass', array('extend'), array(), '', false); - $elementMock->expects($this->once()) - ->method('extend') - ->with(self::VDE_CONFIGURATION_DATA, true); - - $configuration->expects($this->at(1)) - ->method('getNode') - ->with(\Magento\Core\Model\App\Area::AREA_FRONTEND) - ->will($this->returnValue($elementMock)); - } - } - return $configuration; - } } diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Config/Control/QuickStylesTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Config/Control/QuickStylesTest.php index 91372497f188edd654dfe2ca2166c219e437e310..b9b46b5bfb7809b9ab3ddb0133a3f1f663b4310a 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Config/Control/QuickStylesTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Config/Control/QuickStylesTest.php @@ -31,8 +31,8 @@ class QuickStylesTest extends \PHPUnit_Framework_TestCase { public function testGetSchemaFile() { - /** @var $moduleReader \Magento\Core\Model\Config\Modules\Reader|PHPUnit_Framework_MockObject_MockObject */ - $moduleReader = $this->getMockBuilder('Magento\Core\Model\Config\Modules\Reader') + /** @var $moduleReader \Magento\Module\Dir\Reader|PHPUnit_Framework_MockObject_MockObject */ + $moduleReader = $this->getMockBuilder('Magento\Module\Dir\Reader') ->setMethods(array('getModuleDir')) ->disableOriginalConstructor() ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php index 2a287d2d1e073c33956697f090009fde39bd6523..fe3e60eecb6d65a0d93ac8dde0c5e5932853a9b0 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php @@ -79,7 +79,7 @@ class NavigationModeTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_routerListMock; + protected $_configInterfaceMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -94,13 +94,12 @@ class NavigationModeTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_designHelperMock = $this->getMock('Magento\DesignEditor\Helper\Data', array(), array(), '', false); - $this->_coreHelperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); $this->_storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); $this->_appMock = $this->getMock('Magento\Core\Model\App', array(), array(), '', false); $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); $this->_sessionMock = $this->getMock('Magento\Core\Model\Session', array(), array(), '', false); - $this->_routerListMock = $this->getMock('\Magento\App\RouterListInterface'); + $this->_configInterfaceMock = $this->getMock('\Magento\App\Route\ConfigInterface'); $this->_securityInfoMock = $this->getMock('Magento\Core\Model\Url\SecurityInfoInterface'); $this->_requestMock->expects($this->any()) @@ -110,15 +109,15 @@ class NavigationModeTest extends \PHPUnit_Framework_TestCase array('themeId', 1)))); $this->_model = new \Magento\DesignEditor\Model\Url\NavigationMode( - $this->_routerListMock, + $this->_configInterfaceMock, $this->_requestMock, $this->_securityInfoMock, $this->_designHelperMock, $this->_storeConfigMock, - $this->_coreHelperMock, $this->_appMock, $this->_storeManagerMock, $this->_sessionMock, + 'string', $this->_testData ); $this->_model->setRequest($this->_requestMock); diff --git a/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php index 9744401d95fac557da32c856c578035073851b95..fe4276e5fcce6d48982cd45480167c9e657081c1 100644 --- a/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php @@ -60,7 +60,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); $storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $countryFactory = $this->getMock('Magento\Directory\Model\Resource\CountryFactory', array(), array(), '', false); $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php index 9247b021608db001abedf626755227c2170b129e..16d089cb71314afcc563ff08700838d8f8b50c57 100644 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php @@ -45,12 +45,12 @@ class TypeTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor()->getMock(); $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); $sampleResFactory = $this->getMock( 'Magento\Downloadable\Model\Resource\SampleFactory', array(), array(), '', false); $linkResource = $this->getMock('Magento\Downloadable\Model\Resource\Link', array(), array(), '', false); - $linksFactory = $this->getMock('Magento\Downloadable\Model\Resource\Link\Collection\Factory', + $linksFactory = $this->getMock('Magento\Downloadable\Model\Resource\Link\CollectionFactory', array(), array(), '', false ); $samplesFactory = $this->getMock('Magento\Downloadable\Model\Resource\Sample\CollectionFactory', diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php index 26a306d0f3dede98d5368719d899513e969023fa..f114f127582ca6bfa3d59fe3b17459a8c21a0f78 100644 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php @@ -84,11 +84,9 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase 'Magento\Sales\Model\Order\Pdf\AbstractPdf', array('drawLineBlocks', 'getPdf'), array(), '', false, false ); - $context = $this->getMock('Magento\Core\Helper\Context', array(), array(), '', false, false); - $locale = $this->getMock('Magento\Core\Model\Locale', array(), array(), '', false, false); $modelConstructorArgs = $objectManager ->getConstructArguments('Magento\Downloadable\Model\Sales\Order\Pdf\Items\Creditmemo', array( - 'helper' => new \Magento\Core\Helper\String($context, $locale) + 'string' => new \Magento\Stdlib\String() )); $this->_model = $this->getMock( @@ -97,8 +95,6 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase $modelConstructorArgs ); - $context = $this->getMock('Magento\Core\Helper\Context', array(), array(), '', false, false); - $this->_model->setStringHelper(new \Magento\Core\Helper\String($context, $locale)); $this->_model->setOrder($this->_order); $this->_model->setPdf($this->_pdf); $this->_model->setPage(new \Zend_Pdf_Page('a4')); @@ -191,7 +187,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase ; $this->assertNotSame($expectedPdfPage, $this->_model->getPage()); - $this->_model->draw(); + $this->assertNull($this->_model->draw()); $this->assertSame($expectedPdfPage, $this->_model->getPage()); } } diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Attribute/Data/TextTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Attribute/Data/TextTest.php index 34d1d34df1dd6291f8723f4ef22a08bda1e14b53..d9508c4ce748a5e1ac95c843327f0f02776344a7 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Attribute/Data/TextTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Attribute/Data/TextTest.php @@ -37,8 +37,10 @@ class TextTest extends \PHPUnit_Framework_TestCase protected function setUp() { $locale = $this->getMock('Magento\Core\Model\LocaleInterface', array(), array(), '', false, false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false, false); - $helper = $this->getMock('Magento\Core\Helper\String', array(), array(), '', false, false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false, false); + $helper = $this->getMock('Magento\Stdlib\String', array(), array(), '', false, false); + + $attributeData = array( 'store_label' => 'Test', diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php index 20b2d1588cd96751528b3db899902674a0e9a4a1..8fd68ba7339763d3b4cb0df20e37f8b3cc4b5f5a 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php @@ -40,7 +40,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $this->_model = $this->getMockForAbstractClass( 'Magento\Eav\Model\Entity\AbstractEntity', array( - $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false), + $this->getMock('Magento\App\Resource', array(), array(), '', false), $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false), $this->getMock('Magento\Eav\Model\Entity\Attribute\Set', array(), array(), '', false), $this->getMock('Magento\Core\Model\LocaleInterface'), @@ -129,7 +129,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase ); $mock->setAttributeId($code); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); /** @var $backendModel \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */ $backendModel = $this->getMock( 'Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', @@ -256,7 +256,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $attribute = $this->_getAttributeMock($attributeCode, $attributeSetId); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); /** @var $backendModel \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */ $backendModel = $this->getMock( 'Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', @@ -302,7 +302,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $attributes[$attributeCode] = $attribute; $data = array( - $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false), + $this->getMock('Magento\App\Resource', array(), array(), '', false), $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false), $this->getMock('Magento\Eav\Model\Entity\Attribute\Set', array(), array(), '', false), $this->getMock('Magento\Core\Model\LocaleInterface'), diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/Backend/ArrayTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/Backend/ArrayTest.php index b19d790353c1d8213f3038843a6a2f3cd917e224..1f223d433f3584b4571d9e053b85f4181e1ecd9a 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/Backend/ArrayTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/Backend/ArrayTest.php @@ -44,7 +44,7 @@ class ArrayTest extends \PHPUnit_Framework_TestCase $this->_attribute = $this->getMock( 'Magento\Eav\Model\Entity\Attribute', array('getAttributeCode'), array(), '', false ); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $this->_model = new \Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend($logger); $this->_model->setAttribute($this->_attribute); } diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php index 6e4db10d4b2ff44ae6bb4550458f97573b1394a1..f700a8cfcf2087ef6af2d3e2664b1c1e076b98e6 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php @@ -214,8 +214,8 @@ class AttributeTest extends \PHPUnit_Framework_TestCase new \Magento\Object(array('id' => 1)), ))); - /** @var $resource \Magento\Core\Model\Resource */ - $resource = $this->getMock('Magento\Core\Model\Resource', + /** @var $resource \Magento\App\Resource */ + $resource = $this->getMock('Magento\App\Resource', array('getTableName', 'getConnection'), array(), '', false, false ); $resource->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php index 2b676151943f5400906d72d106b50b6dff1ee585..73f7f65edd5aeeff1d7e6d7a2715fbb215a6b29f 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php @@ -50,7 +50,10 @@ class DataTest extends \PHPUnit_Framework_TestCase $attrDataFactory = $this->getMock( 'Magento\Eav\Model\AttributeDataFactory', array('create'), - array('objectManager' => $this->getMock('Magento\ObjectManager')) + array( + 'objectManager' => $this->getMock('Magento\ObjectManager'), + 'string' => $this->getMock('Magento\Stdlib\String') + ) ); $validator = new \Magento\Eav\Model\Validator\Attribute\Data($attrDataFactory); @@ -166,7 +169,10 @@ class DataTest extends \PHPUnit_Framework_TestCase $attrDataFactory = $this->getMock( 'Magento\Eav\Model\AttributeDataFactory', array('create'), - array('objectManager' => $this->getMock('Magento\ObjectManager')) + array( + 'objectManager' => $this->getMock('Magento\ObjectManager'), + 'string' => $this->getMock('Magento\Stdlib\String') + ) ); $attrDataFactory->expects($this->once()) ->method('create') @@ -203,7 +209,10 @@ class DataTest extends \PHPUnit_Framework_TestCase $attrDataFactory = $this->getMock( 'Magento\Eav\Model\AttributeDataFactory', array('create'), - array('objectManager' => $this->getMock('Magento\ObjectManager')) + array( + 'objectManager' => $this->getMock('Magento\ObjectManager'), + 'string' => $this->getMock('Magento\Stdlib\String') + ) ); $attrDataFactory->expects($this->once()) ->method('create') @@ -240,7 +249,10 @@ class DataTest extends \PHPUnit_Framework_TestCase $attrDataFactory = $this->getMock( 'Magento\Eav\Model\AttributeDataFactory', array(), - array('objectManager' => $this->getMock('Magento\ObjectManager')) + array( + 'objectManager' => $this->getMock('Magento\ObjectManager'), + 'string' => $this->getMock('Magento\Stdlib\String') + ) ); $validator = new \Magento\Eav\Model\Validator\Attribute\Data($attrDataFactory); $result = $validator->setAttributesWhiteList($attributes); @@ -254,7 +266,10 @@ class DataTest extends \PHPUnit_Framework_TestCase $attrDataFactory = $this->getMock( 'Magento\Eav\Model\AttributeDataFactory', array(), - array('objectManager' => $this->getMock('Magento\ObjectManager')) + array( + 'objectManager' => $this->getMock('Magento\ObjectManager'), + 'string' => $this->getMock('Magento\Stdlib\String') + ) ); $validator = new \Magento\Eav\Model\Validator\Attribute\Data($attrDataFactory); $result = $validator->setAttributesBlackList($attributes); @@ -290,8 +305,11 @@ class DataTest extends \PHPUnit_Framework_TestCase $factory = $this->getMock( 'Magento\Eav\Model\AttributeDataFactory', array('create'), - array('objectManager' => $this->getMock('Magento\ObjectManager')) - );; + array( + 'objectManager' => $this->getMock('Magento\ObjectManager'), + 'string' => $this->getMock('Magento\Stdlib\String') + ) + ); $validator = new \Magento\Eav\Model\Validator\Attribute\Data($factory); $validator->setAttributes(array($firstAttribute, $secondAttribute)) ->setData($data); diff --git a/dev/tests/unit/testsuite/Magento/Crypt/_files/_cipher_info.php b/dev/tests/unit/testsuite/Magento/Encryption/Crypt/_files/_cipher_info.php old mode 100755 new mode 100644 similarity index 100% rename from dev/tests/unit/testsuite/Magento/Crypt/_files/_cipher_info.php rename to dev/tests/unit/testsuite/Magento/Encryption/Crypt/_files/_cipher_info.php diff --git a/dev/tests/unit/testsuite/Magento/Crypt/_files/_crypt_fixtures.php b/dev/tests/unit/testsuite/Magento/Encryption/Crypt/_files/_crypt_fixtures.php old mode 100755 new mode 100644 similarity index 100% rename from dev/tests/unit/testsuite/Magento/Crypt/_files/_crypt_fixtures.php rename to dev/tests/unit/testsuite/Magento/Encryption/Crypt/_files/_crypt_fixtures.php diff --git a/dev/tests/unit/testsuite/Magento/CryptTest.php b/dev/tests/unit/testsuite/Magento/Encryption/CryptTest.php old mode 100755 new mode 100644 similarity index 88% rename from dev/tests/unit/testsuite/Magento/CryptTest.php rename to dev/tests/unit/testsuite/Magento/Encryption/CryptTest.php index 9b9f503e16afbbaeb2b31f4adc0f319725d9e922..4959ea572985b7d86b1f39a290a122335e4f20b0 --- a/dev/tests/unit/testsuite/Magento/CryptTest.php +++ b/dev/tests/unit/testsuite/Magento/Encryption/CryptTest.php @@ -19,16 +19,16 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Crypt + * @package Magento_Encryption * @subpackage unit_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Test case for \Magento\Crypt + * Test case for \Magento\Encryption\Crypt */ -namespace Magento; +namespace Magento\Encryption; class CryptTest extends \PHPUnit_Framework_TestCase { @@ -115,7 +115,7 @@ class CryptTest extends \PHPUnit_Framework_TestCase /* Generate random init vector */ $initVector = $this->_getRandomString($this->_getInitVectorSize($cipher, $mode)); - $crypt = new \Magento\Crypt($this->_key, $cipher, $mode, $initVector); + $crypt = new \Magento\Encryption\Crypt($this->_key, $cipher, $mode, $initVector); $this->assertEquals($cipher, $crypt->getCipher()); $this->assertEquals($mode, $crypt->getMode()); @@ -144,13 +144,13 @@ class CryptTest extends \PHPUnit_Framework_TestCase */ public function testConstructorException($key, $cipher, $mode, $initVector) { - new \Magento\Crypt($key, $cipher, $mode, $initVector); + new \Magento\Encryption\Crypt($key, $cipher, $mode, $initVector); } public function testConstructorDefaults() { - $cryptExpected = new \Magento\Crypt($this->_key, MCRYPT_BLOWFISH, MCRYPT_MODE_ECB, false); - $cryptActual = new \Magento\Crypt($this->_key); + $cryptExpected = new \Magento\Encryption\Crypt($this->_key, MCRYPT_BLOWFISH, MCRYPT_MODE_ECB, false); + $cryptActual = new \Magento\Encryption\Crypt($this->_key); $this->assertEquals($cryptExpected->getCipher(), $cryptActual->getCipher()); $this->assertEquals($cryptExpected->getMode(), $cryptActual->getMode()); @@ -167,7 +167,7 @@ class CryptTest extends \PHPUnit_Framework_TestCase foreach ($this->_supportedModes as $mode) { $randomKey = $this->_getRandomString($this->_getKeySize($cipher, $mode)); $randomInitVector = $this->_getRandomString($this->_getInitVectorSize($cipher, $mode)); - $crypt = new \Magento\Crypt($randomKey, $cipher, $mode, $randomInitVector); + $crypt = new \Magento\Encryption\Crypt($randomKey, $cipher, $mode, $randomInitVector); $fixtures[] = array( $randomKey, // Encryption key $cipher, @@ -195,7 +195,7 @@ class CryptTest extends \PHPUnit_Framework_TestCase */ public function testEncrypt($key, $cipher, $mode, $initVector, $inputData, $expectedData) { - $crypt = new \Magento\Crypt($key, $cipher, $mode, $initVector); + $crypt = new \Magento\Encryption\Crypt($key, $cipher, $mode, $initVector); $actualData = $crypt->encrypt($inputData); $this->assertEquals($expectedData, $actualData); } @@ -205,7 +205,7 @@ class CryptTest extends \PHPUnit_Framework_TestCase */ public function testDecrypt($key, $cipher, $mode, $initVector, $expectedData, $inputData) { - $crypt = new \Magento\Crypt($key, $cipher, $mode, $initVector); + $crypt = new \Magento\Encryption\Crypt($key, $cipher, $mode, $initVector); $actualData = $crypt->decrypt($inputData); $this->assertEquals($expectedData, $actualData); } @@ -215,10 +215,10 @@ class CryptTest extends \PHPUnit_Framework_TestCase */ public function testInitVectorRandom($cipher, $mode) { - $crypt1 = new \Magento\Crypt($this->_key, $cipher, $mode, true); + $crypt1 = new \Magento\Encryption\Crypt($this->_key, $cipher, $mode, true); $initVector1 = $crypt1->getInitVector(); - $crypt2 = new \Magento\Crypt($this->_key, $cipher, $mode, true); + $crypt2 = new \Magento\Encryption\Crypt($this->_key, $cipher, $mode, true); $initVector2 = $crypt2->getInitVector(); $expectedSize = $this->_getInitVectorSize($cipher, $mode); @@ -232,7 +232,7 @@ class CryptTest extends \PHPUnit_Framework_TestCase */ public function testInitVectorNone($cipher, $mode) { - $crypt = new \Magento\Crypt($this->_key, $cipher, $mode, false); + $crypt = new \Magento\Encryption\Crypt($this->_key, $cipher, $mode, false); $actualInitVector = $crypt->getInitVector(); $expectedInitVector = str_repeat("\0", $this->_getInitVectorSize($cipher, $mode)); diff --git a/dev/tests/unit/testsuite/Magento/Encryption/EncryptorTest.php b/dev/tests/unit/testsuite/Magento/Encryption/EncryptorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..715062101b95333c54d67cf5ecf34538b572233e --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Encryption/EncryptorTest.php @@ -0,0 +1,238 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Encryption; + +class EncryptorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var @var \Magento\Encryption\Encryptor + */ + protected $_model; + + public function testGetHash() + { + $hash = $this->_getEncryptor()->getHash('password', 'some_salt_string'); + + $this->assertEquals('a42f82cf25f63f40ff85f8c9b3ff0cb4:some_salt_string', $hash); + } + + /** + * @param string $password + * @param string $hash + * @param bool $expected + * + * @dataProvider validateHashDataProvider + */ + public function testValidateHash($password, $hash, $expected) + { + $actual = $this->_getEncryptor()->validateHash($password, $hash); + + $this->assertEquals($expected, $actual); + } + + public function validateHashDataProvider() + { + return array( + array('password', 'hash', false), + array('password', 'hash:salt', false), + array('password', md5('password'), true), + array('password', md5('saltpassword') . ':' . 'salt', true), + ); + } + + /** + * @param string $password + * @param string $hash + * + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Invalid hash. + * @dataProvider validateHashExceptionDataProvider + */ + public function testValidateHashException($password, $hash) + { + $this->_getEncryptor()->validateHash($password, $hash); + } + + public function validateHashExceptionDataProvider() + { + return array( + array('password', 'hash1:hash2:hash3'), + array('password', 'hash1:hash2:hash3:hash4'), + ); + } + + /** + * @param mixed $key + * + * @dataProvider encryptWithEmptyKeyDataProvider + */ + public function testEncryptWithEmptyKey($key) + { + $encryptor = new \Magento\Encryption\Encryptor( + $this->getMock('\Magento\Math\Random', array(), array(), '', false), + $this->getMock('Magento\Encryption\CryptFactory', array(), array(), '', false), + $key + ); + + $value = 'arbitrary_string'; + + $this->assertEquals($value, $encryptor->encrypt($value)); + } + + public function encryptWithEmptyKeyDataProvider() + { + return array( + array(null), + array(0), + array(''), + array('0'), + ); + } + + /** + * @param string $value + * @param string $expected + * + * @dataProvider encryptDataProvider + */ + public function testEncrypt($value, $expected) + { + $crypt = $this->getMock('Magento\Encryption\Crypt', array(), array(), '', false); + $cryptFactory = $this->getMock('Magento\Encryption\CryptFactory', array(), array(), '', false); + $encryptor = new \Magento\Encryption\Encryptor( + $this->getMock('\Magento\Math\Random', array(), array(), '', false), + $cryptFactory, + 'cryptKey' + ); + + $cryptFactory->expects($this->any()) + ->method('create') + ->will($this->returnValue($crypt)); + $crypt->expects($this->any()) + ->method('encrypt') + ->with($value) + ->will($this->returnArgument(0)); + + $actual = $encryptor->encrypt($value); + + $this->assertEquals($expected, $actual); + } + + public function encryptDataProvider() + { + return array( + array('value1', base64_encode('value1')), + array(true, base64_encode('1')), + ); + } + + /** + * @param string $value + * @param string $expected + * + * @dataProvider decryptDataProvider + */ + public function testDecrypt($value, $expected) + { + $crypt = $this->getMock('Magento\Encryption\Crypt', array(), array(), '', false); + $cryptFactory = $this->getMock('Magento\Encryption\CryptFactory', array(), array(), '', false); + $encryptor = new \Magento\Encryption\Encryptor( + $this->getMock('\Magento\Math\Random', array(), array(), '', false), + $cryptFactory, + 'cryptKey' + ); + + $cryptFactory->expects($this->any()) + ->method('create') + ->will($this->returnValue($crypt)); + $crypt->expects($this->any()) + ->method('decrypt') + ->with($expected) + ->will($this->returnValue($expected)); + + $actual = $encryptor->decrypt($value); + + $this->assertEquals($expected, $actual); + } + + public function decryptDataProvider() + { + return array( + array(base64_encode('value1'), 'value1'), + ); + } + + public function testValidateKey() + { + $key = 'some_key'; + + $crypt = $this->getMock('Magento\Encryption\Crypt', array(), array(), '', false); + $cryptFactory = $this->getMock('Magento\Encryption\CryptFactory', array(), array(), '', false); + $encryptor = new \Magento\Encryption\Encryptor( + $this->getMock('\Magento\Math\Random', array(), array(), '', false), + $cryptFactory, + 'cryptKey' + ); + + $cryptFactory->expects($this->any()) + ->method('create') + ->with(array('key' => $key)) + ->will($this->returnValue($crypt)); + + $encryptor->validateKey($key); + } + + public function testValidateKeyDefault() + { + $key = null; + + $crypt = $this->getMock('Magento\Encryption\Crypt', array(), array(), '', false); + $cryptFactory = $this->getMock('Magento\Encryption\CryptFactory', array(), array(), '', false); + $encryptor = new \Magento\Encryption\Encryptor( + $this->getMock('\Magento\Math\Random', array(), array(), '', false), + $cryptFactory, + 'cryptKey' + ); + + $cryptFactory->expects($this->any()) + ->method('create') + ->with(array('key' => 'cryptKey')) + ->will($this->returnValue($crypt)); + + $encryptor->validateKey($key); + } + + /** + * @return \Magento\Encryption\Encryptor + */ + protected function _getEncryptor() + { + return new \Magento\Encryption\Encryptor( + $this->getMock('\Magento\Math\Random', array(), array(), '', false), + $this->getMock('Magento\Encryption\CryptFactory', array(), array(), '', false), + 'cryptKey' + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/EscaperTest.php b/dev/tests/unit/testsuite/Magento/EscaperTest.php new file mode 100644 index 0000000000000000000000000000000000000000..95cdb821297444fe9c2174499749b5d75bcf1f2b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/EscaperTest.php @@ -0,0 +1,106 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento; +/** + * \Magento\Escaper test case + */ +class EscaperTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Escaper + */ + protected $_escaper = null; + + protected function setUp() + { + $this->_escaper = new Escaper(); + } + + /** + * @covers \Magento\Escaper::escapeHtml + * @dataProvider escapeHtmlDataProvider + */ + public function testEscapeHtml($data, $expected) + { + $actual = $this->_escaper->escapeHtml($data); + $this->assertEquals($expected, $actual); + } + + /** + * @return array + */ + public function escapeHtmlDataProvider() + { + return array( + 'array data' => array( + 'data' => array('one', '<two>three</two>'), + 'expected' => array('one', '<two>three</two>') + ), + 'string data conversion' => array( + 'data' => '<two>three</two>', + 'expected' => '<two>three</two>' + ), + 'string data no conversion' => array( + 'data' => 'one', + 'expected' => 'one' + ) + ); + } + + /** + * @covers \Magento\Escaper::escapeUrl + */ + public function testEscapeUrl() + { + $data = '<two>"three</two>'; + $expected = '<two>"three</two>'; + $this->assertEquals($expected, $this->_escaper->escapeUrl($data)); + } + + /** + * @covers \Magento\Escaper::escapeJsQuote + */ + public function testEscapeJsQuote() + { + $data = array("Don't do that.", 'lost_key' => "Can't do that."); + $expected = array("Don\\'t do that.", "Can\\'t do that."); + $this->assertEquals($expected, $this->_escaper->escapeJsQuote($data)); + $this->assertEquals($expected[0], $this->_escaper->escapeJsQuote($data[0])); + } + + /** + * @covers \Magento\Escaper::escapeQuote + */ + public function testEscapeQuote() + { + $data = "Text with 'single' and \"double\" quotes"; + $expected = array( + "Text with 'single' and "double" quotes", + "Text with \\'single\\' and \\"double\\" quotes", + ); + $this->assertEquals($expected[0], $this->_escaper->escapeQuote($data)); + $this->assertEquals($expected[1], $this->_escaper->escapeQuote($data, true)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Event/Invoker/InvokerDefaultTest.php b/dev/tests/unit/testsuite/Magento/Event/Invoker/InvokerDefaultTest.php index f93497fdfb93216f9728879d4fc98e7f61c44f4a..c76d6443f56eb98cbaec113ccabb4fbd9528de5f 100644 --- a/dev/tests/unit/testsuite/Magento/Event/Invoker/InvokerDefaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Event/Invoker/InvokerDefaultTest.php @@ -103,7 +103,7 @@ class InvokerDefaultTest extends \PHPUnit_Framework_TestCase /** * @param string $shared * @dataProvider dataProviderForMethodIsNotDefined - * @expectedException \Magento\Core\Exception + * @expectedException \LogicException */ public function testMethodIsNotDefinedExceptionWithEnabledDeveloperMode($shared) { diff --git a/dev/tests/unit/testsuite/Magento/Event/ManagerTest.php b/dev/tests/unit/testsuite/Magento/Event/ManagerTest.php index 8186551d6302d90947b358de285c8e4f2f351941..c3734b6b32a546008ff78b77cf8ca070e2082bc3 100644 --- a/dev/tests/unit/testsuite/Magento/Event/ManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/Event/ManagerTest.php @@ -63,36 +63,15 @@ class ManagerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_invoker = $this->getMock('Magento\Event\InvokerInterface'); - $this->_eventFactory = $this->getMock('Magento\EventFactory', array('create'), array(), '', false); - $this->_event = $this->getMock('Magento\Event', array(), array(), '', false); - $this->_wrapperFactory = $this->getMock('Magento\Event\WrapperFactory', array(), array(), '', - false); - $this->_observer = $this->getMock('Magento\Event\Observer', array(), array(), '', false); $this->_eventConfigMock = $this->getMock('Magento\Event\ConfigInterface'); $this->_eventManager = new \Magento\Event\Manager( - $this->_invoker, $this->_eventConfigMock, $this->_eventFactory, $this->_wrapperFactory + $this->_invoker, $this->_eventConfigMock ); } public function testDispatch() { - $data = array('123'); - - $this->_event->expects($this->once())->method('setName')->with('some_event')->will($this->returnSelf()); - $this->_eventFactory->expects($this->once())->method('create')->with(array('data' => $data)) - ->will($this->returnValue($this->_event)); - - $this->_observer->expects($this->once())->method('setData') - ->with(array_merge(array('event' => $this->_event), $data))->will($this->returnSelf()); - $this->_wrapperFactory->expects($this->once())->method('create') - ->will($this->returnValue($this->_observer)); - $this->_invoker->expects($this->once())->method('dispatch')->with(array( - 'instance' => 'class', - 'method' => 'method', - 'name' => 'observer' - ), $this->_observer); - $this->_eventConfigMock->expects($this->once()) ->method('getObservers') ->with('some_event') diff --git a/dev/tests/unit/testsuite/Magento/FilesystemTest.php b/dev/tests/unit/testsuite/Magento/FilesystemTest.php index 40da58a1daf096c0d0d3b103b42af205c9e5abae..5814e4b4ddff923f673d97e0446cc1ef4b4cd64b 100644 --- a/dev/tests/unit/testsuite/Magento/FilesystemTest.php +++ b/dev/tests/unit/testsuite/Magento/FilesystemTest.php @@ -934,6 +934,9 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $this->assertEquals($searchResult, $filesystem->searchKeys($baseDirectory, $pattern)); } + /** + * @return array + */ public function testSearchFilesDataProvider() { return array( @@ -966,6 +969,9 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $filesystem->searchKeys($baseDirectory, $pattern); } + /** + * @return array + */ public function searchFilesIsolationDataProvider() { return array( @@ -983,4 +989,39 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase ), ); } + + public function testCheckLfiProtection() + { + $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface')->getMock(); + $filesystem = new \Magento\Filesystem($adapterMock); + $this->assertTrue($filesystem->checkLfiProtection('/some/path/to/a/file.txt')); + $this->assertTrue($filesystem->checkLfiProtection('/some/path/to/a/file.with.dot.txt')); + $this->assertTrue($filesystem->checkLfiProtection('/some/path/to/a/dir')); + } + + /** + * @dataProvider checkLfiProtectionDataProvider + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Requested file may not include parent directory traversal ("../", "..\" notation) + */ + public function testCheckLfiProtectionException($path) + { + $adapterMock = $this->getMockBuilder('Magento\Filesystem\AdapterInterface')->getMock(); + $filesystem = new \Magento\Filesystem($adapterMock); + $filesystem->checkLfiProtection($path); + } + + /** + * @return array + */ + public function checkLfiProtectionDataProvider() + { + return array( + array('../asd/'), + array('../../'), + array('asd/../asda'), + array('/asd/../asda'), + array('asd/../../asda'), + ); + } } diff --git a/dev/tests/unit/testsuite/Magento/Filter/AbstractFactoryTest.php b/dev/tests/unit/testsuite/Magento/Filter/AbstractFactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..94a5c0d1706a9d9e0594203de5a121c845ed4e6f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Filter/AbstractFactoryTest.php @@ -0,0 +1,153 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Filter; + +class AbstractFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Filter\AbstractFactory + */ + protected $_factory; + + /** + * @var array + */ + protected $_invokableList = array( + 'sprintf' => 'Magento\Filter\Sprintf', + 'template' => 'Magento\Filter\Template', + 'arrayFilter' => 'Magento\Filter\ArrayFilter', + ); + + /** + * @var array + */ + protected $_sharedList = array( + 'Magento\Filter\Template' => true, + 'Magento\Filter\ArrayFilter' => false, + ); + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + public function setUp() + { + $this->_objectManager = $this->getMockForAbstractClass('\Magento\ObjectManager', array(), '', true, true, + true, array('create')); + + $this->_factory = $this->getMockForAbstractClass('Magento\Filter\AbstractFactory', array( + 'objectManger' => $this->_objectManager + )); + $property = new \ReflectionProperty('Magento\Filter\AbstractFactory', 'invokableClasses'); + $property->setAccessible(true); + $property->setValue($this->_factory, $this->_invokableList); + + $property = new \ReflectionProperty('Magento\Filter\AbstractFactory', 'shared'); + $property->setAccessible(true); + $property->setValue($this->_factory, $this->_sharedList); + } + + /** + * @dataProvider canCreateFilterDataProvider + * @param string $alias + * @param bool $expectedResult + */ + public function testCanCreateFilter($alias, $expectedResult) + { + $this->assertEquals($expectedResult, $this->_factory->canCreateFilter($alias)); + } + + /** + * @return array + */ + public function canCreateFilterDataProvider() + { + return array( + array('arrayFilter', true), + array('notExist', false), + ); + } + + /** + * @dataProvider isSharedDataProvider + * @param string $alias + * @param bool $expectedResult + */ + public function testIsShared($alias, $expectedResult) + { + $this->assertEquals($expectedResult, $this->_factory->isShared($alias)); + } + + /** + * @return array + */ + public function isSharedDataProvider() + { + return array( + 'shared' => array('Magento\Filter\Template', true), + 'not shared' => array('Magento\Filter\ArrayFilter', false), + 'default value' => array('Magento\Filter\Sprintf', true), + ); + } + + /** + * @dataProvider createFilterDataProvider + * @param string $alias + * @param array $arguments + * @param bool $isShared + */ + public function testCreateFilter($alias, $arguments, $isShared) + { + $property = new \ReflectionProperty('Magento\Filter\AbstractFactory', 'sharedInstances'); + $property->setAccessible(true); + + $filterMock = $this->getMock('FactoryInterface', array('filter')); + $this->_objectManager->expects($this->atLeastOnce())->method('create') + ->with($this->equalTo($this->_invokableList[$alias]), $this->equalTo($arguments)) + ->will($this->returnValue($filterMock)); + + $this->assertEquals($filterMock, $this->_factory->createFilter($alias, $arguments)); + if ($isShared) { + $sharedList = $property->getValue($this->_factory); + $this->assertTrue(array_key_exists($alias, $sharedList)); + $this->assertEquals($filterMock, $sharedList[$alias]); + } else { + $this->assertEmpty($property->getValue($this->_factory)); + } + } + + /** + * @return array + */ + public function createFilterDataProvider() + { + return array( + 'not shared with args' => array('arrayFilter', array('123', '231'), false), + 'not shared without args' => array('arrayFilter', array(), true), + 'shared' => array('template', array(), true), + 'default shared' => array('sprintf', array(), true), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Filter/FilterManager/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Filter/FilterManager/ConfigTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3eac8dea6220adcb8926932609b080c268f388a9 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Filter/FilterManager/ConfigTest.php @@ -0,0 +1,47 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Filter\FilterManager; + +class ConfigTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Filter\FilterManager\Config + */ + protected $_config; + + protected function setUp() + { + $this->_config = new \Magento\Filter\FilterManager\Config(array('test' => 'test')); + } + + public function testGetFactories() + { + $expectedConfig = array( + 'test' => 'test', + 'Magento\Filter\Factory', + 'Magento\Filter\ZendFactory', + ); + $this->assertEquals($expectedConfig, $this->_config->getFactories()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Filter/FilterManagerTest.php b/dev/tests/unit/testsuite/Magento/Filter/FilterManagerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..23805ae61df63da9487c198947b03eaf05a2e400 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Filter/FilterManagerTest.php @@ -0,0 +1,153 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Filter; + +class FilterManagerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Filter\FilterManager + */ + protected $_filterManager; + + /** + * @var \Magento\Filter\Factory + */ + protected $_factoryMock; + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\Filter\FilterManager\Config + */ + protected $_config; + + protected function initMocks() + { + $factoryName = 'Magento\Filter\Factory'; + $this->_factoryMock = $this->getMock($factoryName, array('canCreateFilter', 'createFilter'), + array(), '', false); + $this->_objectManager = $this->getMockForAbstractClass('\Magento\ObjectManager', array(), '', true, true, + true, array('create')); + $this->_objectManager->expects($this->atLeastOnce())->method('create') + ->with($this->equalTo($factoryName)) + ->will($this->returnValue($this->_factoryMock)); + $this->_config = $this->getMock('\Magento\Filter\FilterManager\Config', array('getFactories'), + array(), '', false); + $this->_config->expects($this->atLeastOnce())->method('getFactories') + ->will($this->returnValue(array($factoryName))); + $this->_filterManager = new \Magento\Filter\FilterManager($this->_objectManager, $this->_config); + } + + public function testGetFilterFactories() + { + $this->initMocks(); + $method = new \ReflectionMethod('Magento\Filter\FilterManager', 'getFilterFactories'); + $method->setAccessible(true); + $this->assertEquals(array($this->_factoryMock), $method->invoke($this->_filterManager)); + } + + /** + * @expectedException \UnexpectedValueException + * @expectedExceptionMessage Filter factory must implement FilterFactoryInterface interface, stdClass was given. + */ + public function testGetFilterFactoriesWrongInstance() + { + $factoryName = 'Magento\Filter\Factory'; + $this->_factoryMock = new \stdClass(); + $this->_objectManager = $this->getMockForAbstractClass('\Magento\ObjectManager', array(), '', true, true, + true, array('create')); + $this->_objectManager->expects($this->atLeastOnce())->method('create') + ->with($this->equalTo($factoryName)) + ->will($this->returnValue($this->_factoryMock)); + $this->_config = $this->getMock('\Magento\Filter\FilterManager\Config', + array('getFactories'), array(), '', false); + $this->_config->expects($this->atLeastOnce())->method('getFactories') + ->will($this->returnValue(array($factoryName))); + $this->_filterManager = new \Magento\Filter\FilterManager($this->_objectManager, $this->_config); + + $method = new \ReflectionMethod('Magento\Filter\FilterManager', 'getFilterFactories'); + $method->setAccessible(true); + $method->invoke($this->_filterManager); + } + + public function testCreateFilterInstance() + { + $this->initMocks(); + $filterMock = $this->getMock('FactoryInterface'); + $this->configureFactoryMock($filterMock, 'alias', array('123')); + + + $method = new \ReflectionMethod('Magento\Filter\FilterManager', 'createFilterInstance'); + $method->setAccessible(true); + $this->assertEquals($filterMock, $method->invoke($this->_filterManager, 'alias', array('123'))); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Filter was not found by given alias wrongAlias + */ + public function testCreateFilterInstanceWrongAlias() + { + $this->initMocks(); + $filterAlias = 'wrongAlias'; + $this->_factoryMock->expects($this->atLeastOnce())->method('canCreateFilter') + ->with($this->equalTo($filterAlias)) + ->will($this->returnValue(false)); + + $method = new \ReflectionMethod('Magento\Filter\FilterManager', 'createFilterInstance'); + $method->setAccessible(true); + $method->invoke($this->_filterManager, $filterAlias, array()); + } + + /** + * @param object $filter + * @param string $alias + * @param array $arguments + */ + protected function configureFactoryMock($filter, $alias, $arguments = array()) + { + $this->_factoryMock->expects($this->atLeastOnce())->method('canCreateFilter') + ->with($this->equalTo($alias)) + ->will($this->returnValue(true)); + + $this->_factoryMock->expects($this->atLeastOnce())->method('createFilter') + ->with($this->equalTo($alias), $this->equalTo($arguments)) + ->will($this->returnValue($filter)); + } + + public function testCall() + { + $value = 'testValue'; + $this->initMocks(); + $filterMock = $this->getMock('FactoryInterface', array('filter')); + $filterMock->expects($this->atLeastOnce())->method('filter') + ->with($this->equalTo($value)) + ->will($this->returnValue($value)); + $this->configureFactoryMock($filterMock, 'alias', array('123')); + $this->assertEquals($value, $this->_filterManager->alias($value, array('123'))); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Filter/RemoveAccentsTest.php similarity index 73% rename from dev/tests/unit/testsuite/Magento/Core/Helper/DataTest.php rename to dev/tests/unit/testsuite/Magento/Filter/RemoveAccentsTest.php index ec6c8487493745bceeb2b341cd0e18b719cc1df5..9ee50f9a43c1275942430f5ff6488417752f4086 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Filter/RemoveAccentsTest.php @@ -18,30 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @subpackage unit_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Helper; -class DataTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Helper\Data - */ - protected $_helper; - - /** - * @var \Magento\TestFramework\Helper\ObjectManager - */ - protected $_objectManager; - - protected function setUp() - { - $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_helper = $this->_objectManager->getObject('Magento\Core\Helper\Data'); - } +namespace Magento\Filter; +class RemoveAccentsTest extends \PHPUnit_Framework_TestCase +{ /** * @param string $string * @param bool $german @@ -51,7 +35,8 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testRemoveAccents($string, $german, $expected) { - $this->assertEquals($expected, $this->_helper->removeAccents($string, $german)); + $filter = new \Magento\Filter\RemoveAccents($german); + $this->assertEquals($expected, $filter->filter($string)); } /** diff --git a/dev/tests/unit/testsuite/Magento/Core/Helper/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Filter/RemoveTagsTest.php similarity index 78% rename from dev/tests/unit/testsuite/Magento/Core/Helper/AbstractTest.php rename to dev/tests/unit/testsuite/Magento/Filter/RemoveTagsTest.php index f92a7aa58c9094134607751920f14a0fcdd417fc..8da997cafdd0f39d4d8a7aa9e5e1d7275ddb7ae6 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Helper/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Filter/RemoveTagsTest.php @@ -21,16 +21,19 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Helper; +namespace Magento\Filter; -class AbstractTest extends \PHPUnit_Framework_TestCase +class RemoveTagsTest extends \PHPUnit_Framework_TestCase { + /** + * @covers \Magento\Filter\RemoveTags::filter + * @covers \Magento\Filter\RemoveTags::_convertEntities + */ public function testRemoveTags() { $input = '<div>10</div> < <a>11</a> > <span>10</span>'; - /** @var \Magento\Core\Helper\AbstractHelper $helper */ - $helper = $this->getMockForAbstractClass('Magento\Core\Helper\AbstractHelper', array(), '', false); - $actual = $helper->removeTags($input); + $removeTags = new \Magento\Filter\RemoveTags(); + $actual = $removeTags->filter($input); $expected = '10 < 11 > 10'; $this->assertSame($expected, $actual); } diff --git a/dev/tests/unit/testsuite/Magento/Filter/SplitWordsTest.php b/dev/tests/unit/testsuite/Magento/Filter/SplitWordsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0ed108d6c1536c5eb36527fd65467f41d4384cb4 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Filter/SplitWordsTest.php @@ -0,0 +1,40 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +class SplitWordsTest extends \PHPUnit_Framework_TestCase +{ + /** + * Bug: $maxWordLength parameter has a misleading name. It limits qty of words in the result. + */ + public function testSplitWords() + { + $words = '123 123 45 789'; + $filter = new \Magento\Filter\SplitWords(false, 3); + $this->assertEquals(array('123', '123', '45'), $filter->filter($words)); + $filter = new \Magento\Filter\SplitWords(true, 2); + $this->assertEquals(array('123', '45'), $filter->filter($words)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Filter/StripTagsTest.php b/dev/tests/unit/testsuite/Magento/Filter/StripTagsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..30f259b39d0ad307014c157bd9257757e435efe7 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Filter/StripTagsTest.php @@ -0,0 +1,37 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Filter; + +class StripTagsTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers \Magento\Filter\StripTags::_construct + * @covers \Magento\Filter\StripTags::filter + */ + public function testStripTags() + { + $stripTags = new \Magento\Filter\StripTags(new \Magento\Escaper()); + $this->assertEquals('three', $stripTags->filter('<two>three</two>')); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Filter/TruncateTest.php b/dev/tests/unit/testsuite/Magento/Filter/TruncateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..6ccc19c0e41d86e5054d3356f9388fd0a9e7212a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Filter/TruncateTest.php @@ -0,0 +1,66 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +class TruncateTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param string $string + * @param array $args + * @param string $expected + * @param string $expectedReminder + * @dataProvider truncateDataProvider + */ + public function testTruncate($string, $args, $expected, $expectedReminder) + { + list($strLib, $length, $etc, $reminder, $breakWords) = $args; + $filter = new \Magento\Filter\Truncate($strLib, $length, $etc, $reminder, $breakWords); + $this->assertEquals($expected, $filter->filter($string)); + + $this->assertEquals($expectedReminder, $reminder); + } + + /** + * @return array + */ + public function truncateDataProvider() + { + $remainder = ''; + return array( + '1' => array( + '1234567890', + array(new \Magento\Stdlib\String, 5, '...', '', true), + '12...', + '34567890' + ), + '2' => array( + '123 456 789', + array(new \Magento\Stdlib\String, 8, '..', $remainder, false), + '123..', + ' 456 789' + ) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php b/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php index 73cd794187e3cdc22fbb60c83cf868f27499057c..ae6f59a4f7718f3d291cb5742ec5a11442874a46 100644 --- a/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/Validator/FactoryTest.php @@ -1,7 +1,4 @@ <?php - -namespace Magento\GoogleAdwords\Model\Validator; - /** * Magento * @@ -25,6 +22,12 @@ namespace Magento\GoogleAdwords\Model\Validator; * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @SuppressWarnings(PHPMD.LongVariable) */ +namespace Magento\GoogleAdwords\Model\Validator; + +use Magento\TestFramework\Helper\ObjectManager; +use Magento\Validator\Int; +use Magento\Validator\Regex; + class FactoryTest extends \PHPUnit_Framework_TestCase { /** @@ -64,7 +67,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase $this->_vbMock = $this->getMock('Magento\Validator\Builder', array(), array(), '', false); $this->_validatorMock = $this->getMock('Magento\Validator\ValidatorInterface', array(), array(), '', false); - $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $objectManager = new ObjectManager($this); $this->_factory = $objectManager->getObject('Magento\GoogleAdwords\Model\Validator\Factory', array( 'validatorBuilderFactory' => $this->_vbFactoryMock, )); @@ -77,21 +80,23 @@ class FactoryTest extends \PHPUnit_Framework_TestCase $currentColor); $this->_vbFactoryMock->expects($this->once())->method('create') - ->with(array( + ->with('Magento\Validator\Builder', array( 'constraints' => array( array( 'alias' => 'Regex', 'type' => '', 'class' => 'Magento\Validator\Regex', 'options' => array( - 'arguments' => array('/^[0-9a-f]{6}$/i'), + 'arguments' => array( + 'pattern' => '/^[0-9a-f]{6}$/i' + ), 'methods' => array( array( 'method' => 'setMessages', 'arguments' => array( array( - \Magento\Validator\Regex::NOT_MATCH => $message, - \Magento\Validator\Regex::INVALID => $message, + Regex::NOT_MATCH => $message, + Regex::INVALID => $message, ), ), ), @@ -114,7 +119,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase $message = sprintf('Conversion Id value is not valid "%s". Conversion Id should be an integer.', $conversionId); $this->_vbFactoryMock->expects($this->once())->method('create') - ->with(array( + ->with('Magento\Validator\Builder', array( 'constraints' => array( array( 'alias' => 'Int', @@ -126,8 +131,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase 'method' => 'setMessages', 'arguments' => array( array( - \Magento\Validator\Int::NOT_INT => $message, - \Magento\Validator\Int::INVALID => $message, + Int::NOT_INT => $message, + Int::INVALID => $message, ), ), ), diff --git a/dev/tests/unit/testsuite/Magento/GoogleShopping/Block/SiteVerificationTest.php b/dev/tests/unit/testsuite/Magento/GoogleShopping/Block/SiteVerificationTest.php index c6a51c5738f09ed972d28406be5922065e18d52c..2184796f17628f32eb9ca08630bf32faca661015 100644 --- a/dev/tests/unit/testsuite/Magento/GoogleShopping/Block/SiteVerificationTest.php +++ b/dev/tests/unit/testsuite/Magento/GoogleShopping/Block/SiteVerificationTest.php @@ -34,24 +34,25 @@ class SiteVerificationTest extends \PHPUnit_Framework_TestCase protected function setUp() { $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $layout = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); - $coreHelper = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $coreHelper->expects($this->any()) - ->method('escapeHtml')->with('Valor & Honor')->will($this->returnValue('Valor & Honor')); - $helperFactory = $this->getMockBuilder('Magento\Core\Model\Factory\Helper') + + $escaper = $this->getMockBuilder('Magento\Escaper') ->disableOriginalConstructor() - ->setMethods(array('get')) + ->setMethods(array('escapeHtml')) ->getMock(); - $helperFactory->expects($this->any())->method('get')->will($this->returnValue($coreHelper)); - $layout->expects($this->any()) - ->method('helper')->with('Magento\Core\Helper\Data')->will($this->returnValue($coreHelper)); + $escaper->expects($this->any()) + ->method('escapeHtml') + ->with('Valor & Honor')->will($this->returnValue('Valor & Honor')); + $context = $objectHelper->getObject('Magento\Core\Block\Context', array( - 'eventManager' => $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), - 'layout' => $layout, - 'helperFactory' => $helperFactory + 'escaper' => $escaper )); + $this->_config = $this->getMock('Magento\GoogleShopping\Model\Config', array(), array(), '', false); - $this->_block = new \Magento\GoogleShopping\Block\SiteVerification($context, $this->_config); + + $this->_block = $objectHelper->getObject('Magento\GoogleShopping\Block\SiteVerification', array( + 'context' => $context, + 'config' => $this->_config + )); } public function testToHtmlWithContent() diff --git a/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/AttributeFactoryTest.php b/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/AttributeFactoryTest.php index 038afcc93faad3d708b4e1e4632c76d4da6d9831..1b67f09dfd25b684397fcf9b7954721b0f74da51 100644 --- a/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/AttributeFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/AttributeFactoryTest.php @@ -60,7 +60,7 @@ class AttributeFactoryTest extends \PHPUnit_Framework_TestCase { return $this->getMockBuilder('Magento\GoogleShopping\Model\Attribute\DefaultAttribute') ->disableOriginalConstructor() - ->setMethods(null) + ->setMethods(array('__wakeup')) ->getMock(); } @@ -76,7 +76,11 @@ class AttributeFactoryTest extends \PHPUnit_Framework_TestCase ->method('create') ->with($this->equalTo('Magento\GoogleShopping\Model\Attribute\\' . $expected)) ->will($this->returnValue($this->_createDefaultAttribute())); - $attributeFactory = new \Magento\GoogleShopping\Model\AttributeFactory($objectManager, $this->_createGsData()); + $attributeFactory = new \Magento\GoogleShopping\Model\AttributeFactory( + $objectManager, + $this->_createGsData(), + new \Magento\Stdlib\String + ); $attribute = $attributeFactory->createAttribute($name); $this->assertEquals($name, $attribute->getName()); } @@ -105,7 +109,11 @@ class AttributeFactoryTest extends \PHPUnit_Framework_TestCase ->method('create') ->with($this->equalTo('Magento\GoogleShopping\Model\Attribute\DefaultAttribute')) ->will($this->returnValue($this->_createDefaultAttribute())); - $attributeFactory = new \Magento\GoogleShopping\Model\AttributeFactory($objectManager, $this->_createGsData()); + $attributeFactory = new \Magento\GoogleShopping\Model\AttributeFactory( + $objectManager, + $this->_createGsData(), + new \Magento\Stdlib\String + ); $attribute = $attributeFactory->createAttribute('name'); $this->assertEquals('name', $attribute->getName()); } @@ -122,7 +130,11 @@ class AttributeFactoryTest extends \PHPUnit_Framework_TestCase ->method('create') ->with('Magento\GoogleShopping\Model\Attribute') ->will($this->returnValue('some value')); - $attributeFactory = new \Magento\GoogleShopping\Model\AttributeFactory($objectManager, $this->_createGsData()); + $attributeFactory = new \Magento\GoogleShopping\Model\AttributeFactory( + $objectManager, + $this->_createGsData(), + new \Magento\Stdlib\String + ); $attribute = $attributeFactory->create(); $this->assertEquals('some value', $attribute); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Helper/HttpTest.php b/dev/tests/unit/testsuite/Magento/Http/AuthenticationTest.php similarity index 77% rename from dev/tests/unit/testsuite/Magento/Core/Helper/HttpTest.php rename to dev/tests/unit/testsuite/Magento/Http/AuthenticationTest.php index 282b4ee9bbd1d091ea227d57704c34b82f57af3a..64c419d9895df12191308c1ff64f82c4b1a68256 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Helper/HttpTest.php +++ b/dev/tests/unit/testsuite/Magento/Http/AuthenticationTest.php @@ -25,41 +25,29 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Helper; +namespace Magento\Http; -class HttpTest extends \PHPUnit_Framework_TestCase +class AuthenticationTest extends \PHPUnit_Framework_TestCase { - /** - * @var \Magento\Core\Helper\Http - */ - protected $_object = null; - - protected function setUp() - { - $this->_object = new \Magento\Core\Helper\Http( - $this->getMock('Magento\Core\Helper\String', array(), array(), '', false, false), - $this->getMock('Magento\Core\Helper\Context', array(), array(), '', false, false), - $this->getMock('Magento\Core\Model\Config', array(), array(), '', false, false) - ); - } - /** * @param array $server * @param string $expectedLogin * @param string $expectedPass - * @dataProvider getHttpAuthCredentialsDataProvider + * @dataProvider getCredentialsDataProvider */ - public function testGetHttpAuthCredentials($server, $expectedLogin, $expectedPass) + public function testGetCredentials($server, $expectedLogin, $expectedPass) { $request = $this->getMock('\Magento\App\Request\Http', array(), array(), '', false); $request->expects($this->once())->method('getServer')->will($this->returnValue($server)); - $this->assertSame(array($expectedLogin, $expectedPass), $this->_object->getHttpAuthCredentials($request)); + $response = $this->getMock('\Magento\App\Response\Http', array(), array(), '', false); + $authentication = new \Magento\HTTP\Authentication($request, $response); + $this->assertSame(array($expectedLogin, $expectedPass), $authentication->getCredentials()); } /** * @return array */ - public function getHttpAuthCredentialsDataProvider() + public function getCredentialsDataProvider() { $login = 'login'; $password = 'password'; @@ -93,12 +81,14 @@ class HttpTest extends \PHPUnit_Framework_TestCase ); } - public function testFailHttpAuthentication() + public function testSetAuthenticationFailed() { + $request = $this->getMock('\Magento\App\Request\Http', array(), array(), '', false);; $response = new \Magento\App\Response\Http(); + $authentication = new \Magento\HTTP\Authentication($request, $response); $realm = uniqid(); $response->headersSentThrowsException = false; - $this->_object->failHttpAuthentication($response, $realm); + $authentication->setAuthenticationFailed($realm); $headers = $response->getHeaders(); $this->assertArrayHasKey(0, $headers); $this->assertEquals('401 Unauthorized', $headers[0]['value']); diff --git a/dev/tests/unit/testsuite/Magento/Http/HeaderTest.php b/dev/tests/unit/testsuite/Magento/Http/HeaderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ac272bb4ec2f0ee36c98b6adc24d98c9ad9cc3e4 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Http/HeaderTest.php @@ -0,0 +1,207 @@ +<?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_Connect + * @subpackage unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Http; + +class HeaderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\App\Request\Http + */ + protected $_request; + + /** + * @var \Magento\Stdlib\String + */ + protected $_converter; + + protected function setUp() + { + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->_request = $this->getMock( + 'Magento\App\Request\Http', + array('getServer', 'getRequestUri'), + array(), + '', + false + ); + + $this->_converter = $this->getMock('\Magento\Stdlib\String', array('cleanString')); + } + + /** + * @param string $method + * @param boolean $clean + * @param string $expectedValue + * + * @dataProvider methodsDataProvider + * + * @covers \Magento\HTTP\Header::getHttpHost + * @covers \Magento\HTTP\Header::getHttpUserAgent + * @covers \Magento\HTTP\Header::getHttpAcceptLanguage + * @covers \Magento\HTTP\Header::getHttpAcceptCharset + * @covers \Magento\HTTP\Header::getHttpReferer + */ + public function testHttpMethods($method, $clean, $expectedValue) + { + $this->_request->expects($this->once()) + ->method('getServer') + ->will($this->returnValue('value')); + + $this->_prepareCleanString($clean); + + $headerObject = $this->_objectManager->getObject( + '\Magento\HTTP\Header', + array('httpRequest' => $this->_request, 'converter' => $this->_converter) + ); + + $method = new \ReflectionMethod('\Magento\HTTP\Header', $method); + $result = $method->invokeArgs($headerObject, array('clean' => $clean)); + + $this->assertEquals($expectedValue, $result); + } + + /** + * @return array + */ + public function methodsDataProvider() + { + return array( + 'getHttpHost clean true' => array( + 'method' => 'getHttpHost', + 'clean' => true, + 'expectedValue' => 'converted value' + ), + 'getHttpHost clean false' => array( + 'method' => 'getHttpHost', + 'clean' => false, + 'expectedValue' => 'value' + ), + 'getHttpUserAgent clean true' => array( + 'method' => 'getHttpUserAgent', + 'clean' => true, + 'expectedValue' => 'converted value' + ), + 'getHttpUserAgent clean false' => array( + 'method' => 'getHttpUserAgent', + 'clean' => false, + 'expectedValue' => 'value' + ), + 'getHttpAcceptLanguage clean true' => array( + 'method' => 'getHttpAcceptLanguage', + 'clean' => true, + 'expectedValue' => 'converted value' + ), + 'getHttpAcceptLanguage clean false' => array( + 'method' => 'getHttpAcceptLanguage', + 'clean' => false, + 'expectedValue' => 'value' + ), + 'getHttpAcceptCharset clean true' => array( + 'method' => 'getHttpAcceptCharset', + 'clean' => true, + 'expectedValue' => 'converted value' + ), + 'getHttpAcceptCharset clean false' => array( + 'method' => 'getHttpAcceptCharset', + 'clean' => false, + 'expectedValue' => 'value' + ), + 'getHttpReferer clean true' => array( + 'method' => 'getHttpReferer', + 'clean' => true, + 'expectedValue' => 'converted value' + ), + 'getHttpReferer clean false' => array( + 'method' => 'getHttpReferer', + 'clean' => false, + 'expectedValue' => 'value' + ), + ); + } + + /** + * @param boolean $clean + * @param string $expectedValue + * + * @dataProvider getRequestUriDataProvider + */ + public function testGetRequestUri($clean, $expectedValue) + { + $this->_request->expects($this->once()) + ->method('getRequestUri') + ->will($this->returnValue('value')); + + $this->_prepareCleanString($clean); + + $headerObject = $this->_objectManager->getObject( + '\Magento\HTTP\Header', + array('httpRequest' => $this->_request, 'converter' => $this->_converter) + ); + + $result = $headerObject->getRequestUri($clean); + + $this->assertEquals($expectedValue, $result); + } + + /** + * @return array + */ + public function getRequestUriDataProvider() + { + return array( + 'getRequestUri clean true' => array( + 'clean' => true, + 'expectedValue' => 'converted value' + ), + 'getRequestUri clean false' => array( + 'clean' => false, + 'expectedValue' => 'value' + ), + ); + } + + /** + * @param boolean $clean + * @return $this + */ + protected function _prepareCleanString($clean) + { + $cleanStringExpects = $clean ? $this->once() : $this->never(); + + $this->_converter->expects($cleanStringExpects) + ->method('cleanString') + ->will($this->returnValue('converted value')); + return $this; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Http/PhpEnvironment/RemoteAddressTest.php b/dev/tests/unit/testsuite/Magento/Http/PhpEnvironment/RemoteAddressTest.php new file mode 100644 index 0000000000000000000000000000000000000000..41d25b9c122ff43605ed5dec786820d4bbb28008 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Http/PhpEnvironment/RemoteAddressTest.php @@ -0,0 +1,115 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Core + * @subpackage unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Http\PhpEnvironment; + +class RemoteAddressTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Request\Http + */ + protected $_request; + + /** + * @var TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + + protected function setUp() + { + $this->_request = $this->getMockBuilder('Magento\App\Request\Http') + ->disableOriginalConstructor() + ->setMethods(array('getServer')) + ->getMock(); + + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + } + + /** + * @dataProvider getRemoteAddressProvider + */ + public function testGetRemoteAddress($alternativeHeaders, $serverValueMap, $expected, $ipToLong) + { + $remoteAddress = $this->_objectManager->getObject('Magento\HTTP\PhpEnvironment\RemoteAddress', array( + 'httpRequest' => $this->_request, + 'alternativeHeaders' => $alternativeHeaders + )); + $this->_request->expects($this->any()) + ->method('getServer') + ->will($this->returnValueMap($serverValueMap)); + $this->assertEquals($expected, $remoteAddress->getRemoteAddress($ipToLong)); + } + + /** + * @return array + */ + public function getRemoteAddressProvider() + { + return array( + array( + 'alternativeHeaders' => array(), + 'serverValueMap' => array(array('REMOTE_ADDR', null, null)), + 'expected' => false, + 'ipToLong' => false + ), + array( + 'alternativeHeaders' => array(), + 'serverValueMap' => array(array('REMOTE_ADDR', null, '192.168.0.1')), + 'expected' => '192.168.0.1', + 'ipToLong' => false + ), + array( + 'alternativeHeaders' => array(), + 'serverValueMap' => array(array('REMOTE_ADDR', null, '192.168.1.1')), + 'expected' => ip2long('192.168.1.1'), + 'ipToLong' => true + ), + array( + 'alternativeHeaders' => array('TEST_HEADER'), + 'serverValueMap' => array( + array('REMOTE_ADDR', null, '192.168.1.1'), + array('TEST_HEADER', null, '192.168.0.1'), + array('TEST_HEADER', false, '192.168.0.1') + ), + 'expected' => '192.168.0.1', + 'ipToLong' => false + ), + array( + 'alternativeHeaders' => array('TEST_HEADER'), + 'serverValueMap' => array( + array('REMOTE_ADDR', null, '192.168.1.1'), + array('TEST_HEADER', null, '192.168.0.1'), + array('TEST_HEADER', false, '192.168.0.1') + ), + 'expected' => ip2long('192.168.0.1'), + 'ipToLong' => true + ) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Http/PhpEnvironment/ServerAddressTest.php b/dev/tests/unit/testsuite/Magento/Http/PhpEnvironment/ServerAddressTest.php new file mode 100644 index 0000000000000000000000000000000000000000..16099c9ba980f738ac14eb0ed2596d17e786febd --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Http/PhpEnvironment/ServerAddressTest.php @@ -0,0 +1,78 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Core + * @subpackage unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Http\PhpEnvironment; + +class ServerAddressTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\HTTP\PhpEnvironment\ServerAddress + */ + protected $_serverAddress; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Request\Http + */ + protected $_request; + + protected function setUp() + { + $this->_request = $this->getMockBuilder('Magento\App\Request\Http') + ->disableOriginalConstructor() + ->setMethods(array('getServer')) + ->getMock(); + + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_serverAddress = $objectManager->getObject('Magento\HTTP\PhpEnvironment\ServerAddress', array( + 'httpRequest' => $this->_request + )); + } + + /** + * @dataProvider getServerAddressProvider + */ + public function testGetServerAddress($serverVar, $expected, $ipToLong) + { + $this->_request->expects($this->atLeastOnce()) + ->method('getServer') + ->with('SERVER_ADDR') + ->will($this->returnValue($serverVar)); + $this->assertEquals($expected, $this->_serverAddress->getServerAddress($ipToLong)); + } + + /** + * @return array + */ + public function getServerAddressProvider() + { + return array( + array(null, false, false), + array('192.168.0.1', '192.168.0.1', false), + array('192.168.1.1', ip2long('192.168.1.1'), true) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/SchemaLocatorTest.php index fbf25ae759148f01a7dd347fa46275b5606b6268..0ff470199d8f2d18499a0cf9a282e8c657b45f35 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Config/SchemaLocatorTest.php @@ -38,7 +38,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_moduleReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false + 'Magento\Module\Dir\Reader', array(), array(), '', false ); $this->_moduleReaderMock->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php index e0c97211a15c6faf82e5bd079e4376460a02adca..1aceecc5c2f5752e1cfdad1e40f86be943e4d9a0 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php @@ -75,7 +75,7 @@ class ExportTest extends \PHPUnit_Framework_TestCase ->method('getFileExtension') ->will($this->returnValue($this->_exportFileExtension)); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $dir = $this->getMock('Magento\App\Dir', array(), array(), '', false); $adapterFactory = $this->getMock('Magento\Core\Model\Log\AdapterFactory', array(), array(), '', false); $entityFactory = $this->getMock( diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/SchemaLocatorTest.php index e41d6a7b176ebe87e774c6ee0dadbfb16e0a16bc..782d699d3ec8f5e6260bf8827e4b18095d138922 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Config/SchemaLocatorTest.php @@ -38,7 +38,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_moduleReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false + 'Magento\Module\Dir\Reader', array(), array(), '', false ); $this->_moduleReaderMock->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php index 7316c500948bb57a1cf2b9b586d6865720164357..166aee5eb89b026b7afa93da014fdae1ca3cf9b6 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php @@ -77,7 +77,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase ->with('Magento\Core\Model\Registry') ->will($this->returnValue($coreRegisterMock)); - \Magento\Core\Model\ObjectManager::setInstance($objectManagerMock); + \Magento\App\ObjectManager::setInstance($objectManagerMock); return $helper; } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php index 5ac6b8e72e711d0f177b7acf5326eeb25bd1455a..9f935367a52a7b67b7dc416e4bfdd030bd57f5c9 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php @@ -57,7 +57,7 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Core\Helper\String|\PHPUnit_Framework_MockObject_MockObject */ - protected $_stringHelper; + protected $_string; /** * @var \Magento\ImportExport\Model\ImportFactory @@ -65,7 +65,7 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase protected $_importFactory; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; @@ -123,10 +123,10 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase 'dateModel' => $this->getMock('Magento\Core\Model\Date', array(), array(), '', false) ); $this->_coreHelper = $objectManager->getObject('Magento\Core\Helper\Data', $data); - $this->_stringHelper = $this->getMock('Magento\Core\Helper\String', array('__construct'), array(), '', false); + $this->_string = new \Magento\Stdlib\String; $this->_importFactory = $this->getMock('Magento\ImportExport\Model\ImportFactory', array(), array(), '', false); - $this->_resource = $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false); + $this->_resource = $this->getMock('Magento\App\Resource', array(), array(), '', false); $this->_resourceHelper = $this->getMock( 'Magento\ImportExport\Model\Resource\Helper', array(), array(), '', false ); @@ -149,12 +149,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data = $this->_getModelDependencies(); $data['customer_entity'] = $this->_getCustomerEntityMock(); $data['address_entity'] = $this->_getAddressEntityMock(); - + $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, - $this->_stringHelper, + $this->_string, $coreStoreConfig, $this->_importFactory, $this->_resourceHelper, @@ -202,12 +202,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; $data['data_source_model'] = $dataSourceMock; - + $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - + $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, - $this->_stringHelper, + $this->_string, $coreStoreConfig, $this->_importFactory, $this->_resourceHelper, @@ -262,12 +262,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data = $this->_getModelDependencies(); $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - + $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - + $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, - $this->_stringHelper, + $this->_string, $coreStoreConfig, $this->_importFactory, $this->_resourceHelper, @@ -433,12 +433,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data = $this->_getModelDependencies(); $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - + $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - + $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, - $this->_stringHelper, + $this->_string, $coreStoreConfig, $this->_importFactory, $this->_resourceHelper, @@ -486,12 +486,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data = $this->_getModelDependencies(); $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - + $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - + $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, - $this->_stringHelper, + $this->_string, $coreStoreConfig, $this->_importFactory, $this->_resourceHelper, @@ -649,12 +649,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data = $this->_getModelDependencies(); $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - + $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - + $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, - $this->_stringHelper, + $this->_string, $coreStoreConfig, $this->_importFactory, $this->_resourceHelper, @@ -695,12 +695,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data = $this->_getModelDependencies(); $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - + $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - + $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, - $this->_stringHelper, + $this->_string, $coreStoreConfig, $this->_importFactory, $this->_resourceHelper, @@ -743,12 +743,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data = $this->_getModelDependencies(); $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - + $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - + $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, - $this->_stringHelper, + $this->_string, $coreStoreConfig, $this->_importFactory, $this->_resourceHelper, @@ -941,7 +941,7 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, - $this->_stringHelper, + $this->_string, $coreStoreConfig, $this->_importFactory, $this->_resourceHelper, diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php index 9e2d9b7db114c5651b35e0448f4493a7b16a3c26..4534db5ea8ad94022686b3453af664058ed425c3 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php @@ -146,9 +146,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase protected $_coreDataMock; /** - * @var \Magento\Core\Helper\String|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Stdlib\String */ - protected $_coreStringMock; + protected $_stringLib; /** * @var \Magento\TestFramework\Helper\ObjectManager @@ -162,9 +162,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase { $this->_objectManagerMock = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $this->_coreStringMock = $this->getMock( - 'Magento\Core\Helper\String', array('__construct'), array(), '', false - ); + $this->_stringLib = new \Magento\Stdlib\String; $this->_model = $this->_getModelMock(); } @@ -425,7 +423,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase // mock to imitate data source model $dataSourceMock = $this->getMock( 'Magento\ImportExport\Model\Resource\Import\Data', - array('getNextBunch'), + array('getNextBunch', '__wakeup'), array(), '', false @@ -487,11 +485,11 @@ class AddressTest extends \PHPUnit_Framework_TestCase $modelMock = new \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address( $this->_coreDataMock, - $this->_coreStringMock, + $this->_stringLib, $coreStoreConfig, $this->getMock('Magento\ImportExport\Model\ImportFactory', array(), array(), '', false), $this->getMock('Magento\ImportExport\Model\Resource\Helper', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false), + $this->getMock('Magento\App\Resource', array(), array(), '', false), $this->getMock('Magento\Core\Model\App', array(), array(), '', false), $this->getMock('Magento\ImportExport\Model\Export\Factory', array(), array(), '', false), $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false), @@ -503,6 +501,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Customer\Model\Resource\Address\Attribute\CollectionFactory', array(), array(), '', false ), + new \Magento\Stdlib\DateTime, $this->_getModelDependencies() ); diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php index 4828ec7dd4613ef9153bd8da737fdc4cab07e97e..2799c09f9d29bcd5b58d061dd03ab4b95573205a 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php @@ -52,7 +52,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Core\Helper\String|\PHPUnit_Framework_MockObject_MockObject */ - protected $_coreStringMock; + protected $_string; /** * @var \Magento\ImportExport\Model\ImportFactory @@ -60,7 +60,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase protected $_importFactory; /** - * @var \Magento\Core\Model\Resource + * @var \Magento\App\Resource */ protected $_resource; @@ -87,11 +87,11 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $this->_coreStringMock = $this->getMock('Magento\Core\Helper\String', array('__construct'), array(), '', false); + $this->_string = new \Magento\Stdlib\String; $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); $this->_importFactory = $this->getMock('Magento\ImportExport\Model\ImportFactory', array(), array(), '', false); - $this->_resource = $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false); + $this->_resource = $this->getMock('Magento\App\Resource', array(), array(), '', false); $this->_resourceHelper = $this->getMock( 'Magento\ImportExport\Model\Resource\Helper', array(), array(), '', false ); @@ -102,20 +102,18 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase 'Magento\Eav\Model\Config', array(), array(), '', false ); - $this->_model = $this->getMockForAbstractClass('Magento\ImportExport\Model\Import\Entity\AbstractEav', - array( - $this->_coreDataMock, - $this->_coreStringMock, - $coreStoreConfig, - $this->_importFactory, - $this->_resourceHelper, - $this->_resource, - $this->_app, - $this->_collectionFactory, - $this->_eavConfig, - $this->_getModelDependencies() - ) - ); + $this->_model = $this->getMockForAbstractClass('Magento\ImportExport\Model\Import\Entity\AbstractEav', array( + $this->_coreDataMock, + $this->_string, + $coreStoreConfig, + $this->_importFactory, + $this->_resourceHelper, + $this->_resource, + $this->_app, + $this->_collectionFactory, + $this->_eavConfig, + $this->_getModelDependencies() + )); } protected function tearDown() @@ -131,12 +129,16 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase protected function _getModelDependencies() { $localeMock = $this->getMock('Magento\Core\Model\Locale', array(), array(), '', false); + $string = new \Magento\Stdlib\String; $data = array( 'data_source_model' => 'not_used', 'connection' => 'not_used', 'json_helper' => 'not_used', 'string_helper' => new \Magento\Core\Helper\String( - $this->getMock('Magento\Core\Helper\Context', array(), array(), '', false, false), $localeMock + $this->getMock('Magento\Core\Helper\Context', array(), array(), '', false, false), + $localeMock, + $string, + new \Magento\Stdlib\String($string) ), 'page_size' => 1, 'max_data_size' => 1, diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Product/OptionTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Product/OptionTest.php index 06f0a60fff571f4efcb8fb6f6fa9dc7232b64383..9d5b2c7b9b15a7ca57cf8dbfdd93ed4ee27449bd 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Product/OptionTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Product/OptionTest.php @@ -330,7 +330,7 @@ class OptionTest extends \PHPUnit_Framework_TestCase $this->_model = new \Magento\ImportExport\Model\Import\Entity\Product\Option( $this->getMock('Magento\ImportExport\Model\Resource\Import\Data', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false), + $this->getMock('Magento\App\Resource', array(), array(), '', false), $this->getMock('Magento\ImportExport\Model\Resource\Helper', array(), array(), '', false), $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false), $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false), @@ -340,6 +340,7 @@ class OptionTest extends \PHPUnit_Framework_TestCase array(), array(), '', false), $this->_catalogDataMock, $coreStoreConfig, + new \Magento\Stdlib\DateTime, $this->_getModelDependencies($addExpectations, $deleteBehavior, $doubleOptions) ); } @@ -450,7 +451,7 @@ class OptionTest extends \PHPUnit_Framework_TestCase $fetchStrategy = $this->getMockForAbstractClass( 'Magento\Data\Collection\Db\FetchStrategyInterface', array('fetchAll') ); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); $optionCollection = $this->getMock( @@ -530,7 +531,7 @@ class OptionTest extends \PHPUnit_Framework_TestCase */ public function getNewOptionMock() { - return $this->getMock('Magento\Catalog\Model\Product\Option', null, array(), '', false); + return $this->getMock('Magento\Catalog\Model\Product\Option', array('__wakeup'), array(), '', false); } /** diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php index 9e5640ee551282ff162088085f809704b6096e05..a31e78749754bc8ad616ca3695d722ccc26f927c 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php @@ -73,17 +73,17 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase protected function _getModelDependencies() { $coreHelper = $this->getMock('Magento\Core\Helper\Data', array('__construct'), array(), '', false); - $stringHelper = $this->getMock('Magento\Core\Helper\String', array('__construct'), array(), '', false); + $string = new \Magento\Stdlib\String; $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); $importFactory = $this->getMock('Magento\ImportExport\Model\ImportFactory', array(), array(), '', false); $resourceHelper = $this->getMock( 'Magento\ImportExport\Model\Resource\Helper', array(), array(), '', false ); - $resource = $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false); + $resource = $this->getMock('Magento\App\Resource', array(), array(), '', false); $data = array( 'coreData' => $coreHelper, - 'coreString' => $stringHelper, + 'coreString' => $string, 'coreStoreConfig' => $coreStoreConfig, 'importFactory' => $importFactory, 'resourceHelper' => $resourceHelper, diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Resource/CollectionByPagesIteratorTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Resource/CollectionByPagesIteratorTest.php index 46dc07792e3f650ed9c57560444e5827edb67878..f0a3fcdd13a2118bb5cd0073b92786ee4d6c882a 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Resource/CollectionByPagesIteratorTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Resource/CollectionByPagesIteratorTest.php @@ -63,7 +63,7 @@ class CollectionByPagesIteratorTest extends \PHPUnit_Framework_TestCase $select = $this->getMock('Zend_Db_Select', array(), array(), '', false); $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); /** @var $collectionMock \Magento\Data\Collection\Db|PHPUnit_Framework_MockObject_MockObject */ $collectionMock = $this->getMock('Magento\Data\Collection\Db', diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Resource/Import/CustomerComposite/DataTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Resource/Import/CustomerComposite/DataTest.php index 971b5cde0f469ee4868c0906875abb3a7c1f35c8..48a61c240b6d79478c31dc2fb909e766a7020ec7 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Resource/Import/CustomerComposite/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Resource/Import/CustomerComposite/DataTest.php @@ -78,8 +78,8 @@ class DataTest extends \PHPUnit_Framework_TestCase ->method('query') ->will($this->returnValue($statementMock)); - /** @var $resourceModelMock \Magento\Core\Model\Resource */ - $resourceModelMock = $this->getMock('Magento\Core\Model\Resource', + /** @var $resourceModelMock \Magento\App\Resource */ + $resourceModelMock = $this->getMock('Magento\App\Resource', array('getConnection', '_newConnection', 'getTableName'), array(), '', false ); diff --git a/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php b/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f5ac7aaf87f4179aa1b748cef1a8ec10e1948059 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php @@ -0,0 +1,93 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Index + * @subpackage unit_tests + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Index\App; + +class IndexerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Index\App\Indexer + */ + protected $_entryPoint; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Index\Model\IndexerFactory + */ + protected $_indexFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_filesystem; + + protected function setUp() + { + $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_indexFactoryMock = $this->getMock('Magento\Index\Model\IndexerFactory', + array('create'), array(), '', false); + $this->_entryPoint = new \Magento\Index\App\Indexer( + 'reportDir', + $this->_filesystem, + $this->_indexFactoryMock + ); + } + + /** + * @param bool $value + * @dataProvider executeDataProvider + */ + public function testExecute($value) + { + $process = $this->getMock('Magento\Index\Model\Process', + array('getIndexer', 'reindexEverything'), array(), '', false); + $indexer = $this->getMock('Magento\Index\Model\Indexer', + array('getProcessesCollection'), array(), '', false); + $indexerInterface = $this->getMock('Magento\Index\Model\IndexerInterface'); + $this->_indexFactoryMock->expects($this->once())->method('create')->will($this->returnValue($indexer)); + $indexer->expects($this->once())->method('getProcessesCollection')->will($this->returnValue(array($process))); + $process->expects($this->any())->method('getIndexer')->will($this->returnValue($indexerInterface)); + + if ($value) { + $indexerInterface->expects($this->once())->method('isVisible')->will($this->returnValue(true)); + $process->expects($this->once())->method('reindexEverything'); + } else { + $indexerInterface->expects($this->once())->method('isVisible')->will($this->returnValue(false)); + $process->expects($this->never())->method('reindexEverything'); + } + $this->assertEquals('0', $this->_entryPoint->execute()); + } + + /** + * @return array + */ + public function executeDataProvider() + { + return array( + array(true), + array(false) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Index/Model/EntryPoint/ShellTest.php b/dev/tests/unit/testsuite/Magento/Index/App/ShellTest.php similarity index 70% rename from dev/tests/unit/testsuite/Magento/Index/Model/EntryPoint/ShellTest.php rename to dev/tests/unit/testsuite/Magento/Index/App/ShellTest.php index ad895b0a43bf8b8ca7a220d9eb7143db6312fb53..d090e5bb2c886321ac734c3e6098a72695fae854 100644 --- a/dev/tests/unit/testsuite/Magento/Index/Model/EntryPoint/ShellTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/App/ShellTest.php @@ -24,43 +24,39 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Index\Model\EntryPoint; +namespace Magento\Index\App; class ShellTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Index\Model\EntryPoint\Shell + * @var \Magento\Index\App\Shell */ protected $_entryPoint; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_objectManager; + protected $_shellFactory; /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $_shellErrorHandler; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_primaryConfig; - protected function setUp() { - $this->_primaryConfig = $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false); - $this->_objectManager = $this->getMock('Magento\ObjectManager'); + $this->_shellFactory = $this->getMock('Magento\Index\Model\ShellFactory', array('create'), array(), '', false); $this->_shellErrorHandler = $this->getMock( - 'Magento\Index\Model\EntryPoint\Shell\ErrorHandler', + 'Magento\Index\App\Shell\ErrorHandler', array(), array(), '', false ); - $this->_entryPoint = new \Magento\Index\Model\EntryPoint\Shell( - 'indexer.php', $this->_shellErrorHandler, $this->_primaryConfig, $this->_objectManager + $this->_entryPoint = new \Magento\Index\App\Shell( + 'indexer.php', + $this->_shellFactory, + $this->_shellErrorHandler ); } @@ -76,21 +72,17 @@ class ShellTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($shellHasErrors)); $shell->expects($this->once()) ->method('run'); - if ($shellHasErrors) { $this->_shellErrorHandler->expects($this->once()) ->method('terminate') ->with(1); } - $this->_objectManager->expects($this->any()) + $this->_shellFactory->expects($this->any()) ->method('create') - ->will($this->returnValueMap( - array( - array('Magento\Index\Model\Shell', array('entryPoint' => 'indexer.php'), $shell), - ) - )); + ->will($this->returnValue($shell) + ); - $this->_entryPoint->processRequest(); + $this->_entryPoint->execute(); } /** diff --git a/dev/tests/unit/testsuite/Magento/Index/Model/EntryPoint/IndexerTest.php b/dev/tests/unit/testsuite/Magento/Index/Model/EntryPoint/IndexerTest.php deleted file mode 100644 index 34d8f2df056f157fc04b5c7c907dea63ecb986b8..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Index/Model/EntryPoint/IndexerTest.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Index - * @subpackage unit_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Index\Model\EntryPoint; - -class IndexerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Index\Model\EntryPoint\Indexer - */ - protected $_entryPoint; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManager; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_primaryConfig; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_filesystem; - - /** - * @var string - */ - protected $_reportDir; - - protected function setUp() - { - $this->_reportDir = 'tmp' . DIRECTORY_SEPARATOR . 'reports'; - $this->_primaryConfig = $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false); - $this->_objectManager = $this->getMock('Magento\ObjectManager'); - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $this->_entryPoint = new \Magento\Index\Model\EntryPoint\Indexer( - $this->_reportDir, $this->_filesystem, $this->_primaryConfig, $this->_objectManager - ); - } - - public function testProcessRequest() - { - $process = $this->getMock('Magento\Index\Model\Process', array(), array(), '', false); - $processIndexer = $this->getMockForAbstractClass( - 'Magento\Index\Model\Indexer\AbstractIndexer', - array(), - '', - false - ); - $processIndexer->expects($this->any())->method('isVisible')->will($this->returnValue(true)); - $process->expects($this->any())->method('getIndexer')->will($this->returnValue($processIndexer)); - $process->expects($this->once())->method('reindexEverything')->will($this->returnSelf()); - - $indexer = $this->getMock('Magento\Index\Model\Indexer', array(), array(), '', false); - $indexer->expects($this->once()) - ->method('getProcessesCollection') - ->will($this->returnValue(array($process))); - - $this->_objectManager->expects($this->any()) - ->method('create') - ->will($this->returnValueMap( - array( - array('Magento\Index\Model\Indexer', array(), $indexer), - ) - )); - // check that report directory is cleaned - $this->_filesystem->expects($this->once()) - ->method('delete') - ->with($this->_reportDir, dirname($this->_reportDir)); - - $this->_entryPoint->processRequest(); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/SchemaLocatorTest.php index e4ccd2bc904e3ce1b657606154ab0cbe2c067bcb..a04eb58db3938da924d1ea61361a6f7d978833fb 100644 --- a/dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/Model/Indexer/Config/SchemaLocatorTest.php @@ -38,7 +38,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_modulesReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false + 'Magento\Module\Dir\Reader', array(), array(), '', false ); $this->_modulesReaderMock->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/EntryPoint/ConsoleTest.php b/dev/tests/unit/testsuite/Magento/Install/App/ConsoleTest.php similarity index 71% rename from dev/tests/unit/testsuite/Magento/Install/Model/EntryPoint/ConsoleTest.php rename to dev/tests/unit/testsuite/Magento/Install/App/ConsoleTest.php index 6666deaa48ffdee0e51b9e289e2895ff9a0b9fb4..38b152e6af5b30bac8755e94141c9da94e471d37 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Model/EntryPoint/ConsoleTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/App/ConsoleTest.php @@ -22,76 +22,83 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Install\Model\EntryPoint; +namespace Magento\Install\App; class ConsoleTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Install\Model\EntryPoint\Console + * @var \Magento\Install\App\Console */ protected $_model; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\ObjectManager + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Install\Model\Installer\Console */ - protected $_objectManagerMock; + protected $_installerMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Config\Primary + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Dir\Verification */ - protected $_configMock; + protected $_dirVerifierMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Install\Model\Installer\Console + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Install\App\Output */ - protected $_installerMock; + protected $_outputMock; + + /** \PHPUnit_Framework_MockObject_MockObject|\Magento\Install\Model\Installer\ConsoleFactory */ + protected $_instFactoryMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Dir\Verification + * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_dirVerifierMock; + protected $_appStateMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Install\Model\EntryPoint\Output + * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_outputMock; + protected $_configLoaderMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_objectManagerMock; protected function setUp() { - $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); - $this->_configMock = $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false); + $this->_instFactoryMock = $this->getMock('\Magento\Install\Model\Installer\ConsoleFactory', + array('create'), array(), '', false); $this->_installerMock = $this->getMock('Magento\Install\Model\Installer\Console', array(), array(), '', false); $this->_dirVerifierMock = $this->getMock('Magento\App\Dir\Verification', array(), array(), '', false); - $this->_outputMock = $this->getMock('Magento\Install\Model\EntryPoint\Output', array(), array(), '', false); - - $this->_objectManagerMock->expects($this->once())->method('create') - ->with('Magento\Install\Model\Installer\Console') + $this->_outputMock = $this->getMock('Magento\Install\App\Output', array(), array(), '', false); + $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); + $this->_configLoaderMock = $this->getMockBuilder('Magento\App\ObjectManager\ConfigLoader') + ->disableOriginalConstructor() + ->getMock(); + $this->_instFactoryMock->expects($this->any())->method('create') ->will($this->returnValue($this->_installerMock)); + + $this->_configLoaderMock->expects($this->once())->method('load') + ->with('install')->will($this->returnValue(array('di' => 'config'))); + + $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); + $this->_objectManagerMock->expects($this->once())->method('configure')->with(array('di' => 'config')); } protected function _createModel($params = array()) { - return new \Magento\Install\Model\EntryPoint\Console('', $params, $this->_configMock, - $this->_objectManagerMock, $this->_outputMock + return new \Magento\Install\App\Console($this->_instFactoryMock, $this->_outputMock, + $this->_appStateMock, $this->_configLoaderMock, $this->_objectManagerMock, $params ); } - protected function tearDown() - { - unset($this->_model); - unset($this->_configMock); - unset($this->_objectManagerMock); - unset($this->_installerMock); - unset($this->_dirVerifierMock); - } - /** * @param string $param * @param string $method * @param string $testValue - * @dataProvider processRequestShowsRequestedDataProvider + * @dataProvider executeShowsRequestedDataProvider */ - public function testProcessRequestShowsRequestedData($param, $method, $testValue) + public function testExecuteShowsRequestedData($param, $method, $testValue) { $model = $this->_createModel(array($param => true)); $this->_installerMock @@ -99,10 +106,10 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase ->method($method) ->will($this->returnValue($testValue)); $this->_outputMock->expects($this->once())->method('export')->with($testValue); - $model->processRequest(); + $model->execute(); } - public function processRequestShowsRequestedDataProvider() + public function executeShowsRequestedDataProvider() { return array( array('show_locales', 'getAvailableLocales', 'locales'), @@ -116,7 +123,7 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase { $model = $this->_createModel(array()); $this->_outputMock->expects($this->once())->method('success')->with($this->stringContains('successfully')); - $model->processRequest(); + $model->execute(); } public function testInstallReportsEncryptionKey() @@ -124,7 +131,7 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase $model = $this->_createModel(array()); $this->_installerMock->expects($this->once())->method('install')->will($this->returnValue('enc_key')); $this->_outputMock->expects($this->once())->method('success')->with($this->stringContains('enc_key')); - $model->processRequest(); + $model->execute(); } public function testUninstallReportsSuccess() @@ -132,7 +139,7 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase $model = $this->_createModel(array('uninstall' => true)); $this->_installerMock->expects($this->once())->method('uninstall')->will($this->returnValue(true)); $this->_outputMock->expects($this->once())->method('success')->with($this->stringContains('Uninstalled')); - $model->processRequest(); + $model->execute(); } public function testUninstallReportsIgnoreIfApplicationIsNotInstalled() @@ -140,22 +147,22 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase $model = $this->_createModel(array('uninstall' => true)); $this->_installerMock->expects($this->once())->method('uninstall')->will($this->returnValue(false)); $this->_outputMock->expects($this->once())->method('success')->with($this->stringContains('non-installed')); - $model->processRequest(); + $model->execute(); } - public function testProcessRequestReportsErrors() + public function testExecuteReportsErrors() { $model = $this->_createModel(array('uninstall' => true)); $this->_installerMock->expects($this->once())->method('hasErrors')->will($this->returnValue(true)); $this->_installerMock->expects($this->once())->method('getErrors')->will($this->returnValue(array('error1'))); $this->_outputMock->expects($this->once())->method('error')->with($this->stringContains('error1')); - $model->processRequest(); + $model->execute(); } - public function testProcessRequestLoadsExtraConfig() + public function testExecuteLoadsExtraConfig() { $model = $this->_createModel(array('config' => realpath(__DIR__ . '/_files/config.php'))); $this->_installerMock->expects($this->once())->method('uninstall')->will($this->returnValue(true)); - $model->processRequest(); + $model->execute(); } } diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/EntryPoint/_files/config.php b/dev/tests/unit/testsuite/Magento/Install/App/_files/config.php similarity index 100% rename from dev/tests/unit/testsuite/Magento/Install/Model/EntryPoint/_files/config.php rename to dev/tests/unit/testsuite/Magento/Install/App/_files/config.php diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/EntryPoint/UpgradeTest.php b/dev/tests/unit/testsuite/Magento/Install/Model/EntryPoint/UpgradeTest.php deleted file mode 100644 index 2affff579db60280853bd0b64dfeb500f818d586..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Install/Model/EntryPoint/UpgradeTest.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Install\Model\EntryPoint; - -class UpgradeTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_indexer; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_config; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManager; - - protected function setUp() - { - $this->_config = $this->getMock('Magento\Core\Model\Config\Primary', array('getParam'), array(), '', false); - - $dirVerification = $this->getMock('Magento\App\Dir\Verification', array(), array(), '', false); - - $cacheFrontend = $this->getMockForAbstractClass('Magento\Cache\FrontendInterface'); - $cacheFrontend->expects($this->once())->method('clean')->with('all', array()); - $cacheFrontendPool = $this->getMock( - 'Magento\Core\Model\Cache\Frontend\Pool', array('valid', 'current'), array( - $this->getMock('Magento\Core\Model\Cache\Frontend\Factory', array(), array(), '', false), - ) - ); - $cacheFrontendPool->expects($this->at(0))->method('valid')->will($this->returnValue(true)); - $cacheFrontendPool->expects($this->once())->method('current')->will($this->returnValue($cacheFrontend)); - - $update = $this->getMock( - 'Magento\App\Updater', array('updateScheme', 'updateData'), array(), '', false); - $update->expects($this->once())->method('updateScheme'); - $update->expects($this->once())->method('updateData'); - - $this->_indexer = $this->getMock( - 'Magento\Index\Model\Indexer', array('reindexAll', 'reindexRequired'), array(), '', false - ); - - $this->_objectManager = $this->getMock('Magento\ObjectManager'); - $this->_objectManager->expects($this->any())->method('get')->will($this->returnValueMap(array( - array('Magento\Core\Model\Cache\Frontend\Pool', $cacheFrontendPool), - array('Magento\App\Updater', $update), - array('Magento\Core\Model\Config\Primary', $this->_config), - array('Magento\Index\Model\Indexer', $this->_indexer), - array('Magento\App\Dir\Verification', $dirVerification), - ))); - } - - /** - * @param string $reindexMode - * @param int $reindexAllCount - * @param int $reindexReqCount - * @dataProvider processRequestDataProvider - */ - public function testProcessRequest($reindexMode, $reindexAllCount, $reindexReqCount) - { - $this->_indexer->expects($this->exactly($reindexAllCount))->method('reindexAll'); - $this->_indexer->expects($this->exactly($reindexReqCount))->method('reindexRequired'); - $this->_config->expects($this->once()) - ->method('getParam')->with(\Magento\Install\Model\EntryPoint\Upgrade::REINDEX) - ->will($this->returnValue($reindexMode)); - $upgrade = new \Magento\Install\Model\EntryPoint\Upgrade($this->_config, $this->_objectManager); - $upgrade->processRequest(); - } - - public function processRequestDataProvider() - { - return array( - 'no reindex' => array('', 0, 0), - 'reindex all' => array(\Magento\Install\Model\EntryPoint\Upgrade::REINDEX_ALL, 1, 0), - 'reindex required' => array(\Magento\Install\Model\EntryPoint\Upgrade::REINDEX_INVALID, 0, 1), - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php index 3f965c0853b9131f149ae68ce243e6636f921574..6f5ebfd47098bd08d268c8f8989350601ff04203 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php +++ b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php @@ -51,7 +51,7 @@ class Mysql4Test extends \PHPUnit_Framework_TestCase $adapterMock->expects($this->once())->method('getConnection')->will($this->returnValue($connectionMock)); $adapterFactory->expects($this->once())->method('create')->will($this->returnValue($adapterMock)); - $localConfig = $this->getMockBuilder('\Magento\Core\Model\Config\Local') + $localConfig = $this->getMockBuilder('\Magento\App\Config') ->disableOriginalConstructor() ->getMock(); @@ -85,7 +85,7 @@ class Mysql4Test extends \PHPUnit_Framework_TestCase 'Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory', array('create'), array(), '', false ); $localConfig = - $this->getMockBuilder('\Magento\Core\Model\Config\Local')->disableOriginalConstructor()->getMock(); + $this->getMockBuilder('\Magento\App\Config')->disableOriginalConstructor()->getMock(); $installer = new \Magento\Install\Model\Installer\Db\Mysql4( $adapterFactory, $localConfig, $dbExtensions ); diff --git a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..90d60d8513598c9757012038374e7f2e2304598e --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php @@ -0,0 +1,354 @@ +<?php +/** + * \Magento\Integration\Controller\Adminhtml + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Integration\Controller\Adminhtml; + +use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; +use Magento\Integration\Controller\Adminhtml\Integration; + +class IntegrationTest extends \PHPUnit_Framework_TestCase +{ + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockObjectManager; + + /** @var \Magento\Integration\Controller\Adminhtml\Integration */ + protected $_integrationContr; + + /** @var \Magento\TestFramework\Helper\ObjectManager $objectManagerHelper */ + protected $_objectManagerHelper; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockApp; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockLayoutFilter; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockConfig; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockEventManager; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockTranslateModel; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockBackendModSess; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockBackendCntCtxt; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockIntegrationSvc; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockRegistry; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockRequest; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockResponse; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockConfigScope; + + /** + * Setup object manager and initialize mocks + */ + protected function setUp() + { + /** @var \Magento\TestFramework\Helper\ObjectManager $objectManagerHelper */ + $this->_objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_setMageObjectManager(); + // Initialize mocks which are used in several test cases + $this->_mockApp = $this->getMockBuilder('Magento\Core\Model\App') + ->setMethods(array('getConfig')) + ->disableOriginalConstructor() + ->getMock(); + $this->_mockConfig = $this->getMockBuilder('Magento\Core\Model\Config')->disableOriginalConstructor() + ->getMock(); + $this->_mockApp->expects($this->any())->method('getConfig')->will($this->returnValue($this->_mockConfig)); + $this->_mockEventManager = $this->getMockBuilder('Magento\Event\ManagerInterface') + ->disableOriginalConstructor() + ->getMock(); + $this->_mockLayoutFilter = $this->getMockBuilder('Magento\Core\Model\Layout\Filter\Acl') + ->disableOriginalConstructor() + ->getMock(); + $this->_mockBackendModSess = $this->getMockBuilder('Magento\Backend\Model\Session') + ->disableOriginalConstructor() + ->getMock(); + $this->_mockTranslateModel = $this->getMockBuilder('Magento\Core\Model\Translate') + ->disableOriginalConstructor() + ->getMock(); + $this->_mockIntegrationSvc = $this->getMockBuilder('Magento\Integration\Service\IntegrationV1') + ->disableOriginalConstructor() + ->getMock(); + $this->_mockRequest = $this->getMockBuilder('Magento\App\Request\Http') + ->disableOriginalConstructor() + ->getMock(); + $this->_mockResponse = $this->getMockBuilder('Magento\App\Response\Http') + ->disableOriginalConstructor() + ->getMock(); + $this->_mockRegistry = $this->getMockBuilder('Magento\Core\Model\Registry') + ->disableOriginalConstructor() + ->getMock(); + $this->_mockConfigScope = $this->getMockBuilder('Magento\Config\ScopeInterface') + ->disableOriginalConstructor() + ->getMock(); + } + + public function testIndexAction() + { + $this->_verifyLoadAndRenderLayout(); + // renderLayout + $this->_integrationContr = $this->_createIntegrationController(); + $this->_integrationContr->indexAction(); + } + + public function testNewAction() + { + $this->_verifyLoadAndRenderLayout(); + // verify the request is forwarded to 'edit' action + $this->_mockRequest->expects($this->any())->method('setActionName')->with('edit') + ->will($this->returnValue($this->_mockRequest)); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->newAction(); + } + + public function testEditAction() + { + $this->_mockIntegrationSvc->expects($this->any())->method('get')->with(1)->will( + $this->returnValue($this->_getSampleIntegrationData())); + $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); + // put data in session, the magic function getFormData is called so, must match __call method name + $this->_mockBackendModSess->expects($this->any()) + ->method('__call')->will( + $this->returnValue(array( + Info::DATA_ID => 1, + 'name' => 'testIntegration' + ))); + $this->_verifyLoadAndRenderLayout(); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->editAction(); + } + + public function testEditActionNonExistentIntegration() + { + $exceptionMessage = 'This integration no longer exists.'; + // verify the error + $this->_mockBackendModSess->expects($this->once()) + ->method('addError') + ->with($this->equalTo($exceptionMessage)); + $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); + // put data in session, the magic function getFormData is called so, must match __call method name + $this->_mockBackendModSess->expects($this->any()) + ->method('__call')->will($this->returnValue(array('name' => 'nonExistentInt'))); + $this->_verifyLoadAndRenderLayout(); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->editAction(); + } + + public function testEditActionNoDataAdd() + { + $exceptionMessage = 'Integration ID is not specified or is invalid.'; + // verify the error + $this->_mockBackendModSess->expects($this->once()) + ->method('addError') + ->with($this->equalTo($exceptionMessage)); + $this->_verifyLoadAndRenderLayout(); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->editAction(); + } + + public function testEditException() + { + $exceptionMessage = 'Integration ID is not specified or is invalid.'; + // verify the error + $this->_mockBackendModSess->expects($this->once()) + ->method('addError') + ->with($this->equalTo($exceptionMessage)); + $this->_integrationContr = $this->_createIntegrationController(); + $this->_integrationContr->editAction(); + } + + public function testSaveAction() + { + // Use real translate model + $this->_mockTranslateModel = null; + $this->_mockRequest->expects($this->any()) + ->method('getPost')->will($this->returnValue(array(Integration::PARAM_INTEGRATION_ID => 1))); + $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); + $intData = $this->_getSampleIntegrationData(); + $this->_mockIntegrationSvc->expects($this->any())->method('get')->with(1)->will($this->returnValue($intData)); + $this->_mockIntegrationSvc->expects($this->any())->method('update')->with($this->anything()) + ->will($this->returnValue($intData)); + // verify success message + $this->_mockBackendModSess->expects($this->once())->method('addSuccess') + ->with(__('The integration \'%1\' has been saved.', $intData[Info::DATA_NAME])); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->saveAction(); + } + + public function testSaveActionException() + { + $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); + + // Have integration service throw an exception to test exception path + $exceptionMessage = 'an exception happened'; + $this->_mockIntegrationSvc->expects($this->any()) + ->method('get') + ->with(1) + ->will($this->throwException(new \Magento\Core\Exception($exceptionMessage))); + // Verify error + $this->_mockBackendModSess->expects($this->once())->method('addError') + ->with($this->equalTo($exceptionMessage)); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->saveAction(); + } + + public function testSaveActionNew() + { + $intData = $this->_getSampleIntegrationData(); + //No id when New Integration is Post-ed + unset($intData[Info::DATA_ID]); + $this->_mockRequest->expects($this->any())->method('getPost')->will($this->returnValue($intData)); + $intData[Info::DATA_ID] = 1; + $this->_mockIntegrationSvc->expects($this->any())->method('create')->with($this->anything()) + ->will($this->returnValue($intData)); + $this->_mockIntegrationSvc->expects($this->any())->method('get')->with(1)->will( + $this->returnValue(null)); + // Use real translate model + $this->_mockTranslateModel = null; + // verify success message + $this->_mockBackendModSess->expects($this->once())->method('addSuccess') + ->with(__('The integration \'%1\' has been saved.', $intData[Info::DATA_NAME])); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->saveAction(); + } + + /** + * Makes sure that Mage has a mock object manager set. + * + */ + protected function _setMageObjectManager() + { + $this->_mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') + ->disableOriginalConstructor() + ->getMock(); + \Magento\App\ObjectManager::setInstance($this->_mockObjectManager); + } + + /** + * Creates the IntegrationController to test. + * + * @return \Magento\Integration\Controller\Adminhtml\Integration + */ + protected function _createIntegrationController() + { + // Mock Layout passed into constructor + $layoutMock = $this->getMockBuilder('Magento\Core\Model\Layout') + ->disableOriginalConstructor() + ->getMock(); + $layoutMergeMock = $this->getMockBuilder('Magento\Core\Model\Layout\Merge') + ->disableOriginalConstructor() + ->getMock(); + $layoutMock->expects($this->any())->method('getUpdate')->will($this->returnValue($layoutMergeMock)); + $testElement = new \Magento\Simplexml\Element('<test>test</test>'); + $layoutMock->expects($this->any())->method('getNode')->will($this->returnValue($testElement)); + // for _setActiveMenu + $blockMock = $this->getMockBuilder('Magento\Backend\Block\Menu') + ->disableOriginalConstructor() + ->getMock(); + $menuMock = $this->getMockBuilder('Magento\Backend\Model\Menu') + ->disableOriginalConstructor() + ->getMock(); + $menuMock->expects($this->any())->method('getParentItems')->will($this->returnValue(array())); + $blockMock->expects($this->any())->method('getMenuModel')->will($this->returnValue($menuMock)); + $layoutMock->expects($this->any())->method('getMessagesBlock')->will($this->returnValue($blockMock)); + $layoutMock->expects($this->any())->method('getBlock')->will($this->returnValue($blockMock)); + $contextParameters = array( + 'layout' => $layoutMock, + 'objectManager' => $this->_mockObjectManager, + 'session' => $this->_mockBackendModSess, + 'translator' => $this->_mockTranslateModel, + 'request' => $this->_mockRequest, + 'response' => $this->_mockResponse, + ); + + $this->_mockBackendCntCtxt = $this->_objectManagerHelper + ->getObject( + 'Magento\Backend\Controller\Context', + $contextParameters + ); + $subControllerParams = array( + 'context' => $this->_mockBackendCntCtxt, + 'integrationService' => $this->_mockIntegrationSvc, + 'registry' => $this->_mockRegistry, + ); + /** Create IntegrationController to test */ + $integrationContr = $this->_objectManagerHelper + ->getObject( + 'Magento\Integration\Controller\Adminhtml\Integration', + $subControllerParams + ); + return $integrationContr; + } + + /** + * Common mock 'expect' pattern. + * Calls that need to be mocked out when + * \Magento\Backend\Controller\AbstractAction loadLayout() and renderLayout() are called. + */ + protected function _verifyLoadAndRenderLayout() + { + $map = array( + array('Magento\Core\Model\Config', $this->_mockConfig), + array('Magento\Core\Model\Layout\Filter\Acl', $this->_mockLayoutFilter), + array('Magento\Backend\Model\Session', $this->_mockBackendModSess), + array('Magento\Core\Model\Translate', $this->_mockTranslateModel), + array('Magento\Config\ScopeInterface', $this->_mockConfigScope) + ); + $this->_mockObjectManager->expects($this->any()) + ->method('get') + ->will($this->returnValueMap($map)); + } + + /** + * Return sample Integration Data + * + * @return array + */ + protected function _getSampleIntegrationData() + { + return array( + Info::DATA_NAME => 'nameTest', + Info::DATA_ID => '1', + Info::DATA_EMAIL => 'test@magento.com', + Info::DATA_AUTHENTICATION => 1, + Info::DATA_ENDPOINT => 'http://magento.ll/endpoint' + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Integration/Model/Integration/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Integration/Model/Integration/FactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ada362944633e3634e5ab1d542031a2a6e6a609e --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Integration/Model/Integration/FactoryTest.php @@ -0,0 +1,59 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Integration\Model\Integration; + +use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; + +class FactoryTest extends \PHPUnit_Framework_TestCase +{ + public function testCreate() + { + /** @var \PHPUnit_Framework_MockObject_MockObject */ + $mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') + ->disableOriginalConstructor() + ->getMock(); + \Magento\App\ObjectManager::setInstance($mockObjectManager); + $data = array( + Info::DATA_NAME => 'nameTest', + Info::DATA_ID => '1', + Info::DATA_EMAIL => 'test@magento.com', + Info::DATA_AUTHENTICATION => 1, + Info::DATA_ENDPOINT => 'http://magento.ll/endpoint' + ); + $mockIntegration = $this->getMockBuilder('Magento\Integration\Model\Integration') + ->disableOriginalConstructor() + ->getMock(); + $mockIntegration->expects($this->any()) + ->method('setData') + ->will($this->returnSelf()); + $mockIntegration->expects($this->any()) + ->method('getData') + ->will($this->returnValue($data)); + $mockObjectManager->expects($this->any())->method('create')->will($this->returnValue($mockIntegration)); + /* @var \Magento\Integration\Model\Integration\Factory */ + $integrationFactory = new \Magento\Integration\Model\Integration\Factory($mockObjectManager); + $integration = $integrationFactory->create($data); + $this->assertEquals($data, $integration->getData(), 'The integration data is not set correctly'); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Integration/Model/Integration/Source/AuthenticationTest.php b/dev/tests/unit/testsuite/Magento/Integration/Model/Integration/Source/AuthenticationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a676b7857ecffb54a84bc02b718a6e4e382becf6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Integration/Model/Integration/Source/AuthenticationTest.php @@ -0,0 +1,40 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Integration\Model\Integration\Source; + +class AuthenticationTest extends \PHPUnit_Framework_TestCase +{ + public function testToOptionArray() + { + /** @var \Magento\Integration\Model\Integration\Source\Authentication */ + $authSource = new \Magento\Integration\Model\Integration\Source\Authentication(); + /** @var array */ + $expectedAuthArr = array( + \Magento\Integration\Model\Integration::AUTHENTICATION_OAUTH => __('OAuth'), + \Magento\Integration\Model\Integration::AUTHENTICATION_MANUAL => __('Manual'), + ); + $authArr = $authSource->toOptionArray(); + $this->assertEquals($expectedAuthArr, $authArr, "Authentication source arrays don't match"); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Router/Validator/DefaultTest.php b/dev/tests/unit/testsuite/Magento/Integration/Model/Integration/Source/StatusTest.php similarity index 53% rename from dev/tests/integration/testsuite/Magento/Backend/Controller/Router/Validator/DefaultTest.php rename to dev/tests/unit/testsuite/Magento/Integration/Model/Integration/Source/StatusTest.php index 2c9cb197168fc3c8e86f939bbf1acf181d418d38..aa5bb14bdd87a15e4a91c4ec45e5fa0bfa6dd829 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Router/Validator/DefaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Model/Integration/Source/StatusTest.php @@ -18,31 +18,29 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Backend - * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Integration\Model\Integration\Source; -namespace Magento\Backend\Controller\Router\Validator; - -/** - * @magentoAppArea adminhtml - */ -class DefaultTest extends \PHPUnit_Framework_TestCase +class StatusTest extends \PHPUnit_Framework_TestCase { - /** - * @magentoConfigFixture global/areas/adminhtml/frontName backend - * @magentoAppIsolation enabled - */ - public function testConstructWithNotEmptyAreaFrontName() + public function testToOptionArray() { - $options = array( - 'areaCode' => \Magento\Core\Model\App\Area::AREA_ADMINHTML, - 'baseController' => 'Magento\Backend\Controller\AbstractAction', + /** @var \Magento\Integration\Model\Integration\Source\Status */ + $statusSource = new \Magento\Integration\Model\Integration\Source\Status(); + /** @var array */ + $expectedStatusArr = array( + array( + 'value' => \Magento\Integration\Model\Integration::STATUS_INACTIVE, + 'label' => __('Inactive') + ), + array( + 'value' => \Magento\Integration\Model\Integration::STATUS_ACTIVE, + 'label' => __('Active') + ), ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Backend\Controller\Router\DefaultRouter', $options); + $statusArr = $statusSource->toOptionArray(); + $this->assertEquals($expectedStatusArr, $statusArr, "Status source arrays don't match"); } } diff --git a/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php b/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php new file mode 100644 index 0000000000000000000000000000000000000000..17cc02476d799d5fa8f360a9b6ee920d83347cdf --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php @@ -0,0 +1,321 @@ +<?php +/** + * Test for \Magento\Integration\Service\IntegrationV1 + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Integration\Service; + +class IntegrationV1Test extends \PHPUnit_Framework_TestCase +{ + const VALUE_INTEGRATION_ID = 1; + const VALUE_INTEGRATION_NAME = 'Integration Name'; + const VALUE_INTEGRATION_ANOTHER_NAME = 'Another Integration Name'; + const VALUE_INTEGRATION_EMAIL = 'test@magento.com'; + const VALUE_INTEGRATION_ENDPOINT = 'http://magento.ll/endpoint'; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + private $_integrationFactory; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + private $_integrationMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + private $_emptyIntegrationMock; + + /** @var \Magento\Integration\Service\IntegrationV1 */ + private $_service; + + /** @var array */ + private $_integrationData; + + protected function setUp() + { + $this->_integrationFactory = $this->getMockBuilder('Magento\Integration\Model\Integration\Factory') + ->disableOriginalConstructor() + ->getMock(); + $this->_integrationMock = $this->getMockBuilder('Magento\Integration\Model\Integration') + ->disableOriginalConstructor() + ->setMethods( + [ + 'getData', + 'getId', + 'getName', + 'getEmail', + 'getAuthentication', + 'getEndpoint', + 'load', + 'loadByName', + 'save', + '__wakeup' + ] + ) + ->getMock(); + $this->_integrationData = array( + 'integration_id' => self::VALUE_INTEGRATION_ID, + 'name' => self::VALUE_INTEGRATION_NAME, + 'email' => self::VALUE_INTEGRATION_EMAIL, + 'authentication' => 1, + 'endpoint' => self::VALUE_INTEGRATION_ENDPOINT + ); + $this->_integrationFactory->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_integrationMock)); + $this->_service = new \Magento\Integration\Service\IntegrationV1( + $this->_integrationFactory + ); + $this->_emptyIntegrationMock = $this->getMockBuilder('Magento\Integration\Model\Integration') + ->disableOriginalConstructor() + ->setMethods( + [ + 'getData', + 'getId', + 'getName', + 'getEmail', + 'getAuthentication', + 'getEndpoint', + 'load', + 'loadByName', + 'save', + '__wakeup' + ] + ) + ->getMock(); + $this->_emptyIntegrationMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(null)); + } + + public function testCreateSuccess() + { + $this->_integrationMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(self::VALUE_INTEGRATION_ID)); + $this->_integrationMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_integrationData)); + $this->_integrationMock->expects($this->any()) + ->method('load') + ->with(self::VALUE_INTEGRATION_NAME, 'name') + ->will($this->returnValue($this->_emptyIntegrationMock)); + $this->_integrationMock->expects($this->any()) + ->method('save') + ->will($this->returnSelf()); + $this->_setValidIntegrationData(); + $resultData = $this->_service->create($this->_integrationData); + $this->assertSame($this->_integrationData, $resultData); + } + + /** + * @expectedException \Magento\Integration\Exception + * @expectedExceptionMessage Integration with name 'Integration Name' exists. + */ + public function testCreateIntegrationAlreadyExistsException() + { + $this->_integrationMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(self::VALUE_INTEGRATION_ID)); + $this->_integrationMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_integrationData)); + $this->_integrationMock->expects($this->any()) + ->method('load') + ->with(self::VALUE_INTEGRATION_NAME, 'name') + ->will($this->returnValue($this->_integrationMock)); + $this->_integrationMock->expects($this->never()) + ->method('save') + ->will($this->returnSelf()); + $this->_service->create($this->_integrationData); + } + + public function testUpdateSuccess() + { + $this->_integrationMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(self::VALUE_INTEGRATION_ID)); + $this->_integrationMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_integrationData)); + $this->_integrationMock->expects($this->at(0)) + ->method('load') + ->with(self::VALUE_INTEGRATION_ID) + ->will($this->returnValue($this->_integrationMock)); + $this->_integrationMock->expects($this->once()) + ->method('save') + ->will($this->returnSelf()); + $this->_setValidIntegrationData(); + $integrationData = $this->_service->update($this->_integrationData); + $this->assertEquals($this->_integrationData, $integrationData); + } + + public function testUpdateSuccessNameChanged() + { + $this->_integrationMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(self::VALUE_INTEGRATION_ID)); + $this->_integrationMock->expects($this->any()) + ->method('load') + ->will($this->onConsecutiveCalls($this->_integrationMock, $this->_emptyIntegrationMock)); + $this->_integrationMock->expects($this->once()) + ->method('save') + ->will($this->returnSelf()); + $this->_setValidIntegrationData(); + $integrationData = array( + 'integration_id' => self::VALUE_INTEGRATION_ID, + 'name' => self::VALUE_INTEGRATION_ANOTHER_NAME, + 'email' => self::VALUE_INTEGRATION_EMAIL, + 'authentication' => 1, + 'endpoint' => self::VALUE_INTEGRATION_ENDPOINT + ); + $this->_integrationMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($integrationData)); + + $updatedData = $this->_service->update($integrationData); + $this->assertEquals($integrationData, $updatedData); + } + + /** + * @expectedException \Magento\Integration\Exception + * @expectedExceptionMessage Integration with name 'Another Integration Name' exists. + */ + public function testUpdateException() + { + $this->_integrationMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(self::VALUE_INTEGRATION_ID)); + $this->_integrationMock->expects($this->any()) + ->method('load') + ->will($this->onConsecutiveCalls($this->_integrationMock, $this->_getAnotherIntegrationMock())); + $this->_integrationMock->expects($this->never()) + ->method('save') + ->will($this->returnSelf()); + $this->_setValidIntegrationData(); + $integrationData = array( + 'integration_id' => self::VALUE_INTEGRATION_ID, + 'name' => self::VALUE_INTEGRATION_ANOTHER_NAME, + 'email' => self::VALUE_INTEGRATION_EMAIL, + 'authentication' => 1, + 'endpoint' => self::VALUE_INTEGRATION_ENDPOINT + ); + $this->_service->update($integrationData); + } + + public function testGet() + { + $this->_integrationMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(self::VALUE_INTEGRATION_ID)); + $this->_integrationMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_integrationData)); + $this->_integrationMock->expects($this->once()) + ->method('load') + ->will($this->returnSelf()); + $this->_integrationMock->expects($this->never()) + ->method('save'); + $integrationData = $this->_service->get(self::VALUE_INTEGRATION_ID); + $this->assertEquals($this->_integrationData, $integrationData); + } + + /** + * @expectedException \Magento\Integration\Exception + * @expectedExceptionMessage Integration with ID '1' doesn't exist. + */ + public function testGetException() + { + $this->_integrationMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(null)); + $this->_integrationMock->expects($this->once()) + ->method('load') + ->will($this->returnSelf()); + $this->_integrationMock->expects($this->never()) + ->method('save'); + $this->_service->get(self::VALUE_INTEGRATION_ID); + } + + /** + * Set valid integration data + */ + private function _setValidIntegrationData() + { + $this->_integrationMock->expects($this->any()) + ->method('getName') + ->will($this->returnValue(self::VALUE_INTEGRATION_NAME)); + $this->_integrationMock->expects($this->any()) + ->method('getEmail') + ->will($this->returnValue(self::VALUE_INTEGRATION_EMAIL)); + $this->_integrationMock->expects($this->any()) + ->method('getAuthentication') + ->will($this->returnValue('1')); + $this->_integrationMock->expects($this->any()) + ->method('getEndpoint') + ->will($this->returnValue(self::VALUE_INTEGRATION_ENDPOINT)); + } + + /** + * Create mock integration + * + * @param string $name + * @param int $integrationId + * @return mixed + */ + private function _getAnotherIntegrationMock( + $name = self::VALUE_INTEGRATION_NAME, + $integrationId = self::VALUE_INTEGRATION_ID + ) { + $integrationMock = $this->getMockBuilder('Magento\Integration\Model\Integration') + ->disableOriginalConstructor() + ->setMethods( + [ + 'getData', + 'getId', + 'getName', + 'getEmail', + 'getAuthentication', + 'getEndpoint', + 'load', + 'loadByName', + 'save', + '__wakeup' + ] + ) + ->getMock(); + $integrationMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue($integrationId)); + $integrationMock->expects($this->any()) + ->method('getName') + ->will($this->returnValue($name)); + $integrationMock->expects($this->any()) + ->method('getEmail') + ->will($this->returnValue(self::VALUE_INTEGRATION_EMAIL)); + $integrationMock->expects($this->any()) + ->method('getAuthentication') + ->will($this->returnValue('1')); + $integrationMock->expects($this->any()) + ->method('getEndpoint') + ->will($this->returnValue(self::VALUE_INTEGRATION_ENDPOINT)); + return $integrationMock; + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Log/Model/EntryPoint/ShellTest.php b/dev/tests/unit/testsuite/Magento/Log/App/ShellTest.php similarity index 64% rename from dev/tests/unit/testsuite/Magento/Log/Model/EntryPoint/ShellTest.php rename to dev/tests/unit/testsuite/Magento/Log/App/ShellTest.php index 604b2c0c76793cad77bdc44e65d9cc4913251054..c4f152e392378a35dada39a668178a10cf498ff1 100644 --- a/dev/tests/unit/testsuite/Magento/Log/Model/EntryPoint/ShellTest.php +++ b/dev/tests/unit/testsuite/Magento/Log/App/ShellTest.php @@ -21,38 +21,35 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Log\Model\EntryPoint; +namespace Magento\Log\App; class ShellTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Log\Model\EntryPoint\Shell + * @var \Magento\Log\App\Shell */ protected $_model; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_objectManagerMock; + protected $_shellFactoryMock; protected function setUp() { - $config = $this->getMock('Magento\Core\Model\Config\Primary', array(), array(), '', false); - $entryFileName = 'shell.php'; - $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); - $this->_model = new \Magento\Log\Model\EntryPoint\Shell($config, $entryFileName, $this->_objectManagerMock); + $this->_shellFactoryMock = $this->getMock('Magento\Log\Model\ShellFactory', + array('create'), array(), '', false); + $this->_model = new \Magento\Log\App\Shell('shell.php', $this->_shellFactoryMock); } public function testProcessRequest() { - $shellMock = $this->getMock('Magento\Log\Model\Shell', array(), array(), '', false); - - $this->_objectManagerMock->expects($this->once()) + $shellMock = $this->getMock('Magento\Log\App\Shell', array('run'), array(), '', false); + $this->_shellFactoryMock->expects($this->once()) ->method('create') - ->with('Magento\Log\Model\Shell', array('entryPoint' => 'shell.php')) + ->with(array('entryPoint' => 'shell.php')) ->will($this->returnValue($shellMock)); - $shellMock->expects($this->once())->method('run'); - $this->_model->processRequest(); + $this->assertEquals('0', $this->_model->execute()); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/LoggerTest.php b/dev/tests/unit/testsuite/Magento/Log/LoggerTest.php similarity index 60% rename from dev/tests/unit/testsuite/Magento/Core/Model/LoggerTest.php rename to dev/tests/unit/testsuite/Magento/Log/LoggerTest.php index 26794efde6b06fdf8dfdea575ad41dee68eae133..a75703c0fdfb93d8d7bd3c7830c81bfc2231c34f 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/LoggerTest.php +++ b/dev/tests/unit/testsuite/Magento/Log/LoggerTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Log; class LoggerTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Logger|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Logger|PHPUnit_Framework_MockObject_MockObject */ protected $_model = null; @@ -49,7 +49,7 @@ class LoggerTest extends \PHPUnit_Framework_TestCase mkdir($logDir, 0777, true); } - $this->_model = new \Magento\Core\Model\Logger($dirs, $this->_filesystemMock); + $this->_model = new \Magento\Logger($dirs, $this->_filesystemMock); $this->_loggersProperty = new \ReflectionProperty($this->_model, '_loggers'); $this->_loggersProperty->setAccessible(true); } @@ -96,41 +96,14 @@ class LoggerTest extends \PHPUnit_Framework_TestCase ); } - public function testInitForStore() - { - $config = $this->getMock('Magento\Core\Model\Config', array('getNode'), array(), '', false); - $config->expects($this->atLeastOnce()) - ->method('getNode') - ->with('global/log/core/writer_model') - ->will($this->returnValue('StdClass')); - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); - $store->expects($this->at(0))->method('getConfig')->with('dev/log/active')->will($this->returnValue(false)); - $store->expects($this->at(1))->method('getConfig')->with('dev/log/active')->will($this->returnValue(true)); - $store->expects($this->at(2))->method('getConfig')->with('dev/log/file')->will($this->returnValue('')); - $store->expects($this->at(3))->method('getConfig')->with('dev/log/exception_file')->will( - $this->returnValue('') - ); - $this->_model->initForStore($store, $config); - $this->assertFalse($this->_model->hasLog(\Magento\Core\Model\Logger::LOGGER_SYSTEM)); - $this->assertFalse($this->_model->hasLog(\Magento\Core\Model\Logger::LOGGER_EXCEPTION)); - $this->_model->initForStore($store, $config); - $this->assertTrue($this->_model->hasLog(\Magento\Core\Model\Logger::LOGGER_SYSTEM)); - $this->assertTrue($this->_model->hasLog(\Magento\Core\Model\Logger::LOGGER_EXCEPTION)); - } - /** * @covers \Magento\Core\Model\Logger::hasLog */ - public function testAddStoreLog() + public function testAddLogWithSpecificKey() { $this->_filesystemMock->expects($this->once())->method('checkAndCreateFolder'); - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); - $store->expects($this->at(0))->method('getConfig')->with('dev/log/active')->will($this->returnValue(false)); - $store->expects($this->at(1))->method('getConfig')->with('dev/log/active')->will($this->returnValue(true)); $key = uniqid(); - $this->_model->addStoreLog($key, $store); - $this->assertFalse($this->_model->hasLog($key)); - $this->_model->addStoreLog($key, $store); + $this->_model->addStreamLog($key); $this->assertTrue($this->_model->hasLog($key)); } @@ -149,7 +122,7 @@ class LoggerTest extends \PHPUnit_Framework_TestCase public function testLogComplex() { $this->expectOutputRegex('/Array\s\(\s+\[0\] => 1\s\).+stdClass Object/s'); - $this->_model->addStreamLog(\Magento\Core\Model\Logger::LOGGER_SYSTEM, 'php://output'); + $this->_model->addStreamLog(\Magento\Logger::LOGGER_SYSTEM, 'php://output'); $this->_model->log(array(1)); $this->_model->log(new \StdClass); } @@ -157,24 +130,24 @@ class LoggerTest extends \PHPUnit_Framework_TestCase public function testLogDebug() { $message = uniqid(); - /** @var $model \Magento\Core\Model\Logger|PHPUnit_Framework_MockObject_MockObject */ - $model = $this->getMock('Magento\Core\Model\Logger', array('log'), array(), '', false); + /** @var $model \Magento\Logger|PHPUnit_Framework_MockObject_MockObject */ + $model = $this->getMock('Magento\Logger', array('log'), array(), '', false); $model->expects($this->at(0))->method('log') - ->with($message, \Zend_Log::DEBUG, \Magento\Core\Model\Logger::LOGGER_SYSTEM); + ->with($message, \Zend_Log::DEBUG, \Magento\Logger::LOGGER_SYSTEM); $model->expects($this->at(1))->method('log') - ->with($message, \Zend_Log::DEBUG, \Magento\Core\Model\Logger::LOGGER_EXCEPTION); + ->with($message, \Zend_Log::DEBUG, \Magento\Logger::LOGGER_EXCEPTION); $model->logDebug($message); - $model->logDebug($message, \Magento\Core\Model\Logger::LOGGER_EXCEPTION); + $model->logDebug($message, \Magento\Logger::LOGGER_EXCEPTION); } public function testLogException() { $exception = new \Exception; $expected = "\n{$exception}"; - /** @var $model \Magento\Core\Model\Logger|PHPUnit_Framework_MockObject_MockObject */ - $model = $this->getMock('Magento\Core\Model\Logger', array('log'), array(), '', false); + /** @var $model \Magento\Logger|PHPUnit_Framework_MockObject_MockObject */ + $model = $this->getMock('Magento\Logger', array('log'), array(), '', false); $model->expects($this->at(0))->method('log') - ->with($expected, \Zend_Log::ERR, \Magento\Core\Model\Logger::LOGGER_EXCEPTION); + ->with($expected, \Zend_Log::ERR, \Magento\Logger::LOGGER_EXCEPTION); $model->logException($exception); } } diff --git a/dev/tests/unit/testsuite/Magento/Math/DivisionTest.php b/dev/tests/unit/testsuite/Magento/Math/DivisionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b184f6d957fbec190458e01f424d1259d9a664e9 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Math/DivisionTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Math; + +class DivisionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider getExactDivisionDataProvider + */ + public function testGetExactDivision($dividend, $divisor, $expected) + { + $mathDivision = new \Magento\Math\Division; + $remainder = $mathDivision->getExactDivision($dividend, $divisor); + $this->assertEquals($expected, $remainder); + } + + /** + * @return array + */ + public function getExactDivisionDataProvider() + { + return array( + array(17, 3 , 2), + array(7.7, 2 , 1.7), + array(17.8, 3.2 , 1.8), + array(11.7, 1.7 , 1.5), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Math/RandomTest.php b/dev/tests/unit/testsuite/Magento/Math/RandomTest.php new file mode 100644 index 0000000000000000000000000000000000000000..6760d5d6adffff2a37ccd919dc3240cc6f31af20 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Math/RandomTest.php @@ -0,0 +1,88 @@ +<?php +/** + * Test \Magento\Math\Random + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Math; + +class RandomTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param int $length + * @param string $chars + * + * @dataProvider getRandomStringDataProvider + */ + public function testGetRandomString($length, $chars = null) + { + $mathRandom = new \Magento\Math\Random; + $string = $mathRandom->getRandomString($length, $chars); + + $this->assertEquals($length, strlen($string)); + if ($chars !== null) { + $this->_assertContainsOnlyChars($string, $chars); + } + } + + public function getRandomStringDataProvider() + { + return array( + array(0), + array(10), + array(10, \Magento\Math\Random::CHARS_LOWERS), + array(10, \Magento\Math\Random::CHARS_UPPERS), + array(10, \Magento\Math\Random::CHARS_DIGITS), + array(10, \Magento\Math\Random::CHARS_SPECIALS), + array(10, \Magento\Math\Random::CHARS_PASSWORD_LOWERS), + array(10, \Magento\Math\Random::CHARS_PASSWORD_UPPERS), + array(10, \Magento\Math\Random::CHARS_PASSWORD_DIGITS), + array(10, \Magento\Math\Random::CHARS_PASSWORD_SPECIALS), + array(20, + \Magento\Math\Random::CHARS_LOWERS + . \Magento\Math\Random::CHARS_UPPERS + . \Magento\Math\Random::CHARS_DIGITS + ), + ); + } + + public function testGetUniqueHash() + { + $mathRandom = new \Magento\Math\Random; + $hashOne = $mathRandom->getUniqueHash(); + $hashTwo = $mathRandom->getUniqueHash(); + $this->assertTrue(is_string($hashOne)); + $this->assertTrue(is_string($hashTwo)); + $this->assertNotEquals($hashOne, $hashTwo); + } + + /** + * @param string $string + * @param string $chars + */ + protected function _assertContainsOnlyChars($string, $chars) + { + if (preg_match('/[^' . $chars . ']+/', $string, $matches)) { + $this->fail(sprintf('Unexpected char "%s" found', $matches[0])); + } + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/Converter/DomTest.php b/dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/DomTest.php old mode 100755 new mode 100644 similarity index 94% rename from dev/tests/unit/testsuite/Magento/App/Module/Declaration/Converter/DomTest.php rename to dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/DomTest.php index 77b35b2d723ca70aeca183cc44c348d75ab412b2..e0eb0a888ad14a13858fd5b28b5e1c7689c5c1fb --- a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/Converter/DomTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/DomTest.php @@ -21,18 +21,18 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module\Declaration\Converter; +namespace Magento\Module\Declaration\Converter; class DomTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\App\Module\Declaration\Converter\Dom + * @var \Magento\Module\Declaration\Converter\Dom */ protected $_converter; protected function setUp() { - $this->_converter = new \Magento\App\Module\Declaration\Converter\Dom(); + $this->_converter = new \Magento\Module\Declaration\Converter\Dom(); } public function testConvertWithValidDom() diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/Converter/_files/converted_valid_module.php b/dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/_files/converted_valid_module.php similarity index 100% rename from dev/tests/unit/testsuite/Magento/App/Module/Declaration/Converter/_files/converted_valid_module.php rename to dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/_files/converted_valid_module.php diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/Converter/_files/valid_module.xml b/dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/_files/valid_module.xml old mode 100755 new mode 100644 similarity index 100% rename from dev/tests/unit/testsuite/Magento/App/Module/Declaration/Converter/_files/valid_module.xml rename to dev/tests/unit/testsuite/Magento/Module/Declaration/Converter/_files/valid_module.xml diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolver/_files/app/code/Module/Four/etc/module.xml b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolver/_files/app/code/Module/Four/etc/module.xml old mode 100755 new mode 100644 similarity index 100% rename from dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolver/_files/app/code/Module/Four/etc/module.xml rename to dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolver/_files/app/code/Module/Four/etc/module.xml diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolver/_files/app/code/Module/One/etc/module.xml b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolver/_files/app/code/Module/One/etc/module.xml similarity index 100% rename from dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolver/_files/app/code/Module/One/etc/module.xml rename to dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolver/_files/app/code/Module/One/etc/module.xml diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolver/_files/app/code/Module/Three/etc/module.xml b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolver/_files/app/code/Module/Three/etc/module.xml old mode 100755 new mode 100644 similarity index 100% rename from dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolver/_files/app/code/Module/Three/etc/module.xml rename to dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolver/_files/app/code/Module/Three/etc/module.xml diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolver/_files/app/code/Module/Two/etc/module.xml b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolver/_files/app/code/Module/Two/etc/module.xml old mode 100755 new mode 100644 similarity index 100% rename from dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolver/_files/app/code/Module/Two/etc/module.xml rename to dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolver/_files/app/code/Module/Two/etc/module.xml diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolver/_files/app/etc/custom/module.xml b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolver/_files/app/etc/custom/module.xml similarity index 100% rename from dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolver/_files/app/etc/custom/module.xml rename to dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolver/_files/app/etc/custom/module.xml diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolverTest.php b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php similarity index 93% rename from dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolverTest.php rename to dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php index 8e258ee12da9c56b0e492f18d64a55ddee6b4c56..c8efc99b5a55888ca6952d6a0c972fd4db441422 100644 --- a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/FileResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module\Declaration; +namespace Magento\Module\Declaration; class FileResolverTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\App\Module\Declaration\FileResolver + * @var \Magento\Module\Declaration\FileResolver */ protected $_model; @@ -47,7 +47,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase $baseDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR .'code', ), ))); - $this->_model = new \Magento\App\Module\Declaration\FileResolver($applicationDirs); + $this->_model = new \Magento\Module\Declaration\FileResolver($applicationDirs); } public function testGet() diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/Reader/FilesystemTest.php b/dev/tests/unit/testsuite/Magento/Module/Declaration/Reader/FilesystemTest.php similarity index 89% rename from dev/tests/unit/testsuite/Magento/App/Module/Declaration/Reader/FilesystemTest.php rename to dev/tests/unit/testsuite/Magento/Module/Declaration/Reader/FilesystemTest.php index a0e57985a5aeffbde26caf42d20353db1304a5d8..02b4e71178684e0cc623fc99c9795a7f1298021f 100644 --- a/dev/tests/unit/testsuite/Magento/App/Module/Declaration/Reader/FilesystemTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Declaration/Reader/FilesystemTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module\Declaration\Reader; +namespace Magento\Module\Declaration\Reader; class FilesystemTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\App\Module\Declaration\Reader\Filesystem + * @var \Magento\Module\Declaration\Reader\Filesystem */ protected $_model; @@ -45,13 +45,13 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $baseDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR .'code', ), ))); - $fileResolver = new \Magento\App\Module\Declaration\FileResolver($applicationDirs); - $converter = new \Magento\App\Module\Declaration\Converter\Dom(); + $fileResolver = new \Magento\Module\Declaration\FileResolver($applicationDirs); + $converter = new \Magento\Module\Declaration\Converter\Dom(); $schemaLocatorMock = $this->getMock( - 'Magento\App\Module\Declaration\SchemaLocator', array(), array(), '', false + 'Magento\Module\Declaration\SchemaLocator', array(), array(), '', false ); $validationStateMock = $this->getMock('Magento\Config\ValidationStateInterface'); - $this->_model = new \Magento\App\Module\Declaration\Reader\Filesystem( + $this->_model = new \Magento\Module\Declaration\Reader\Filesystem( $fileResolver, $converter, $schemaLocatorMock, $validationStateMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Modules/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php similarity index 53% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/Modules/ReaderTest.php rename to dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php index 7b2ab85e130dfa113ac6a84ba339af2c048e51cf..2b6991f422dc4a8d0574aa06e742013b44d9c5a8 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Modules/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php @@ -24,14 +24,14 @@ */ /** - * Test class for \Magento\Core\Model\Config\Modules\File + * Test class for \Magento\Module\Dir\File */ -namespace Magento\Core\Model\Config\Modules; +namespace Magento\Module\Dir; class ReaderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_model; @@ -59,53 +59,16 @@ class ReaderTest extends \PHPUnit_Framework_TestCase { $this->_protFactoryMock = $this->getMock('Magento\Core\Model\Config\BaseFactory', array(), array(), '', false, false); - $this->_dirsMock = $this->getMock('Magento\App\Module\Dir', array(), array(), '', false, false); + $this->_dirsMock = $this->getMock('Magento\Module\Dir', array(), array(), '', false, false); $this->_baseConfigMock = $this->getMock('Magento\Core\Model\Config\Base', array(), array(), '', false, false); - $this->_moduleListMock = $this->getMock('Magento\App\ModuleListInterface'); + $this->_moduleListMock = $this->getMock('Magento\Module\ModuleListInterface'); - $this->_model = new \Magento\Core\Model\Config\Modules\Reader( + $this->_model = new \Magento\Module\Dir\Reader( $this->_dirsMock, - $this->_protFactoryMock, $this->_moduleListMock ); } - public function testLoadModulesConfiguration() - { - $modulesConfig = array('mod1' => array()); - $fileName = 'acl.xml'; - $this->_protFactoryMock->expects($this->exactly(2)) - ->method('create') - ->with($this->equalTo('<config/>')) - ->will($this->returnValue($this->_baseConfigMock)); - - $this->_moduleListMock->expects($this->once()) - ->method('getModules') - ->will($this->returnValue($modulesConfig)); - - $result = $this->_model->loadModulesConfiguration($fileName, null, null, array()); - $this->assertInstanceOf('Magento\Core\Model\Config\Base', $result); - } - - public function testLoadModulesConfigurationMergeToObject() - { - $fileName = 'acl.xml'; - $mergeToObject = $this->getMock('Magento\Core\Model\Config\Base', array(), array(), '', false, false); - $mergeModel = null; - $modulesConfig = array('mod1' => array()); - - $this->_moduleListMock->expects($this->once()) - ->method('getModules') - ->will($this->returnValue($modulesConfig)); - - $this->_protFactoryMock->expects($this->once()) - ->method('create') - ->with($this->equalTo('<config/>')) - ->will($this->returnValue($mergeToObject)); - - $this->_model->loadModulesConfiguration($fileName, $mergeToObject, $mergeModel); - } - public function testGetModuleDir() { $this->_dirsMock->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/App/Module/Dir/ReverseResolverTest.php b/dev/tests/unit/testsuite/Magento/Module/Dir/ReverseResolverTest.php similarity index 86% rename from dev/tests/unit/testsuite/Magento/App/Module/Dir/ReverseResolverTest.php rename to dev/tests/unit/testsuite/Magento/Module/Dir/ReverseResolverTest.php index f4e550ee4fd7d9676d1c2052f79b02b073d59c7c..fff7042cda769b6d7d0edbe22d83a9f695489794 100644 --- a/dev/tests/unit/testsuite/Magento/App/Module/Dir/ReverseResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Dir/ReverseResolverTest.php @@ -21,30 +21,30 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module\Dir; +namespace Magento\Module\Dir; class ReverseResolverTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\App\Module\Dir\ReverseResolver + * @var \Magento\Module\Dir\ReverseResolver */ protected $_model; /** - * @var \Magento\App\ModuleListInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Module\ModuleListInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_moduleList; /** - * @var \Magento\App\Module\Dir|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Module\Dir|\PHPUnit_Framework_MockObject_MockObject */ protected $_moduleDirs; protected function setUp() { - $this->_moduleList = $this->getMock('Magento\App\ModuleListInterface'); - $this->_moduleDirs = $this->getMock('Magento\App\Module\Dir', array(), array(), '', false, false); - $this->_model = new \Magento\App\Module\Dir\ReverseResolver($this->_moduleList, $this->_moduleDirs); + $this->_moduleList = $this->getMock('Magento\Module\ModuleListInterface'); + $this->_moduleDirs = $this->getMock('Magento\Module\Dir', array(), array(), '', false, false); + $this->_model = new \Magento\Module\Dir\ReverseResolver($this->_moduleList, $this->_moduleDirs); } /** diff --git a/dev/tests/unit/testsuite/Magento/App/Module/DirTest.php b/dev/tests/unit/testsuite/Magento/Module/DirTest.php similarity index 79% rename from dev/tests/unit/testsuite/Magento/App/Module/DirTest.php rename to dev/tests/unit/testsuite/Magento/Module/DirTest.php index b2fc7368dc9a33ac6a807a07d61d2310ec6f9850..889f5631738458f63475ad2e86db8db0d997fc28 100644 --- a/dev/tests/unit/testsuite/Magento/App/Module/DirTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/DirTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module; +namespace Magento\Module; class DirTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\App\Module\Dir + * @var \Magento\Module\Dir */ protected $_model; @@ -35,6 +35,11 @@ class DirTest extends \PHPUnit_Framework_TestCase */ protected $_applicationDirs; + /** + * @var \Magento\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_stringMock; + protected function setUp() { $this->_applicationDirs = $this->getMock('Magento\App\Dir', array(), array(), '', false, false); @@ -42,9 +47,12 @@ class DirTest extends \PHPUnit_Framework_TestCase ->expects($this->once()) ->method('getDir') ->with(\Magento\App\Dir::MODULES) - ->will($this->returnValue('app' . DIRECTORY_SEPARATOR . 'code')) - ; - $this->_model = new \Magento\App\Module\Dir($this->_applicationDirs); + ->will($this->returnValue('app' . DIRECTORY_SEPARATOR . 'code')); + + $this->_stringMock = $this->getMock('\Magento\Stdlib\String', array(), array(), '', false, false); + $this->_stringMock->expects($this->once())->method('upperCaseWords') + ->will($this->returnValue('Test' . DIRECTORY_SEPARATOR . 'Module')); + $this->_model = new \Magento\Module\Dir($this->_applicationDirs, $this->_stringMock); } public function testGetDirModuleRoot() diff --git a/dev/tests/unit/testsuite/Magento/App/Module/ResourceResolverTest.php b/dev/tests/unit/testsuite/Magento/Module/ResourceResolverTest.php similarity index 84% rename from dev/tests/unit/testsuite/Magento/App/Module/ResourceResolverTest.php rename to dev/tests/unit/testsuite/Magento/Module/ResourceResolverTest.php index 92b3566ea18578d34c83ff683036f8910ee4b1e6..5cf4e7b62cb6842279b56480054886d999975d5c 100644 --- a/dev/tests/unit/testsuite/Magento/App/Module/ResourceResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/ResourceResolverTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module; +namespace Magento\Module; class ResourceResolverTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\App\Module\ResourceResolver + * @var \Magento\Module\ResourceResolver */ protected $_model; @@ -37,9 +37,9 @@ class ResourceResolverTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_moduleReaderMock = $this->getMock('Magento\Core\Model\Config\Modules\Reader', + $this->_moduleReaderMock = $this->getMock('Magento\Module\Dir\Reader', array(), array(), '', false); - $this->_model = new \Magento\App\Module\ResourceResolver($this->_moduleReaderMock); + $this->_model = new \Magento\Module\ResourceResolver($this->_moduleReaderMock); } public function testGetResourceList() @@ -51,15 +51,16 @@ class ResourceResolverTest extends \PHPUnit_Framework_TestCase array( 'data', $moduleName, - __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/ResourceResolver/_files/Module/data'), + __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/_files/Module/data'), ), array( 'sql', $moduleName, - __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/ResourceResolver/_files/Module/sql'), + __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, '/_files/Module/sql'), ), ))); + $expectedResult = array('module_first_setup', 'module_second_setup'); $this->assertEquals($expectedResult, array_values($this->_model->getResourceList($moduleName))); } diff --git a/dev/tests/unit/testsuite/Magento/App/UpdaterTest.php b/dev/tests/unit/testsuite/Magento/Module/UpdaterTest.php similarity index 90% rename from dev/tests/unit/testsuite/Magento/App/UpdaterTest.php rename to dev/tests/unit/testsuite/Magento/Module/UpdaterTest.php index f2b763fe7ae0c713337df8d8c59067601f60e741..c02d213931cb9f3cfe709e75531b9578fab070ce 100644 --- a/dev/tests/unit/testsuite/Magento/App/UpdaterTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/UpdaterTest.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App; +namespace Magento\Module; class UpdaterTest extends \PHPUnit_Framework_TestCase { @@ -51,16 +51,16 @@ class UpdaterTest extends \PHPUnit_Framework_TestCase protected $_resourceSetupMock; /** - * @var \Magento\App\Updater + * @var \Magento\Module\Updater */ protected $_model; protected function setUp() { - $this->_factoryMock = $this->getMock('Magento\App\Updater\SetupFactory', array(), array(), '', false); + $this->_factoryMock = $this->getMock('Magento\Module\Updater\SetupFactory', array(), array(), '', false); $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); - $this->_moduleListMock = $this->getMock('Magento\App\ModuleListInterface'); - $this->_resourceResolver = $this->getMock('Magento\App\Module\ResourceResolverInterface'); + $this->_moduleListMock = $this->getMock('Magento\Module\ModuleListInterface'); + $this->_resourceResolver = $this->getMock('Magento\Module\ResourceResolverInterface'); $this->_resourceSetupMock = $this->getMock('Magento\Catalog\Model\Resource\Setup', array(), array(), '', false); $moduleList = array('Test_Module' => array()); @@ -79,7 +79,7 @@ class UpdaterTest extends \PHPUnit_Framework_TestCase ->with('catalog_setup', 'Test_Module') ->will($this->returnValue($this->_resourceSetupMock)); - $this->_model = new \Magento\App\Updater( + $this->_model = new \Magento\Module\Updater( $this->_factoryMock, $this->_appStateMock, $this->_moduleListMock, diff --git a/dev/tests/unit/testsuite/Magento/App/Module/ResourceResolver/_files/Module/data/module_second_setup/.gitignore b/dev/tests/unit/testsuite/Magento/Module/_files/Module/data/module_first_setup/.gitignore similarity index 100% rename from dev/tests/unit/testsuite/Magento/App/Module/ResourceResolver/_files/Module/data/module_second_setup/.gitignore rename to dev/tests/unit/testsuite/Magento/Module/_files/Module/data/module_first_setup/.gitignore diff --git a/dev/tests/unit/testsuite/Magento/App/Module/ResourceResolver/_files/Module/sql/module_first_setup/.gitignore b/dev/tests/unit/testsuite/Magento/Module/_files/Module/data/module_second_setup/.gitignore similarity index 100% rename from dev/tests/unit/testsuite/Magento/App/Module/ResourceResolver/_files/Module/sql/module_first_setup/.gitignore rename to dev/tests/unit/testsuite/Magento/Module/_files/Module/data/module_second_setup/.gitignore diff --git a/dev/tests/unit/testsuite/Magento/Module/_files/Module/sql/module_first_setup/.gitignore b/dev/tests/unit/testsuite/Magento/Module/_files/Module/sql/module_first_setup/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php b/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php index af9ea36720badf591b1733e2882cd06f933ec555..249b8c3e624e1144c77c05f419e4dc4ad42e8c62 100644 --- a/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php +++ b/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php @@ -76,10 +76,12 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $templateFactory = $this->getMock('Magento\Newsletter\Model\TemplateFactory'); $data = array('template_text' => 'template text'); + $filterManager = $this->getMock('\Magento\Filter\FilterManager', array(), array(), '', false); + /** @var \Magento\Newsletter\Model\Template $model */ $model = $this->getMock('Magento\Newsletter\Model\Template', array('_init'), array( $design, $context, $registry, $storeManager, $request, $filter, $storeConfig, $templateFactory, - $appEmulation, $data, + $appEmulation, $filterManager, $data, )); $result = $model->getProcessedTemplate(); diff --git a/dev/tests/unit/testsuite/Magento/Oauth/Helper/ServiceTest.php b/dev/tests/unit/testsuite/Magento/Oauth/Helper/ServiceTest.php index 1070c201b3ff8d2377dd002c334beff123a072b9..de6606c68273a98ec326ba19b3b07eb0af94063a 100644 --- a/dev/tests/unit/testsuite/Magento/Oauth/Helper/ServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Oauth/Helper/ServiceTest.php @@ -27,9 +27,6 @@ namespace Magento\Oauth\Helper; class ServiceTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Core\Helper\Data */ - protected $_coreHelper; - /** @var \Magento\Core\Helper\Context */ protected $_coreContextMock; @@ -47,15 +44,13 @@ class ServiceTest extends \PHPUnit_Framework_TestCase $this->_storeConfigMock = $this->getMockBuilder('Magento\Core\Model\Store\Config') ->disableOriginalConstructor() ->getMock(); - $this->_encryptorMock = $this->getMockBuilder('Magento\Core\Model\Encryption') + $this->_encryptorMock = $this->getMockBuilder('Magento\Encryption\Encryptor') ->disableOriginalConstructor() ->getMock(); $this->_coreHelper = new \Magento\Core\Helper\Data( $this->_coreContextMock, $this->getMockBuilder('Magento\Event\ManagerInterface')->disableOriginalConstructor()->getMock(), - $this->getMockBuilder('Magento\Core\Helper\Http')->disableOriginalConstructor()->getMock(), - $this->getMockBuilder('Magento\Core\Model\Config')->disableOriginalConstructor()->getMock(), $this->_storeConfigMock, $this->getMockBuilder('Magento\Core\Model\StoreManager')->disableOriginalConstructor()->getMock(), $this->getMockBuilder('Magento\Core\Model\Locale')->disableOriginalConstructor()->getMock(), @@ -65,15 +60,14 @@ class ServiceTest extends \PHPUnit_Framework_TestCase ); $this->_oauthHelper = new \Magento\Oauth\Helper\Service( - $this->_coreHelper, $this->_coreContextMock, - $this->_storeConfigMock + $this->_storeConfigMock, + new \Magento\Math\Random ); } protected function tearDown() { - unset($this->_coreHelper); unset($this->_coreContextMock); unset($this->_storeConfigMock); unset($this->_oauthHelper); diff --git a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php index ad1ae3d1340c06861cebed0dabe6d1f35811f6bc..507a614fe48009a141e260fa15589cef1b894435 100644 --- a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php +++ b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php @@ -23,7 +23,7 @@ */ return array( 'preferences' => array( - 'Magento\App\UpdaterInterface' => 'Magento\App\Updater', + 'Magento\Module\UpdaterInterface' => 'Magento\Module\Updaterter', 'Magento\Core\Model\AppInterface' => 'Magento\Core\Model\App\Proxy', ), diff --git a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml index e2e2fb34d8e42fa06d5ce60162c55da4a49ddb7d..2275c5209e96b8e112e6fb304ad24ec33e51b7df 100644 --- a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml +++ b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml @@ -25,11 +25,11 @@ --> <config> <!-- Comment within root node --> - <preference for="Magento\App\UpdaterInterface" type="Magento\App\Updater" /> + <preference for="Magento\Module\UpdaterInterface" type="Magento\Module\Updaterter" /> <preference for="Magento\Core\Model\AppInterface" type="Magento\Core\Model\App\Proxy" /> <type name="Magento\App\State"> <param name="mode"> - <value type="argument">Magento\Core\Model\App::PARAM_MODE</value> + <value type="argument">Magento\App\State::PARAM_MODE</value> </param> </type> <type name="Magento\Core\Model\Config_Modules"> diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php index 7bc7e0c49722a3de42797cca9032f75010f75ca8..e240f5aab683df107d3b8d17dc62e3920ab6240a 100644 --- a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php @@ -30,7 +30,7 @@ namespace Magento\Outbound\Formatter; class FactoryTest extends \PHPUnit_Framework_TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject \Magento\Core\Model\ObjectManager + * @var \PHPUnit_Framework_MockObject_MockObject \Magento\App\ObjectManager */ private $_mockObjectManager; diff --git a/dev/tests/unit/testsuite/Magento/Page/Block/Link/CurrentTest.php b/dev/tests/unit/testsuite/Magento/Page/Block/Link/CurrentTest.php index e76f251699bd5cc5e023638e89e5abfb2bd84326..8a6e52d57315b55f8f0839f0a2077707893ceccb 100644 --- a/dev/tests/unit/testsuite/Magento/Page/Block/Link/CurrentTest.php +++ b/dev/tests/unit/testsuite/Magento/Page/Block/Link/CurrentTest.php @@ -43,30 +43,26 @@ class CurrentTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_frontControllerMock; + protected $_coreHelperMock; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_coreHelperMock; + protected $_defaultPathMock; protected function setUp() { $this->_urlBuilderMock = $this->getMock('\Magento\UrlInterface'); $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); - $this->_frontControllerMock = $this->getMock('Magento\App\FrontController', array(), array(), '', false); $this->_coreHelperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $this->_contextMock = $this->getMock('Magento\Core\Block\Template\Context', array(), array(), '', false); - + $this->_defaultPathMock = $this->getMock('\Magento\App\DefaultPathInterface'); $this->_contextMock->expects($this->any()) ->method('getUrlBuilder') ->will($this->returnValue($this->_urlBuilderMock)); $this->_contextMock->expects($this->any()) ->method('getRequest') ->will($this->returnValue($this->_requestMock)); - $this->_contextMock->expects($this->any()) - ->method('getFrontController') - ->will($this->returnValue($this->_frontControllerMock)); } public function testGetUrl() @@ -79,7 +75,11 @@ class CurrentTest extends \PHPUnit_Framework_TestCase ->with($path) ->will($this->returnValue($url)); - $link = new \Magento\Page\Block\Link\Current($this->_coreHelperMock, $this->_contextMock); + $link = new \Magento\Page\Block\Link\Current( + $this->_coreHelperMock, + $this->_contextMock, + $this->_defaultPathMock + ); $link->setPath($path); $this->assertEquals($url, $link->getHref()); @@ -88,7 +88,11 @@ class CurrentTest extends \PHPUnit_Framework_TestCase public function testIsCurrentIfIsset() { - $link = new \Magento\Page\Block\Link\Current($this->_coreHelperMock, $this->_contextMock); + $link = new \Magento\Page\Block\Link\Current( + $this->_coreHelperMock, + $this->_contextMock, + $this->_defaultPathMock + ); $link->setCurrent(true); $this->assertTrue($link->IsCurrent()); } @@ -101,10 +105,9 @@ class CurrentTest extends \PHPUnit_Framework_TestCase $this->_requestMock->expects($this->once())->method('getModuleName')->will($this->returnValue('a')); $this->_requestMock->expects($this->once())->method('getControllerName')->will($this->returnValue('b')); $this->_requestMock->expects($this->once())->method('getActionName')->will($this->returnValue('d')); - - $this->_frontControllerMock->expects($this->once()) - ->method('getDefault') - ->will($this->returnValue(array('action' => 'd'))); + $this->_defaultPathMock->expects($this->atLeastOnce()) + ->method('getPart') + ->will($this->returnValue('d')); $this->_urlBuilderMock->expects($this->at(0))->method('getUrl')->with($path)->will($this->returnValue($url)); $this->_urlBuilderMock->expects($this->at(1)) @@ -112,7 +115,11 @@ class CurrentTest extends \PHPUnit_Framework_TestCase ->with('a/b') ->will($this->returnValue($url)); - $link = new \Magento\Page\Block\Link\Current($this->_coreHelperMock, $this->_contextMock); + $link = new \Magento\Page\Block\Link\Current( + $this->_coreHelperMock, + $this->_contextMock, + $this->_defaultPathMock + ); $link->setPath($path); $this->assertTrue($link->isCurrent()); } @@ -122,7 +129,11 @@ class CurrentTest extends \PHPUnit_Framework_TestCase $this->_urlBuilderMock->expects($this->at(0))->method('getUrl')->will($this->returnValue('1')); $this->_urlBuilderMock->expects($this->at(1))->method('getUrl')->will($this->returnValue('2')); - $link = new \Magento\Page\Block\Link\Current($this->_coreHelperMock, $this->_contextMock); + $link = new \Magento\Page\Block\Link\Current( + $this->_coreHelperMock, + $this->_contextMock, + $this->_defaultPathMock + ); $this->assertFalse($link->isCurrent()); } } diff --git a/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php index 37934711f36df022da7f5a7147c4e3a1f7521a76..b2cca77e31cbb03e99d0d05ca7e1cd953841f552 100644 --- a/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Persistent/Helper/DataTest.php @@ -29,7 +29,7 @@ class DataTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Core\Model\Config|PHPUnit_Framework_MockObject_MockObject */ - protected $_configMock; + protected $_modulesReader; /** * @var \Magento\Persistent\Helper\Data @@ -38,16 +38,22 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_configMock = $this->getMock('\Magento\Core\Model\Config', array(), array(), '', false); + $this->_modulesReader = $this->getMock( + '\Magento\Module\Dir\Reader', + array(), + array(), + '', + false + ); $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_helper = $objectManager->getObject('\Magento\Persistent\Helper\Data', array( - 'config' => $this->_configMock, + 'modulesReader' => $this->_modulesReader, )); } public function testGetPersistentConfigFilePath() { - $this->_configMock->expects($this->once())->method('getModuleDir') + $this->_modulesReader->expects($this->once())->method('getModuleDir') ->with('etc', 'Magento_Persistent') ->will($this->returnValue('path123')); $this->assertEquals('path123'. DS . 'persistent.xml', $this->_helper->getPersistentConfigFilePath()); diff --git a/dev/tests/unit/testsuite/Magento/Reports/Model/Resource/Report/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Reports/Model/Resource/Report/CollectionTest.php index 3d04b4722fbfdb1b56d98221f47b89192c168cff..5f9ba498a7881993ed992dac1c0f40a99f567cdf 100644 --- a/dev/tests/unit/testsuite/Magento/Reports/Model/Resource/Report/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Reports/Model/Resource/Report/CollectionTest.php @@ -38,7 +38,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase protected function setUp() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_factoryMock = $this->getMock('Zend_DateFactory', array('create'), array(), '', false); + $this->_factoryMock = $this->getMock('\Magento\Reports\Model\DateFactory', array('create'), array(), '', false); $arguments = array( 'dateFactory' => $this->_factoryMock, ); @@ -54,11 +54,10 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $startDateMock = $this->getMock('Zend_Date', array(), array(), '', false); $endDateMock = $this->getMock('Zend_Date', array(), array(), '', false); $map = array( - array(array('date' => $startDate), $startDateMock), - array(array('date' => $endDate), $endDateMock), + array($startDate, null, null, $startDateMock), + array($endDate, null, null, $endDateMock), ); $this->_factoryMock->expects($this->exactly(2))->method('create')->will($this->returnValueMap($map)); - $startDateMock->expects($this->once())->method('compare')->with($endDateMock)->will($this->returnValue(true)); $this->assertEquals(0, $this->_model->getSize()); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Totals/TaxTest.php b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Totals/TaxTest.php index 11242f34ae84794d8339c417ef727915335c0322..42774d7bfa7e106f9978791b2bdcffa5f36dd5dd 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Totals/TaxTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Totals/TaxTest.php @@ -70,7 +70,7 @@ class TaxTest extends \PHPUnit_Framework_TestCase 'taxItemFactory' => $taxItemFactory )); - $taxOrderFactory = $this->getMock('Magento\Tax\Model\Sales\Order\Tax\Factory', + $taxOrderFactory = $this->getMock('Magento\Tax\Model\Sales\Order\TaxFactory', array('create'), array(), '', false); return $objectManagerHelper->getConstructArguments( diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ReaderTest.php index 8c13e2a8e61d9f2399ea3aeffe80a5e4f335f153..f84789ce44cc1a877a39f13ff11870a0c90f51ec 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ReaderTest.php @@ -48,7 +48,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $schema = $this->getMockBuilder('Magento\Sales\Model\Config\SchemaLocator') ->disableOriginalConstructor() ->getMock(); - $validator = $this->getMockBuilder('Magento\Core\Model\Config\ValidationState') + $validator = $this->getMockBuilder('\Magento\Config\ValidationStateInterface') ->disableOriginalConstructor() ->getMock(); $this->_reader = new \Magento\Sales\Model\Config\Reader($fileResolver, $converter, $schema, $validator); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/SchemaLocatorTest.php index 10f8f2b445e626a48700e976fa70617a5fa1b547..4bec978daec2ac11a1c16679b3555eadf477295c 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/SchemaLocatorTest.php @@ -44,7 +44,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->_moduleReaderMock = $this->getMockBuilder('Magento\Core\Model\Config\Modules\Reader') + $this->_moduleReaderMock = $this->getMockBuilder('Magento\Module\Dir\Reader') ->disableOriginalConstructor() ->getMock(); $this->_moduleReaderMock->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php index f8d0acee4803f4cd9693c6a8f9d4d1210c960a5d..3e484c06628f7ba1038db3a7fe7eaef8d15dc091 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php @@ -44,7 +44,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase // Setup most constructor dependencies $paymentData = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); $coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $coreString = $this->getMock('Magento\Core\Helper\String', array(), array(), '', false); + $string = $this->getMock('Magento\Stdlib\String', array(), array(), '', false); $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); $translate = $this->getMock('Magento\Core\Model\Translate', array(), array(), '', false); $coreDir = $this->getMock('Magento\App\Dir', array(), array(), '', false); @@ -108,7 +108,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase // Test model /** @var \Magento\Sales\Model\Order\Pdf\AbstractPdf|\PHPUnit_Framework_MockObject_MockObject $model */ $model = $this->getMockForAbstractClass('Magento\Sales\Model\Order\Pdf\AbstractPdf', - array($paymentData, $coreData, $coreString, $coreStoreConfig, $translate, $coreDir, $shippingConfig, + array($paymentData, $coreData, $string, $coreStoreConfig, $translate, $coreDir, $shippingConfig, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory), '', true, false, true, array('drawLineBlocks') ); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/ReaderTest.php index 141874d0d6bf0f4ad8932330c3ec59af660f791f..74e86f31462f5b086592624913a2eff2a69c87b4 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/ReaderTest.php @@ -66,7 +66,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->_converter = $this->getMock('Magento\Sales\Model\Order\Pdf\Config\Converter', array('convert')); $moduleReader = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array('getModuleDir'), array(), '', false + 'Magento\Module\Dir\Reader', array('getModuleDir'), array(), '', false ); $moduleReader->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/SchemaLocatorTest.php index 3e5d4fd321c911e3239622240e3aba9fef00d48f..2ab59f291db592637c07ccdf3b5cf11225e3cec2 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Config/SchemaLocatorTest.php @@ -32,7 +32,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\Config\Modules\Reader|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Module\Dir\Reader|\PHPUnit_Framework_MockObject_MockObject */ protected $_moduleReader; @@ -44,7 +44,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_moduleReader = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array('getModuleDir'), array(), '', false + 'Magento\Module\Dir\Reader', array('getModuleDir'), array(), '', false ); $this->_moduleReader ->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php index a9fe51ce9b807bb4b76d650584bf89b73a87c004..0e363af9765f8ee3e855d965f1da6002d74a0eb0 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php @@ -40,7 +40,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase { $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); $coreHelperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $coreHelperStringMock = $this->getMock('Magento\Core\Helper\String', array(), array(), '', false, false); + $stringMock = $this->getMock('Magento\Stdlib\String', array(), array(), '', false, false); $storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false, false); $translateMock = $this->getMock('Magento\Core\Model\Translate', array(), array(), '', false, false); $coreDirMock = $this->getMock('Magento\App\Dir', array(), array(), '', false, false); @@ -63,7 +63,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase $this->_model = new \Magento\Sales\Model\Order\Pdf\Invoice( $paymentDataMock, $coreHelperMock, - $coreHelperStringMock, + $stringMock, $storeConfigMock, $translateMock, $coreDirMock, diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Resource/Report/RuleTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Resource/Report/RuleTest.php index fb2587a3c7c87b226a902406e4c1770f4839fd47..2d0036f809c3e153e3a202f0c145c00952b52235 100644 --- a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Resource/Report/RuleTest.php +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Resource/Report/RuleTest.php @@ -63,7 +63,7 @@ class RuleTest extends \PHPUnit_Framework_TestCase ->with($select) ->will($this->returnCallback(array($this, 'fetchAllCallback'))); - $resourceMock = $this->getMock('Magento\Core\Model\Resource', + $resourceMock = $this->getMock('Magento\App\Resource', array('getConnection', 'getTableName'), array(), '', false ); $resourceMock->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/Stdlib/ArrayUtilsTest.php b/dev/tests/unit/testsuite/Magento/Stdlib/ArrayUtilsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..c5b7bf2e0e950aa1fcecfed55a022a5d1fffde1d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Stdlib/ArrayUtilsTest.php @@ -0,0 +1,68 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Stdlib; + +/** + * Magento\Stdlib\ArrayUtilsTest test case + */ +class ArrayUtilsTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Stdlib\ArrayUtils + */ + protected $_arrayUtils; + + protected function setUp() + { + $this->_arrayUtils = new ArrayUtils(); + } + + /** + * @covers \Magento\Stdlib\ArrayUtils::ksortMultibyte + * @dataProvider ksortMultibyteDataProvider + */ + public function testKsortMultibyte($input, $locale) + { + $this->_arrayUtils->ksortMultibyte($input, $locale); + + $iterator = 0; + foreach ($input as $value) { + $iterator++; + $this->assertEquals($iterator, $value); + + } + } + + /** + * Data provider for ksortMultibyteDataProvider + * @todo implement provider with values which different depends on locale + */ + public function ksortMultibyteDataProvider() + { + return array( + array(array('б' => 2, 'в' => 3, 'а' => 1), 'ru_RU'), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/DateTest.php b/dev/tests/unit/testsuite/Magento/Stdlib/DateTimeTest.php similarity index 63% rename from dev/tests/unit/testsuite/Magento/DateTest.php rename to dev/tests/unit/testsuite/Magento/Stdlib/DateTimeTest.php index 6fe3a12e08f58217a956b788fc14ceb47548b1fe..01ec2f63a3d5a1c70eb6c3bc0290a3f7de590bd0 100644 --- a/dev/tests/unit/testsuite/Magento/DateTest.php +++ b/dev/tests/unit/testsuite/Magento/Stdlib/DateTimeTest.php @@ -26,27 +26,38 @@ */ /** - * \Magento\Date test case + * \Magento\Stdlib\DateTime test case */ -namespace Magento; +namespace Magento\Stdlib; -class DateTest extends \PHPUnit_Framework_TestCase +class DateTimeTest extends \PHPUnit_Framework_TestCase { + /** + * @var \Magento\Stdlib\DateTime + */ + protected $_dateTime; + + protected function setUp() + { + $this->_dateTime = new \Magento\Stdlib\DateTime; + } + public function testToTimestamp() { $date = new \Zend_Date(); - $this->assertEquals($date->getTimestamp(), \Magento\Date::toTimestamp($date)); + $dateTime = new \Magento\Stdlib\DateTime; + $this->assertEquals($date->getTimestamp(), $dateTime->toTimestamp($date)); - $this->assertEquals(time(), \Magento\Date::toTimestamp(true)); + $this->assertEquals(time(), $dateTime->toTimestamp(true)); $date = '2012-07-19 16:52'; - $this->assertEquals(strtotime($date), \Magento\Date::toTimestamp($date)); + $this->assertEquals(strtotime($date), $dateTime->toTimestamp($date)); } public function testNow() { - $this->assertEquals(date(\Magento\Date::DATE_PHP_FORMAT), \Magento\Date::now(true)); - $this->assertEquals(date(\Magento\Date::DATETIME_PHP_FORMAT), \Magento\Date::now(false)); + $this->assertEquals(date(\Magento\Stdlib\DateTime::DATE_PHP_FORMAT), $this->_dateTime->now(true)); + $this->assertEquals(date(\Magento\Stdlib\DateTime::DATETIME_PHP_FORMAT), $this->_dateTime->now(false)); } /** @@ -57,7 +68,8 @@ class DateTest extends \PHPUnit_Framework_TestCase */ public function testFormatDate($date, $includeTime, $expectedFormat, $expectedResult = null) { - $actual = \Magento\Date::formatDate($date, $includeTime); + $dateTime = new \Magento\Stdlib\DateTime; + $actual = $dateTime->formatDate($date, $includeTime); if ($expectedFormat != '') { $expectedResult = date($expectedFormat); } else { @@ -87,4 +99,31 @@ class DateTest extends \PHPUnit_Framework_TestCase 'Zend Date including Time' => array($date, true, date('Y-m-d H:i:s', $date->getTimestamp())), ); } + + /** + * @param string $date + * @param bool $expected + * + * @dataProvider isEmptyDateDataProvider + */ + public function testIsEmptyDate($date, $expected) + { + $actual = $this->_dateTime->isEmptyDate($date); + $this->assertEquals($actual, $expected); + } + + /** + * @return array + */ + public function isEmptyDateDataProvider() + { + return array( + array('', true), + array(' ', true), + array('0000-00-00', true), + array('0000-00-00 00:00:00', true), + array('2000-10-10', false), + array('2000-10-10 10:10:10', false), + ); + } } diff --git a/dev/tests/unit/testsuite/Magento/Stdlib/StringTest.php b/dev/tests/unit/testsuite/Magento/Stdlib/StringTest.php new file mode 100644 index 0000000000000000000000000000000000000000..72ccbd682bb351b0f0db0d4953cb853c6622e697 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Stdlib/StringTest.php @@ -0,0 +1,82 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Stdlib; + +/** + * Magento\Stdlib\StringTest test case + */ +class StringTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Stdlib\String + */ + protected $_string; + + protected function setUp() + { + $this->_string = new String(); + } + + /** + * @covers \Magento\Stdlib\String::__construct + * @covers \Magento\Stdlib\String::split + */ + public function testStrSplit() + { + $this->assertEquals(array(), $this->_string->split('')); + $this->assertEquals(array('1', '2', '3', '4'), $this->_string->split('1234', 1)); + $this->assertEquals(array('1', '2', ' ', '3', '4'), $this->_string->split('12 34', 1, false, true)); + $this->assertEquals(array( + '12345', '123', '12345', '6789' + ), $this->_string->split('12345 123 123456789', 5, true, true)); + } + + /** + * @covers \Magento\Stdlib\String::__construct + * @covers \Magento\Stdlib\String::splitInjection + */ + public function testSplitInjection() + { + $string = '1234567890'; + $this->assertEquals('1234 5678 90', $this->_string->splitInjection($string, 4)); + } + + /** + * @covers \Magento\Stdlib\String::cleanString + */ + public function testCleanString() + { + $string = '12345'; + $this->assertEquals($string, $this->_string->cleanString($string)); + } + + /** + * @covers \Magento\Stdlib\String::strpos + */ + public function testStrpos() + { + $this->assertEquals(1, $this->_string->strpos('123', 2)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/CompositeScannerTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/CompositeScannerTest.php index c5c62e6446d297377a415c89b80ac000f45153fc..8c0573ec7935bbffe913a4feb8fdc48e3faa1933 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/CompositeScannerTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/CompositeScannerTest.php @@ -54,21 +54,23 @@ class CompositeScannerTest extends \PHPUnit_Framework_TestCase $scannerPhp = $this->getMock('Magento\Tools\Di\Code\Scanner\ScannerInterface'); $scannerXml = $this->getMock('Magento\Tools\Di\Code\Scanner\ScannerInterface'); + $scannerPhpExpected = array('Model_OneProxy', 'Model_TwoFactory'); + $scannerXmlExpected = array('Model_OneProxy', 'Model_ThreeFactory'); $scannerPhp->expects($this->once()) ->method('collectEntities') ->with($phpFiles) - ->will($this->returnValue(array('Model_OneProxy', 'Model_TwoFactory'))); + ->will($this->returnValue($scannerPhpExpected)); $scannerXml->expects($this->once()) ->method('collectEntities') ->with($configFiles) - ->will($this->returnValue(array('Model_OneProxy', 'Model_ThreeFactory'))); + ->will($this->returnValue($scannerXmlExpected)); $this->_model->addChild($scannerPhp, 'php'); $this->_model->addChild($scannerXml, 'config'); $actual = $this->_model->collectEntities($files); - $expected = array('Model_OneProxy', 'Model_TwoFactory', 'Model_ThreeFactory'); + $expected = array($scannerPhpExpected, $scannerXmlExpected); $this->assertEquals($expected, array_values($actual)); } diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/PhpScannerTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/PhpScannerTest.php index b51912f25490bc1d8130f6a57a1968dc4b87cee9..a4444c50efef8e05170841b55c0c3cf8b117ea15 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/PhpScannerTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/PhpScannerTest.php @@ -21,8 +21,9 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Test\Tools\Di\Code\Scanner; +require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Helper/Test.php'; +require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/ElementFactory.php'; class PhpScannerTest extends \PHPUnit_Framework_TestCase { @@ -41,27 +42,41 @@ class PhpScannerTest extends \PHPUnit_Framework_TestCase */ protected $_testFiles = array(); + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_logMock; + protected function setUp() { - $this->_model = new \Magento\Tools\Di\Code\Scanner\PhpScanner(); + $this->_model = new \Magento\Tools\Di\Code\Scanner\PhpScanner( + $this->_logMock = $this->getMock('\Magento\Tools\Di\Compiler\Log\Log', array(), array(), '', false) + ); $this->_testDir = str_replace('\\', '/', realpath(__DIR__ . '/../../') . '/_files'); $this->_testFiles = array( - $this->_testDir . '/app/code/Magento/SomeModule/Helper/Test.php', - $this->_testDir . '/app/code/Magento/SomeModule/Model/Test.php', - $this->_testDir . '/app/bootstrap.php', + $this->_testDir . '/app/code/Magento/SomeModule/Helper/Test.php' ); } public function testCollectEntities() { - $actual = $this->_model->collectEntities($this->_testFiles); - $expected = array( - 'Magento\SomeModule\ElementFactory', - 'Magento\SomeModule\BlockFactory', - 'Magento\SomeModule\ModelFactory', - 'Magento\SomeModule\Model\BlockFactory', - 'Magento\Bootstrap\ModelFactory', - ); - $this->assertEquals($expected, $actual); + $this->_logMock + ->expects($this->at(0)) + ->method('add') + ->with( + 4, + 'Magento\SomeModule\Module\Factory', + 'Invalid Factory for nonexistent class Magento\SomeModule\Module in file ' . $this->_testFiles[0] + ); + $this->_logMock + ->expects($this->at(1)) + ->method('add') + ->with( + 4, + 'Magento\SomeModule\Element\Factory', + 'Invalid Factory declaration for class Magento\SomeModule\Element in file ' . $this->_testFiles[0] + ); + + $this->assertEquals(array(), $this->_model->collectEntities($this->_testFiles)); } } diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php index 919604d12c87431fc912e187f3337e66a7062b76..f95e43866ee6cbe49ef1f9ae260c3887b50dd2b2 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php @@ -36,6 +36,11 @@ class XmlScannerTest extends \PHPUnit_Framework_TestCase */ protected $_testDir; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_logMock; + /** * @var array */ @@ -43,27 +48,27 @@ class XmlScannerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_model = new \Magento\Tools\Di\Code\Scanner\XmlScanner(); + $this->_model = new \Magento\Tools\Di\Code\Scanner\XmlScanner( + $this->_logMock = $this->getMock('\Magento\Tools\Di\Compiler\Log\Log', array(), array(), '', false) + ); $this->_testDir = str_replace('\\', '/', realpath(__DIR__ . '/../../') . '/_files'); $this->_testFiles = array( $this->_testDir . '/app/code/Magento/SomeModule/etc/adminhtml/system.xml', $this->_testDir . '/app/code/Magento/SomeModule/etc/di.xml', - $this->_testDir . '/app/code/Magento/SomeModule/view/frontend/default.xml', - $this->_testDir . '/app/etc/di/config.xml' - + $this->_testDir . '/app/code/Magento/SomeModule/view/frontend/default.xml' ); } public function testCollectEntities() { + $className = 'Magento\Core\Model\Config\Invalidator\Proxy'; + $this->_logMock->expects($this->at(0))->method('add')->with(4, $className, + 'Invalid proxy class for ' . substr($className, 0, -5)); + $this->_logMock->expects($this->at(1))->method('add')->with(4, '\Magento\SomeModule\Model\Element\Proxy', + 'Invalid proxy class for ' . substr('\Magento\SomeModule\Model\Element\Proxy', 0, -5)); $actual = $this->_model->collectEntities($this->_testFiles); $expected = array( - 'Magento\Backend\Block\System\Config\Form\Fieldset\Modules\DisableOutput\Proxy', - 'Magento\Core\Model\App\Proxy', - 'Magento\Core\Model\Cache\Proxy', - 'Magento\Backend\Block\Menu\Proxy', - 'Magento\Core\Model\StoreManager\Proxy', - 'Magento\Core\Model\Layout\Factory', + 'Magento\Core\Model\App\Proxy' ); $this->assertEquals($expected, $actual); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DefaultClass.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Element.php similarity index 91% rename from dev/tests/unit/testsuite/Magento/Core/Model/DefaultClass.php rename to dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Element.php index a017a77092197d6b317d2ac3d16b1e51b89cf267..006f225bd9c5324ecd4f328afa74ae265bd52216 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DefaultClass.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Element.php @@ -1,7 +1,5 @@ <?php /** - * DefaultClass model test class - * * Magento * * NOTICE OF LICENSE @@ -23,9 +21,10 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\SomeModule; -class DefaultClass +class Element { -} + +} \ No newline at end of file diff --git a/app/code/Magento/Core/Model/EncryptionFactory.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/ElementFactory.php similarity index 63% rename from app/code/Magento/Core/Model/EncryptionFactory.php rename to dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/ElementFactory.php index fb58d683290843a04147749b7bb1d9de9509b88f..8c4adf57236a9832ed3ca643d163a7fa4bc144b6 100644 --- a/app/code/Magento/Core/Model/EncryptionFactory.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/ElementFactory.php @@ -18,19 +18,17 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; - -class EncryptionFactory +namespace Magento\SomeModule; +require_once __DIR__ . '/Element.php'; +class ElementFactory { /** - * @var \Magento\ObjectManager|null + * @var \Magento\ObjectManager */ - protected $_objectManager = null; + protected $_objectManager; /** * @param \Magento\ObjectManager $objectManager @@ -42,16 +40,12 @@ class EncryptionFactory /** * @param string $className - * @param array $arguments - * @return \Magento\Core\Model\EncryptionInterface - * @throws \InvalidArgumentException + * @param array $data + * @return mixed */ - public function create($className, array $arguments = array()) + public function create($className, array $data = array()) { - $encryption = $this->_objectManager->create($className, $arguments); - if (!$encryption instanceof \Magento\Core\Model\EncryptionInterface) { - throw new \InvalidArgumentException("'{$className}' don't implement \Magento\Core\Model\EncryptionInterface"); - } - return $encryption; + $instance = $this->_objectManager->create($className, $data); + return $instance; } } diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Helper/Test.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Helper/Test.php index eddf1302719996aa45d82bc233b4d892838f0831..8b294309e191d0e925126e3c7ca2abc00849e41b 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Helper/Test.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/Helper/Test.php @@ -34,22 +34,31 @@ class Test protected $_factory; /** - * @var \Magento\SomeModule\Element\Proxy\Factory + * @var \Magento\SomeModule\Element\Factory */ - protected $_proxy; + protected $_elementFactory; - public function __construct(\Magento\SomeModule\ElementFactory $factory, \Magento\SomeModule\Element\Proxy $proxy) - { + /** + * @var \Magento\SomeModule\ElementFactory + */ + protected $_newElementFactory; + + public function __construct( + \Magento\SomeModule\Module\Factory $factory, + \Magento\SomeModule\Element\Factory $elementFactory, + \Magento\SomeModule\ElementFactory $rightElementFactory + ) { $this->_factory = $factory; - $this->_proxy = $proxy; + $this->_elementFactory = $elementFactory; + $this->_newElementFactory = $rightElementFactory; } /** - * @param ModelFactory $factory + * @param \Magento\SomeModule\ElementFactory $factory * @param array $data */ - public function testHelper(ModelFactory $factory, array $data = array()) + public function testHelper(\Magento\SomeModule\ElementFactory $factory, array $data = array()) { - $factory->create('Magento\SomeModule\BlockFactory', array('data' => $data)); + $factory->create('\Magento\SomeModule\ElementFactory', array('data' => $data)); } } diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml index a2efb4c40807278776099f21852500b1bb6e8ba4..9721915a0a23badf1ca4444f7b5d0df4224c4947 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml @@ -25,9 +25,14 @@ --> <config> <preference for="Magento\Core\Model\AppInterface" type="Magento\Core\Model\App\Proxy" /> - <!--<preference for="Magento\Core\Model\Config\InvalidatorInterface" type="Magento\Core\Model\Config\Invalidator\Proxy" />--> - <preference for="Magento\Core\Model\CacheInterface" type="Magento\Core\Model\Cache\Proxy" /> + <preference for="Magento\Core\Model\Config\InvalidatorInterface" type="Magento\Core\Model\Config\Invalidator\Proxy" /> + <preference for="Magento\App\CacheInterface" type="Magento\Core\Model\Cache\Proxy" /> <virtualType name="custom_cache_instance" type="Magento\Core\Model\Cache"> <plugin name="tag" type="Magento\Core\Model\Cache\TagPlugin" /> </virtualType> + <type name="Magento\SomeModule\Model\Test"> + <param name="proxy"> + <instance type="\Magento\SomeModule\Model\Element\Proxy" /> + </param> + </type> </config> diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php index 565cebd7ed4f22b4432aa8179ee4187b847c80fc..36bae277bcc9e4bb03c35ef3c962c13a1a01b7d8 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php @@ -61,7 +61,7 @@ class CssTest extends \PHPUnit_Framework_TestCase $constructArguments = $objectManagerHelper->getConstructArguments( 'Magento\Theme\Block\Adminhtml\System\Design\Theme\Edit\Tab\Css', array( - 'formFactory' => $this->getMock('Magento\Data\Form\Factory', array(), array(), '', false), + 'formFactory' => $this->getMock('Magento\Data\FormFactory', array(), array(), '', false), 'objectManager' => $this->_objectManager, 'dirs' => new \Magento\App\Dir(__DIR__), 'uploaderService' => $this->getMock( diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/JsTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/JsTest.php index 7267972f60c296f54287647148e487eaf64bc859..36cc3f092bd70d7595df718eb80c584a667bdb62 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/JsTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/JsTest.php @@ -47,7 +47,7 @@ class JsTest extends \PHPUnit_Framework_TestCase $constructArguments = $objectManagerHelper->getConstructArguments( 'Magento\Theme\Block\Adminhtml\System\Design\Theme\Edit\Tab\Js', array( - 'formFactory' => $this->getMock('Magento\Data\Form\Factory', array(), array(), '', false), + 'formFactory' => $this->getMock('Magento\Data\FormFactory', array(), array(), '', false), 'objectManager' => $this->getMock('Magento\ObjectManager', array(), array(), '', false), 'urlBuilder' => $this->_urlBuilder ) diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/TabAbstractTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/TabAbstractTest.php index c90d3f4157603f39342fd4a23a2878b3a039715f..26bd23fb78c567f2fe225dce4c212174dbf7b4ab 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/TabAbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/TabAbstractTest.php @@ -39,7 +39,7 @@ class TabAbstractTest extends \PHPUnit_Framework_TestCase $this->_model = $this->getMockForAbstractClass( 'Magento\Theme\Block\Adminhtml\System\Design\Theme\Edit\AbstractTab', array( - $this->getMock('Magento\Data\Form\Factory', array(), array(), '', false), + $this->getMock('Magento\Data\FormFactory', array(), array(), '', false), $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false), $this->getMock('Magento\Backend\Block\Template\Context', array(), array(), '', false), $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false), diff --git a/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RoleTest.php b/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RoleTest.php index 820434dedc77c470eb44c098575f9dae7753c74a..d880f0771c239074e0cb59245280030971587227 100644 --- a/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RoleTest.php +++ b/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RoleTest.php @@ -56,7 +56,7 @@ class RoleTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_resourceMock = $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false, false); + $this->_resourceMock = $this->getMock('Magento\App\Resource', array(), array(), '', false, false); $this->_groupFactoryMock = $this->getMock('Magento\User\Model\Acl\Role\GroupFactory', array('create'), array(), '', false ); diff --git a/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RuleTest.php b/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RuleTest.php index 042d4336612b7fcaf69d7e8e78c73bcd165896a2..686423505db5d245ad05bb8855c4543ab1f46ad2 100644 --- a/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RuleTest.php +++ b/dev/tests/unit/testsuite/Magento/User/Model/Acl/Loader/RuleTest.php @@ -46,7 +46,7 @@ class RuleTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_resourceMock = $this->getMock('Magento\Core\Model\Resource', array(), array(), '', false, false); + $this->_resourceMock = $this->getMock('Magento\App\Resource', array(), array(), '', false, false); $this->_rootResourceMock = new \Magento\Core\Model\Acl\RootResource('Magento_Adminhtml::all'); $this->_model = new \Magento\User\Model\Acl\Loader\Rule( $this->_rootResourceMock, diff --git a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Decorator/ModuleDependencyTest.php b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Decorator/ModuleDependencyTest.php index 342eb3f6de3e1a2b1baab6edc59b5f690feac246..1fbf1fd9306361c435e326d0bc9872ab7f3c42cd 100644 --- a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Decorator/ModuleDependencyTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Decorator/ModuleDependencyTest.php @@ -56,7 +56,7 @@ class ModuleDependencyTest extends \PHPUnit_Framework_TestCase ); $this->_fileSource = $this->getMockForAbstractClass('Magento\View\Layout\File\SourceInterface'); - $this->_moduleListMock = $this->getMock('Magento\App\ModuleListInterface'); + $this->_moduleListMock = $this->getMock('Magento\Module\ModuleListInterface'); $this->_moduleListMock->expects($this->any())->method('getModules')->will($this->returnValue($modulesConfig)); $this->_model = new \Magento\View\Layout\File\Source\Decorator\ModuleDependency( $this->_fileSource, $this->_moduleListMock diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/ResourceTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/ResourceTest.php index d9f21469992f53ef3d9f0ba23f8469215b8b664e..d9a5df7ff5aa7446d0342837434e5136ec8d07f3 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/ResourceTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/ResourceTest.php @@ -41,7 +41,7 @@ class ResourceTest extends \PHPUnit_Framework_TestCase { $this->_ruleResource = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\Rule') ->disableOriginalConstructor() - ->setMethods(array('getResourceIdsByRole')) + ->setMethods(array('getResourceIdsByRole', '__wakeup')) ->getMock(); $rootResource = new \Magento\Core\Model\Acl\RootResource('Magento_Webapi'); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/EditTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/EditTest.php index 62a84a0f20da2b54e7f3b39b8acd993833570755..975d2519397d13d45c88f546768bcb94ac99c47d 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/EditTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/EditTest.php @@ -40,7 +40,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Helper\Data */ - protected $_coreData; + protected $_escaper; /** * @var \Magento\Webapi\Block\Adminhtml\Role\Edit @@ -50,6 +50,7 @@ class EditTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_urlBuilder = $this->getMockBuilder('Magento\Backend\Model\Url') + ->setMethods(array('getUrl')) ->disableOriginalConstructor() ->getMock(); @@ -62,26 +63,31 @@ class EditTest extends \PHPUnit_Framework_TestCase ->with('role_id') ->will($this->returnValue(1)); - $this->_coreData = $this->getMockBuilder('Magento\Core\Helper\Data') + $this->_escaper = $this->getMockBuilder('Magento\Escaper') ->disableOriginalConstructor() ->setMethods(array('escapeHtml')) ->getMock(); - $helperFactory = $this->getMockBuilder('Magento\Core\Model\Factory\Helper') + $context = $this->getMockBuilder('Magento\Backend\Block\Template\Context') ->disableOriginalConstructor() - ->setMethods(array('get')) + ->setMethods(array('getEscaper', 'getUrlBuilder', 'getRequest')) ->getMock(); - $helperFactory->expects($this->any()) - ->method('get') - ->with($this->equalTo('Magento\Core\Helper\Data')) - ->will($this->returnValue($this->_coreData)); + $context->expects($this->any()) + ->method('getEscaper') + ->will($this->returnValue($this->_escaper)); + + $context->expects($this->any()) + ->method('getUrlBuilder') + ->will($this->returnValue($this->_urlBuilder)); + + $context->expects($this->any()) + ->method('getRequest') + ->will($this->returnValue($this->_request)); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_block = $helper->getObject('Magento\Webapi\Block\Adminhtml\Role\Edit', array( - 'urlBuilder' => $this->_urlBuilder, - 'request' => $this->_request, - 'helperFactory' => $helperFactory, + 'context' => $context )); } @@ -123,7 +129,7 @@ class EditTest extends \PHPUnit_Framework_TestCase $apiRole->setId(1)->setRoleName('Test Role'); - $this->_coreData->expects($this->once()) + $this->_escaper->expects($this->once()) ->method('escapeHtml') ->with($apiRole->getRoleName()) ->will($this->returnArgument(0)); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/User/EditTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/User/EditTest.php index f5c0981c179b1b5f078e095c81f11ce1155e8edc..189829aebe69850cae066134425ed69ea456c292 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/User/EditTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/User/EditTest.php @@ -33,9 +33,9 @@ class EditTest extends \PHPUnit_Framework_TestCase protected $_request; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Helper\Data + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Escaper */ - protected $_coreData; + protected $_escaper; /** * @var \Magento\Webapi\Block\Adminhtml\User\Edit @@ -53,29 +53,36 @@ class EditTest extends \PHPUnit_Framework_TestCase ->with('user_id') ->will($this->returnValue(1)); - $this->_coreData = $this->getMockBuilder('Magento\Core\Helper\Data') + $this->_escaper = $this->getMockBuilder('Magento\Escaper') ->disableOriginalConstructor() ->setMethods(array('escapeHtml')) ->getMock(); - $helperFactory = $this->getMockBuilder('Magento\Core\Model\Factory\Helper') + $urlBuilder = $this->getMockBuilder('Magento\Backend\Model\Url') + ->setMethods(array('getUrl')) ->disableOriginalConstructor() - ->setMethods(array('get')) ->getMock(); - $helperFactory->expects($this->any()) - ->method('get') - ->with($this->equalTo('Magento\Core\Helper\Data')) - ->will($this->returnValue($this->_coreData)); - - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_block = $helper->getObject('Magento\Webapi\Block\Adminhtml\User\Edit', array( - // TODO: Remove injecting of 'urlBuilder' after MAGENTOTWO-5038 complete - 'urlBuilder' => $this->getMockBuilder('Magento\Backend\Model\Url') - ->disableOriginalConstructor() - ->getMock(), - 'request' => $this->_request, - 'helperFactory' => $helperFactory, + $context = $this->getMockBuilder('Magento\Backend\Block\Template\Context') + ->disableOriginalConstructor() + ->setMethods(array('getEscaper', 'getUrlBuilder', 'getRequest')) + ->getMock(); + + $context->expects($this->any()) + ->method('getEscaper') + ->will($this->returnValue($this->_escaper)); + + $context->expects($this->any()) + ->method('getUrlBuilder') + ->will($this->returnValue($urlBuilder)); + + $context->expects($this->any()) + ->method('getRequest') + ->will($this->returnValue($this->_request)); + + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_block = $objectManager->getObject('Magento\Webapi\Block\Adminhtml\User\Edit', array( + 'context' => $context )); } @@ -103,7 +110,7 @@ class EditTest extends \PHPUnit_Framework_TestCase $apiUser->setId(1)->setApiKey('test-api'); - $this->_coreData->expects($this->once()) + $this->_escaper->expects($this->once()) ->method('escapeHtml') ->with($apiUser->getApiKey()) ->will($this->returnArgument(0)); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php index d4dcea41061de0d23087ebf57dd1713d47fb1e13..22e7442c63df75fb89ea8dbd9a5e71386d17638d 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php @@ -36,7 +36,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Core\Model\App */ protected $_appMock; - /** @var \Magento\Core\Model\Logger */ + /** @var \Magento\Logger */ protected $_loggerMock; protected function setUp() @@ -50,7 +50,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $this->_loggerMock = $this->getMockBuilder('Magento\Core\Model\Logger') + $this->_loggerMock = $this->getMockBuilder('Magento\Logger') ->disableOriginalConstructor() ->getMock(); @@ -218,7 +218,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase return array( 'Magento\Service\ResourceNotFoundException' => array( new \Magento\Service\ResourceNotFoundException('Resource not found', 2345, null, - array('datail1' => 'value1'), 'resource10'), + array('datail1' => 'value1'), 'resourceNotFound', 'resource10'), \Magento\Webapi\Exception::HTTP_NOT_FOUND, 'Resource not found', 2345, @@ -226,7 +226,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase ), 'Magento_Service_ResourceNotFoundException (Empty message)' => array( new \Magento\Service\ResourceNotFoundException('', 2345, null, - array('datail1' => 'value1'), 'resource10'), + array('datail1' => 'value1'), 'resourceNotFound', 'resource10'), \Magento\Webapi\Exception::HTTP_NOT_FOUND, "Resource with ID 'resource10' not found.", 2345, @@ -238,6 +238,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase 345, null, array(), + 'authorization', 3, 4 ), @@ -247,7 +248,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase array('user_id' => 3, 'resource_id' => 4) ), 'Magento\Service\AuthorizationException (Empty message)' => array( - new \Magento\Service\AuthorizationException('', 345, null, array(), 3, 4), + new \Magento\Service\AuthorizationException('', 345, null, array(), 'authorization', 3, 4), \Magento\Webapi\Exception::HTTP_UNAUTHORIZED, "User with ID '3' is not authorized to access resource with ID '4'.", 345, diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php index 4e528b33df7b00660379a2f821fc20fd320ff0a3..53c28f37b9e78e80dc46158dbd7de42e170c0cc8 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php @@ -126,9 +126,6 @@ class RestTest extends \PHPUnit_Framework_TestCase $this->_responseMock->expects($this->any())->method('prepareResponse')->will($this->returnValue(array())); $this->_requestMock->expects($this->any())->method('getRequestData')->will($this->returnValue(array())); - /** Assert that response sendResponse method will be executed once. */ - $this->_responseMock->expects($this->once())->method('sendResponse'); - parent::setUp(); } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocatorTest.php index d3821412539ca6e64661d48d5da9ad7cddc172b6..7409022424dd4b697159a53de8ed892299fdadae 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocatorTest.php @@ -38,7 +38,7 @@ class SchemaLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_moduleReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Modules\Reader', array(), array(), '', false + 'Magento\Module\Dir\Reader', array(), array(), '', false ); $this->_moduleReaderMock->expects($this->once()) ->method('getModuleDir')->with('etc', 'Magento_Webapi')->will($this->returnValue('schema_dir')); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RoleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RoleTest.php index de08d16b286235496fc69487cab297051e894f59..8a2f99a9f2a3faea8db24fdd71512d0a5183dbb1 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RoleTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RoleTest.php @@ -53,7 +53,7 @@ class RoleTest extends \PHPUnit_Framework_TestCase $this->_roleService = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\Role') ->disableOriginalConstructor() - ->setMethods(array('getIdFieldName', 'getReadConnection')) + ->setMethods(array('getIdFieldName', 'getReadConnection', '__wakeup')) ->getMock(); $this->_roleService->expects($this->any()) @@ -78,7 +78,7 @@ class RoleTest extends \PHPUnit_Framework_TestCase { return $this->_helper->getObject('Magento\Webapi\Model\Acl\Role', array( 'eventDispatcher' => $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), - 'cacheManager' => $this->getMock('Magento\Core\Model\CacheInterface', array(), array(), '', false), + 'cacheManager' => $this->getMock('Magento\App\CacheInterface', array(), array(), '', false), 'resource' => $roleService, 'resourceCollection' => $serviceCollection )); @@ -103,7 +103,7 @@ class RoleTest extends \PHPUnit_Framework_TestCase $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); /** @var \PHPUnit_Framework_MockObject_MockObject $collection */ $collection = $this->getMock( diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RuleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RuleTest.php index 65d48c9752efe755afacececb3a28c54e37227be..3553d4dcb8405e9098eedef7e81e42aa8c20ec0c 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RuleTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RuleTest.php @@ -53,7 +53,7 @@ class RuleTest extends \PHPUnit_Framework_TestCase $this->_ruleResource = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\Rule') ->disableOriginalConstructor() - ->setMethods(array('saveResources', 'getIdFieldName', 'getReadConnection')) + ->setMethods(array('saveResources', 'getIdFieldName', 'getReadConnection', '__wakeup')) ->getMock(); $this->_ruleResource->expects($this->any()) @@ -78,7 +78,7 @@ class RuleTest extends \PHPUnit_Framework_TestCase { return $this->_helper->getObject('Magento\Webapi\Model\Acl\Rule', array( 'eventDispatcher' => $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), - 'cacheManager' => $this->getMock('Magento\Core\Model\CacheInterface', array(), array(), '', false), + 'cacheManager' => $this->getMock('Magento\App\CacheInterface', array(), array(), '', false), 'resource' => $ruleResource, 'resourceCollection' => $resourceCollection )); @@ -118,7 +118,7 @@ class RuleTest extends \PHPUnit_Framework_TestCase $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); /** @var \PHPUnit_Framework_MockObject_MockObject $collection */ $collection = $this->getMock( diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/User/RoleUpdaterTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/User/RoleUpdaterTest.php index 2b92ddd0155625d9111163520c7553035c35f4d7..39e93a96f109a28cc79202421ae1f6fdf08976d5 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/User/RoleUpdaterTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/User/RoleUpdaterTest.php @@ -42,7 +42,7 @@ class RoleUpdaterTest extends \PHPUnit_Framework_TestCase ))); $userModel = $this->getMockBuilder('Magento\Webapi\Model\Acl\User') - ->setMethods(array('getRoleId', 'load')) + ->setMethods(array('getRoleId', 'load', '__wakeup')) ->disableOriginalConstructor() ->getMock(); $userModel->expects($this->once())->method('load') diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/UserTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/UserTest.php index 30c183b6cf08c27ce24a5a9ca06aae6a59dfb47f..3ceb87771116d5ace37f439dba6c6ee0bf7509d4 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/UserTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/UserTest.php @@ -53,7 +53,7 @@ class UserTest extends \PHPUnit_Framework_TestCase $this->_userService = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\User') ->disableOriginalConstructor() - ->setMethods(array('getIdFieldName', 'getRoleUsers', 'load', 'getReadConnection')) + ->setMethods(array('getIdFieldName', 'getRoleUsers', 'load', 'getReadConnection', '__wakeup')) ->getMock(); $this->_userService->expects($this->any()) @@ -78,7 +78,7 @@ class UserTest extends \PHPUnit_Framework_TestCase { return $this->_helper->getObject('Magento\Webapi\Model\Acl\User', array( 'eventDispatcher' => $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), - 'cacheManager' => $this->getMock('Magento\Core\Model\CacheInterface', array(), array(), '', false), + 'cacheManager' => $this->getMock('Magento\App\CacheInterface', array(), array(), '', false), 'resource' => $userService, 'resourceCollection' => $serviceCollection )); @@ -149,7 +149,7 @@ class UserTest extends \PHPUnit_Framework_TestCase $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); /** @var \PHPUnit_Framework_MockObject_MockObject $collection */ $collection = $this->getMock( diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RoleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RoleTest.php index 2602270e3d2b9d42e8ba7d46a815b514bdc240ea..7a9f10ce4c016a8785de0c7cc380cafd764b6d0f 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RoleTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RoleTest.php @@ -55,7 +55,7 @@ class RoleTest extends \PHPUnit_Framework_TestCase $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_resourceModelMock = $this->getMock('Magento\Webapi\Model\Resource\Acl\Role', - array('getRolesIds'), array(), '', false); + array('getRolesIds', '__wakeup'), array(), '', false); $this->_roleFactory = $this->getMock('Magento\Webapi\Model\Authorization\Role\Factory', array('createRole'), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RuleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RuleTest.php index 5f9a1787cb7346aafb3e7ac5c56972229ec84e5b..f2a238264d42097a713c496324ccac939a616211 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RuleTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RuleTest.php @@ -50,7 +50,7 @@ class RuleTest extends \PHPUnit_Framework_TestCase $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_ruleResource = $this->getMock('Magento\Webapi\Model\Resource\Acl\Rule', - array('getRuleList'), array(), '', false); + array('getRuleList', '__wakeup'), array(), '', false); $this->_acl = $this->getMock('Magento\Acl', array('has', 'hasRole', 'allow'), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/ConverterTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ffbd0dbd29949066f0cde21b06091045eb254a14 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/ConverterTest.php @@ -0,0 +1,45 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Webapi\Model\Config; + +class ConverterTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Webapi\Model\Config\Converter + */ + protected $_model; + + public function setUp() + { + $this->_model = new \Magento\Webapi\Model\Config\Converter(); + } + + public function testConvert() + { + $inputData = new \DOMDocument(); + $inputData->load(__DIR__ . '/_files/webapi.xml'); + $expectedResult = require __DIR__ . '/_files/webapi.php'; + $this->assertEquals($expectedResult, $this->_model->convert($inputData)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.php new file mode 100644 index 0000000000000000000000000000000000000000..ab528f2622e07cb35a454a273df84ecaa23b9738 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.php @@ -0,0 +1,65 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +return array( + '\Magento\TestModule1\Service\AllSoapAndRestV1Interface' => array( + 'class' => '\Magento\TestModule1\Service\AllSoapAndRestV1Interface', + 'baseUrl' => '/V1/testmodule1', + 'methods' => array( + 'item' => array( + 'httpMethod' => 'GET', + 'method' => 'item', + 'route' => '/:id', + 'isSecure' => false + ) + ) + ), + '\Magento\TestModule1\Service\AllSoapAndRestV2Interface' => array( + 'class' => '\Magento\TestModule1\Service\AllSoapAndRestV2Interface', + 'baseUrl' => '/V2/testmodule1', + 'methods' => array( + 'item' => array( + 'httpMethod' => 'GET', + 'method' => 'item', + 'route' => '/:id', + 'isSecure' => false + ), + 'create' => array( + 'httpMethod' => 'POST', + 'method' => 'create', + 'route' => '', + 'isSecure' => false + ), + 'delete' => array( + 'httpMethod' => 'DELETE', + 'method' => 'delete', + 'route' => '/:id', + 'isSecure' => true + ), + ) + ), + '\Magento\TestModule1\Service\AllSoapAndRestV3Interface' => array( + 'class' => '\Magento\TestModule1\Service\AllSoapAndRestV3Interface', + 'methods' => array() + ), +); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.xml b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.xml new file mode 100644 index 0000000000000000000000000000000000000000..2ab43187f04b0c08853d71683c9122623fd2bb37 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <service class="\Magento\TestModule1\Service\AllSoapAndRestV1Interface" baseUrl="/V1/testmodule1"> + <rest-route httpMethod="GET" method="item">/:id</rest-route> + </service> + + <service class="\Magento\TestModule1\Service\AllSoapAndRestV2Interface" baseUrl="/V2/testmodule1"> + <rest-route httpMethod="GET" method="item">/:id</rest-route> + <rest-route httpMethod="POST" method="create"></rest-route> + <rest-route httpMethod="DELETE" method="delete" isSecure="true">/:id</rest-route> + </service> + + <service class="\Magento\TestModule1\Service\AllSoapAndRestV3Interface"/> +</config> diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/AbstractTest.php index 6ae97da246ca655b2ec6a60a3323100940316bf4..cf5cceef84e9ff5b7f8665bd60783096b3640e22 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/AbstractTest.php @@ -38,7 +38,7 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase protected $_objectManager; /** - * @var \Magento\Core\Model\Resource|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Resource|PHPUnit_Framework_MockObject_MockObject */ protected $_resource; diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RoleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RoleTest.php index 9603364f9d8808e90f2e1807e2ad45f898713261..c39b323879c8d816ea73ce1a3c0cc7a9dad72b59 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RoleTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RoleTest.php @@ -35,7 +35,7 @@ class RoleTest extends \Magento\Webapi\Model\Resource\Acl\AbstractTest */ protected function _createModel($selectMock = null) { - $this->_resource = $this->getMockBuilder('Magento\Core\Model\Resource') + $this->_resource = $this->getMockBuilder('Magento\App\Resource') ->disableOriginalConstructor() ->setMethods(array('getConnection', 'getTableName')) ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RuleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RuleTest.php index 1fa8dc66e4befb9808d8934686525f789254c698..dc5c59d30c886edf0a5bae9171192d7baa482910 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RuleTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RuleTest.php @@ -35,7 +35,7 @@ class RuleTest extends \Magento\Webapi\Model\Resource\Acl\AbstractTest */ protected function _createModel($selectMock = null) { - $this->_resource = $this->getMockBuilder('Magento\Core\Model\Resource') + $this->_resource = $this->getMockBuilder('Magento\App\Resource') ->disableOriginalConstructor() ->setMethods(array('getConnection', 'getTableName')) ->getMock(); @@ -150,7 +150,7 @@ class RuleTest extends \Magento\Webapi\Model\Resource\Acl\AbstractTest // Init rule resource. $ruleResource = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\Rule') ->disableOriginalConstructor() - ->setMethods(array('saveResources', 'getIdFieldName', 'getReadConnection', 'getResources')) + ->setMethods(array('saveResources', 'getIdFieldName', 'getReadConnection', 'getResources', '__wakeup')) ->getMock(); $ruleResource->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/UserTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/UserTest.php index 9abc8ede1402763cca88eecb003518035c4e4116..cb385823df3d2868e8d5c44f290657fd3da68019 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/UserTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/UserTest.php @@ -35,7 +35,7 @@ class UserTest extends \Magento\Webapi\Model\Resource\Acl\AbstractTest */ protected function _createModel($selectMock = null) { - $this->_resource = $this->getMockBuilder('Magento\Core\Model\Resource') + $this->_resource = $this->getMockBuilder('Magento\App\Resource') ->disableOriginalConstructor() ->setMethods(array('getConnection', 'getTableName')) ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php index deb72f4b1452d34426634bb5acead3ca7ab58024..fcdac66585cd6958cdbb509ccefe7706c6795370 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php @@ -35,22 +35,26 @@ class ConfigTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Webapi\Model\Soap\Config */ protected $_soapConfig; + /** @var \Magento\Webapi\Model\Config|\PHPUnit_Framework_MockObject_MockObject */ + protected $_configMock; + /** * Set up helper. */ protected function setUp() { - $objectManagerMock = $this->getMockBuilder('Magento\Core\Model\ObjectManager') + $objectManagerMock = $this->getMockBuilder('Magento\App\ObjectManager') ->disableOriginalConstructor() ->getMock(); $fileSystemMock = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); $dirMock = $this->getMockBuilder('Magento\App\Dir')->disableOriginalConstructor()->getMock(); - $configMock = $this->getMockBuilder('Magento\Webapi\Model\Config')->disableOriginalConstructor()->getMock(); + $this->_configMock = $this->getMockBuilder('Magento\Webapi\Model\Config') + ->disableOriginalConstructor()->getMock(); $this->_soapConfig = new \Magento\Webapi\Model\Soap\Config( $objectManagerMock, $fileSystemMock, $dirMock, - $configMock + $this->_configMock ); parent::setUp(); } @@ -86,4 +90,97 @@ class ConfigTest extends \PHPUnit_Framework_TestCase array('Magento\Catalog\Service\ProductV2Interface', true, array('CatalogProduct', 'V2')) ); } + + /** + * @expectedException \InvalidArgumentException + * @dataProvider dataProviderForTestGetServiceNamePartsInvalidName + */ + public function testGetServiceNamePartsInvalidName($interfaceClassName) + { + $this->_soapConfig->getServiceNameParts($interfaceClassName); + } + + public function dataProviderForTestGetServiceNamePartsInvalidName() + { + return array( + array('BarV1Interface'), // Missed vendor, module, 'Service' + array('Service\\V1Interface'), // Missed vendor and module + array('Magento\\Foo\\Service\\BarVxInterface'), // Version number should be a number + array('Magento\\Foo\\Service\\BarInterface'), // Version missed + array('Magento\\Foo\\Service\\BarV1'), // 'Interface' missed + array('Foo\\Service\\BarV1Interface'), // Module missed + array('Foo\\BarV1Interface'), // Module and 'Service' missed + ); + } + + public function testGetRequestedSoapServices() + { + $servicesConfig = array( + 'Magento\Module\Service\FooV1Interface' => array( + 'class' => 'Magento\Module\Service\FooV1Interface', + 'baseUrl' => '/V1/foo', + 'methods' => array( + 'someMethod' => array( + 'httpMethod' => 'GET', + 'method' => 'someMethod', + 'route' => '', + 'isSecure' => false + ) + ) + ), + 'Magento\Module\Service\BarV1Interface' => array( + 'class' => 'Magento\Module\Service\BarV1Interface', + 'baseUrl' => '/V1/bar', + 'methods' => array( + 'someMethod' => array( + 'httpMethod' => 'GET', + 'method' => 'someMethod', + 'route' => '', + 'isSecure' => false + ) + ) + ) + ); + + $expectedResult = array( + array( + 'methods' => array( + 'someMethod' => array( + 'method' => 'someMethod', + 'inputRequired' => '', + 'isSecure' => '' + ) + ), + 'class' => 'Magento\Module\Service\FooV1Interface' + ) + ); + + $this->_configMock->expects($this->once())->method('getServices')->will($this->returnValue($servicesConfig)); + $result = $this->_soapConfig->getRequestedSoapServices(array('moduleFooV1', 'moduleBarV2', 'moduleBazV1')); + $this->assertEquals($expectedResult, $result); + } +} + +namespace Magento\Module\Service; + +interface FooV1Interface +{ + public function someMethod(); +} + +interface BarV1Interface +{ + public function someMethod(); +} + +interface FooBarV1Interface +{ + public function someMethod(); +} + +namespace Magento\Module\Service\Foo; + +interface BarV1Interface +{ + public function someMethod(); } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php index 7a4ee844a767f3d200251d9d1153c861c537c43a..efc478e3751a145a7429e5d13dd5651562d05ea9 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php @@ -27,9 +27,14 @@ namespace Magento\Webapi\Model\Soap; class FaultTest extends \PHPUnit_Framework_TestCase { + const WSDL_URL = 'http://host.com/?wsdl&services=customerV1'; + /** @var \Magento\Core\Model\App */ protected $_appMock; + /** @var \Magento\Webapi\Model\Soap\Server */ + protected $_soapServerMock; + /** @var \Magento\Webapi\Model\Soap\Fault */ protected $_soapFault; @@ -51,7 +56,15 @@ class FaultTest extends \PHPUnit_Framework_TestCase \Magento\Webapi\Exception::HTTP_INTERNAL_ERROR, $details ); - $this->_soapFault = new \Magento\Webapi\Model\Soap\Fault($this->_appMock, $webapiException); + $this->_soapServerMock = $this->getMockBuilder('Magento\Webapi\Model\Soap\Server')->disableOriginalConstructor() + ->getMock(); + $this->_soapServerMock->expects($this->any())->method('generateUri')->will($this->returnValue(self::WSDL_URL)); + + $this->_soapFault = new \Magento\Webapi\Model\Soap\Fault( + $this->_appMock, + $this->_soapServerMock, + $webapiException + ); parent::setUp(); } @@ -65,9 +78,10 @@ class FaultTest extends \PHPUnit_Framework_TestCase public function testToXmlDeveloperModeOff() { $this->_appMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(false)); + $wsdlUrl = urlencode(self::WSDL_URL); $expectedResult = <<<XML <?xml version="1.0" encoding="utf-8" ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="http://magento.com"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="{$wsdlUrl}"> <env:Body> <env:Fault> <env:Code> @@ -77,22 +91,23 @@ class FaultTest extends \PHPUnit_Framework_TestCase <env:Text xml:lang="en">Soap fault reason.</env:Text> </env:Reason> <env:Detail> - <m:ErrorDetails> + <m:DefaultFault> <m:Parameters> <m:param1>value1</m:param1> <m:param2>2</m:param2> </m:Parameters> <m:Code>111</m:Code> - </m:ErrorDetails> + </m:DefaultFault> </env:Detail> </env:Fault> </env:Body> </env:Envelope> XML; + $actualXml = $this->_soapFault->toXml(); - $this->assertXmlStringEqualsXmlString( - $expectedResult, - $actualXml, + $this->assertEquals( + $this->_sanitizeXML($expectedResult), + $this->_sanitizeXML($actualXml), 'Wrong SOAP fault message with default parameters.' ); } @@ -121,7 +136,12 @@ XML; $faultCode, $additionalParameters ); - $this->assertXmlStringEqualsXmlString($expectedResult, $actualResult, $assertMessage); + $wsdlUrl = urlencode(self::WSDL_URL); + $this->assertEquals( + $this->_sanitizeXML(str_replace('{wsdl_url}', $wsdlUrl, $expectedResult)), + $this->_sanitizeXML($actualResult), + $assertMessage + ); } /** @@ -186,12 +206,14 @@ XML; ); $soapFault = new \Magento\Webapi\Model\Soap\Fault( $this->_appMock, + $this->_soapServerMock, $webapiException ); $actualXml = $soapFault->toXml(); + $wsdlUrl = urlencode(self::WSDL_URL); $expectedXml = <<<FAULT_XML <?xml version="1.0" encoding="utf-8" ?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="http://magento.com"> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="{$wsdlUrl}"> <env:Body> <env:Fault> <env:Code> @@ -201,18 +223,38 @@ XML; <env:Text xml:lang="en">{$message}</env:Text> </env:Reason> <env:Detail> - <m:ErrorDetails> + <m:DefaultFault> <m:Parameters> <m:param1>value1</m:param1> <m:param2>2</m:param2> </m:Parameters> <m:Code>{$code}</m:Code> - </m:ErrorDetails> + </m:DefaultFault> </env:Detail> </env:Fault> </env:Body> </env:Envelope> FAULT_XML; - $this->assertXmlStringEqualsXmlString($expectedXml, $actualXml, "Soap fault is invalid."); + + $this->assertEquals( + $this->_sanitizeXML($expectedXml), + $this->_sanitizeXML($actualXml), + "Soap fault is invalid." + ); + } + + /** + * Convert XML to string. + * + * @param string $xmlString + * @return string + */ + protected function _sanitizeXML($xmlString) + { + $dom = new \DOMDocument(1.0); + $dom->preserveWhiteSpace = false; + $dom->formatOutput = false; // Only useful for "pretty" output with saveXML() + $dom->loadXML($xmlString); // Must be done AFTER preserveWhiteSpace and formatOutput are set + return $dom->saveXML(); } } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/_files/soap_fault/soap_fault_expected_xmls.php b/dev/tests/unit/testsuite/Magento/Webapi/_files/soap_fault/soap_fault_expected_xmls.php index c98bb002f3881f2d89673be77d86b10757b0610c..a751db82cd6e475189a968fa4dc937c035645bfa 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/_files/soap_fault/soap_fault_expected_xmls.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/_files/soap_fault/soap_fault_expected_xmls.php @@ -26,7 +26,7 @@ return array( 'expectedResultArrayDataDetails' => '<?xml version="1.0" encoding="utf-8" ?> - <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="http://magento.com"> + <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="{wsdl_url}"> <env:Body> <env:Fault> <env:Code> @@ -36,10 +36,10 @@ return array( <env:Text xml:lang="en">Fault reason</env:Text> </env:Reason> <env:Detail> - <m:ErrorDetails> + <m:DefaultFault> <m:key1>value1</m:key1> <m:key2>value2</m:key2> - </m:ErrorDetails> + </m:DefaultFault> </env:Detail> </env:Fault> </env:Body> @@ -88,7 +88,7 @@ return array( </env:Envelope>', 'expectedResultComplexDataDetails' => '<?xml version = "1.0" encoding = "utf-8" ?> - <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="http://magento.com"> + <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="{wsdl_url}"> <env:Body> <env:Fault> <env:Code> @@ -98,11 +98,11 @@ return array( <env:Text xml:lang="en">Fault reason</env:Text> </env:Reason> <env:Detail> - <m:ErrorDetails> + <m:DefaultFault> <m:key> <m:sub_key>value</m:sub_key> </m:key> - </m:ErrorDetails> + </m:DefaultFault> </env:Detail> </env:Fault> </env:Body> diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/FormTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/FormTest.php index 5e14c3aa1898ee0728770029d80214024719b08e..58835ea62e9a47b675372ba4b5e536f16c42770c 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/FormTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/FormTest.php @@ -52,7 +52,7 @@ class FormTest extends \Magento\Test\Block\Adminhtml parent::setUp(); $this->_registry = new \Magento\Core\Model\Registry(); $this->_coreData = $this->_makeMock('Magento\Core\Helper\Data'); - $this->_formFactoryMock = $this->getMock('Magento\Data\Form\Factory', array('create'), + $this->_formFactoryMock = $this->getMock('Magento\Data\FormFactory', array('create'), array(), '', false, false); $this->_dataFormMock = $this->_makeMock('Magento\Data\Form'); diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Edit/FormTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Edit/FormTest.php index 80746bc834b04961b4c76961c002deca28db8f36..31b3dea7b7b14087a85076456a490f1cf0cac8d6 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Edit/FormTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Edit/FormTest.php @@ -61,7 +61,7 @@ class FormTest extends \Magento\Test\Block\Adminhtml public function testPrepareColumns() { - $this->_formFactoryMock = $this->getMock('Magento\Data\Form\Factory', array('create'), + $this->_formFactoryMock = $this->getMock('Magento\Data\FormFactory', array('create'), array(), '', false, false); $this->_registry = new \Magento\Core\Model\Registry(); $this->_coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/RegistrationTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/RegistrationTest.php index d4b772630f3e40d6cdcbf4b9952c4cfa0b4bbeb5..dfc83f0f4771f17a999fe38c7c08fc7241a0537d 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/RegistrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/RegistrationTest.php @@ -308,7 +308,7 @@ class RegistrationTest extends \PHPUnit_Framework_TestCase $this->_mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') ->disableOriginalConstructor() ->getMock(); - \Magento\Core\Model\ObjectManager::setInstance($this->_mockObjectManager); + \Magento\App\ObjectManager::setInstance($this->_mockObjectManager); } /** diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/SubscriptionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/SubscriptionTest.php index 4c350d715904dea12c126d63f357d56fb3f14ac4..7330729fef11a3a5bf206f5ffbc173ed18b46ef1 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/SubscriptionTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/SubscriptionTest.php @@ -534,7 +534,7 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase $this->_mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') ->disableOriginalConstructor() ->getMock(); - \Magento\Core\Model\ObjectManager::setInstance($this->_mockObjectManager); + \Magento\App\ObjectManager::setInstance($this->_mockObjectManager); } /** diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/EndpointTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/EndpointTest.php index 249cd8927be590294db4b1d5ead7a1573f657ff5..c2aa0c9a9cf5423962b628806b2a3f363e9cb92a 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/EndpointTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/EndpointTest.php @@ -75,13 +75,15 @@ class EndpointTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($mockWebhookUser)); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); // we have to use a mock because ancestor code utilizes deprecated static methods $this->_endpoint = $this->getMockBuilder('Magento\Webhook\Model\Endpoint') ->setConstructorArgs(array( $this->_mockContext, $coreRegistry, - $this->_mockUserFactory + $this->_mockUserFactory, + $dateTime )) ->setMethods(array('_init')) ->getMock(); @@ -131,6 +133,7 @@ class EndpointTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($mockEventManager)); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', array('formatDate'), array(), '', true); // we have to use a mock because ancestor code utilizes deprecated static methods $this->_endpoint = $this->getMockBuilder('Magento\Webhook\Model\Endpoint') @@ -138,6 +141,7 @@ class EndpointTest extends \PHPUnit_Framework_TestCase $this->_mockContext, $coreRegistry, $this->_mockUserFactory, + $dateTime )) ->setMethods( array('_init', '_getResource', 'hasAuthenticationType', 'setAuthenticationType', 'setUpdatedAt', @@ -164,7 +168,7 @@ class EndpointTest extends \PHPUnit_Framework_TestCase if ($hasDataChanges) { $someFormattedTime = '2013-07-10 12:35:28'; - $this->_mockResourceEndpnt->expects($this->once()) + $dateTime->expects($this->once()) ->method('formatDate') ->withAnyParameters() // impossible to predict what time() will be ->will($this->returnValue($someFormattedTime)); diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/EventTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/EventTest.php index 5d6eb4b7535ce27b9b202f1abbdbe4e805a839a1..cf17c8df5967a00e6e3f6486c25b37ad5d9b03ee 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/EventTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/EventTest.php @@ -44,6 +44,11 @@ class EventTest extends \PHPUnit_Framework_TestCase */ protected $_event; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Stdlib\DateTime + */ + protected $_dateTime; + protected function setUp() { $this->_mockContext = $this->getMockBuilder('Magento\Core\Model\Context') @@ -59,9 +64,10 @@ class EventTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($mockEventManager)); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $this->_dateTime = $this->getMock('Magento\Stdlib\DateTime', array('formatDate'), array(), '', true); $this->_event = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->setConstructorArgs(array($this->_mockContext, $coreRegistry)) + ->setConstructorArgs(array($this->_mockContext, $coreRegistry, $this->_dateTime)) ->setMethods( array('_init', 'isDeleted', 'isObjectNew', 'getId', '_hasModelChanged', '_getResource') ) @@ -77,15 +83,15 @@ class EventTest extends \PHPUnit_Framework_TestCase ->withAnyParameters() ->will($this->returnValue(true)); - $mockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Event') - ->disableOriginalConstructor() - ->getMock(); - - $mockResource->expects($this->any()) + $this->_dateTime->expects($this->atLeastOnce()) ->method('formatDate') ->with($this->equalTo(true)) ->will($this->returnValue(self::SOME_FORMATTED_TIME)); + $mockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Event') + ->disableOriginalConstructor() + ->getMock(); + // needed for 'save' method $mockResource->expects($this->once()) ->method('addCommitCallback') @@ -134,14 +140,15 @@ class EventTest extends \PHPUnit_Framework_TestCase ->withAnyParameters() ->will($this->returnValue(true)); - $mockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Event') - ->disableOriginalConstructor() - ->getMock(); - $mockResource->expects($this->any()) + $this->_dateTime->expects($this->atLeastOnce()) ->method('formatDate') ->with($this->equalTo(true)) ->will($this->returnValue(self::SOME_FORMATTED_TIME)); + $mockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Event') + ->disableOriginalConstructor() + ->getMock(); + // needed for 'save' method $mockResource->expects($this->once()) ->method('addCommitCallback') diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/JobTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/JobTest.php index f169685cf82930c3645aa04df483f2c0182683c8..175569742994f64f36baa302f86c7606685aacb1 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/JobTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/JobTest.php @@ -63,13 +63,15 @@ class JobTest extends \PHPUnit_Framework_TestCase ->getMock(); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') ->setConstructorArgs(array( $this->_mockEventFactory, $this->_mockSubscrFactory, $this->_mockContext, - $coreRegistry + $coreRegistry, + $dateTime )) ->setMethods(array('_init', 'save')) ->getMock(); @@ -101,12 +103,15 @@ class JobTest extends \PHPUnit_Framework_TestCase $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); + $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') ->setConstructorArgs(array( $this->_mockEventFactory, $this->_mockSubscrFactory, $this->_mockContext, $coreRegistry, + $dateTime, null, null, $data @@ -136,12 +141,15 @@ class JobTest extends \PHPUnit_Framework_TestCase $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); + $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') ->setConstructorArgs(array( $this->_mockEventFactory, $this->_mockSubscrFactory, $this->_mockContext, $coreRegistry, + $dateTime, null, null, $data @@ -173,12 +181,15 @@ class JobTest extends \PHPUnit_Framework_TestCase $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); + $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') ->setConstructorArgs(array( $this->_mockEventFactory, $this->_mockSubscrFactory, $this->_mockContext, $coreRegistry, + $dateTime, null, null, $data @@ -209,12 +220,15 @@ class JobTest extends \PHPUnit_Framework_TestCase $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); + $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') ->setConstructorArgs(array( $this->_mockEventFactory, $this->_mockSubscrFactory, $this->_mockContext, $coreRegistry, + $dateTime, null, null, $data @@ -245,12 +259,15 @@ class JobTest extends \PHPUnit_Framework_TestCase $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); + $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') ->setConstructorArgs(array( $this->_mockEventFactory, $this->_mockSubscrFactory, $this->_mockContext, $coreRegistry, + $dateTime, null, null, $data @@ -308,12 +325,15 @@ class JobTest extends \PHPUnit_Framework_TestCase { $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); + $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') ->setConstructorArgs(array( $this->_mockEventFactory, $this->_mockSubscrFactory, $this->_mockContext, - $coreRegistry + $coreRegistry, + $dateTime )) ->setMethods(array('_init', 'save', 'getRetryCount', 'setUpdatedAt', 'setStatus')) ->getMock(); @@ -342,12 +362,15 @@ class JobTest extends \PHPUnit_Framework_TestCase { $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); + $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') ->setConstructorArgs(array( $this->_mockEventFactory, $this->_mockSubscrFactory, $this->_mockContext, - $coreRegistry + $coreRegistry, + $dateTime, )) ->setMethods(array('_init', 'save', 'getRetryCount', 'setStatus')) ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/ObserverTest.php index d4d38bc5c57278c547176806b11dda4924d269de..b68955413fdd42472e9d32824d9702e6133f185a 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/ObserverTest.php @@ -45,7 +45,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase { $this->_webapiEventHandler = $this->_getBasicMock('Magento\Webhook\Model\Webapi\EventHandler'); $this->_subscriptionSet = $this->_getBasicMock('Magento\Webhook\Model\Resource\Subscription\Collection'); - $this->_logger = $this->_getBasicMock('Magento\Core\Model\Logger'); + $this->_logger = $this->_getBasicMock('Magento\Logger'); $this->_observer = new \Magento\Webhook\Model\Observer( $this->_webapiEventHandler, diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EndpointTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EndpointTest.php index 3cb8c7fc2c31307d81bebe89145f86f81c172d33..c28c2c2d3a2847d2519e9de0a137551bad9a658e 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EndpointTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EndpointTest.php @@ -69,7 +69,7 @@ class EndpointTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(1)); // Resources mock - $this->_resourceMock = $this->_makeMock('Magento\Core\Model\Resource'); + $this->_resourceMock = $this->_makeMock('Magento\App\Resource'); // Resources stubs $stubReturnMap = array( array('core_read', $this->_adapterMock), diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php index 128a7b9d3e5233ceab1a51ea3d505e97cf0421d2..4072a08393f690c8a93523c0acb047d9f87ff861 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php @@ -39,6 +39,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ->getMock(); /** @var \Magento\Core\Model\EntityFactory $entityFactory */ $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); + $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); $mockDBAdapter = $this->getMockBuilder('Magento\DB\Adapter\Pdo\Mysql') ->disableOriginalConstructor() @@ -50,10 +51,10 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $mockResourceEvent->expects($this->any()) ->method('getReadConnection') ->will($this->returnValue($mockDBAdapter)); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $collection = new \Magento\Webhook\Model\Resource\Event\Collection( - $eventManager, $logger, $mockFetchStrategy, $entityFactory, $mockResourceEvent + $eventManager, $logger, $mockFetchStrategy, $entityFactory, $dateTime, $mockResourceEvent ); $this->assertInstanceOf('Magento\Webhook\Model\Resource\Event\Collection', $collection); $this->assertEquals('Magento\Webhook\Model\Resource\Event', $collection->getResourceModelName()); diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EventTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EventTest.php index 90e1bf69338c613e2837b5f13a8cee5b514a7c0a..25eb322042b92edbcfaf8384f9e27599cbd6fa29 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EventTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EventTest.php @@ -34,7 +34,7 @@ class EventTest extends \PHPUnit_Framework_TestCase $tableName = 'webhook_event_table'; $idFieldName = 'event_id'; - $resourceMock = $this->getMockBuilder('Magento\Core\Model\Resource') + $resourceMock = $this->getMockBuilder('Magento\App\Resource') ->disableOriginalConstructor() ->getMock(); $resourceMock->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php index ec79757386f3e42adfad7907a79f4fee51e014e5..b927e29df75aa61ba1d67c526d211f8b134e8a7e 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php @@ -39,9 +39,10 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ->getMock(); /** @var \Magento\Core\Model\EntityFactory $entityFactory */ $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); + $dateTime = new \Magento\Stdlib\DateTime; $mockDBAdapter = $this->getMockBuilder('Magento\DB\Adapter\Pdo\Mysql') ->disableOriginalConstructor() - ->setMethods(array('_connect', '_quote')) + ->setMethods(array('_connect', '_quote', 'formatDate')) ->getMockForAbstractClass(); $mockResourceEvent = $this->getMockBuilder('Magento\Webhook\Model\Resource\Job') ->disableOriginalConstructor() @@ -49,10 +50,10 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $mockResourceEvent->expects($this->once()) ->method('getReadConnection') ->will($this->returnValue($mockDBAdapter)); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $collection = new \Magento\Webhook\Model\Resource\Job\Collection( - $eventManager, $logger, $mockFetchStrategy, $entityFactory, $mockResourceEvent + $eventManager, $logger, $mockFetchStrategy, $entityFactory, $dateTime, $mockResourceEvent ); $this->assertInstanceOf('Magento\Webhook\Model\Resource\Job\Collection', $collection); $this->assertEquals('Magento\Webhook\Model\Resource\Job', $collection->getResourceModelName()); diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/JobTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/JobTest.php index 7093f6b0b6f6aa0def14af7ba6d78b405373bc3f..532478df6418a3e055a8b948c2fb8b6fb642e2e7 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/JobTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/JobTest.php @@ -33,7 +33,7 @@ class JobTest extends \PHPUnit_Framework_TestCase { $tableName = 'webhook_dispatch_job_table'; $idFieldName = 'dispatch_job_id'; - $resourceMock = $this->getMockBuilder('Magento\Core\Model\Resource') + $resourceMock = $this->getMockBuilder('Magento\App\Resource') ->disableOriginalConstructor() ->getMock(); $resourceMock->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php index 52cec64b34fc515ab0dd344f370fd89c7d3d02d9..665476dd0343ecab4e49118bd49d2697a848bc51 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php @@ -60,13 +60,13 @@ class CollectionTest extends \PHPUnit_Framework_TestCase private $_eventManager; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ private $_loggerMock; protected function setUp() { - $this->_loggerMock = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $this->_loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); $this->_selectMock = $this->_makeMock('Zend_Db_Select'); $this->_selectMock->expects($this->any()) ->method('from') @@ -310,7 +310,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') ->disableOriginalConstructor() ->getMock(); - \Magento\Core\Model\ObjectManager::setInstance($mockObjectManager); + \Magento\App\ObjectManager::setInstance($mockObjectManager); return $mockObjectManager; } diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php index 733201eec4b623bbd253c12d0aa40bb8f1147aa8..5d516d00c1eee96c6d4ac67b9d8ba220bb310a99 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php @@ -54,7 +54,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($connectionMock)); /** @var \Magento\Core\Model\EntityFactory $entityFactory */ $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Core\Model\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); new \Magento\Webhook\Model\Resource\Subscription\Grid\Collection( $configMock, $endpointResMock, $eventManager, $logger, $fetchStrategyMock, $entityFactory, $resourceMock); } diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/SubscriptionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/SubscriptionTest.php index 1ea3d9090b8eaf9fd84df450561ce60457296306..664791975a70b8f10c53207eeb7404f5a1948361 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/SubscriptionTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/SubscriptionTest.php @@ -33,18 +33,6 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase const HOOK_TABLE_NAME = 'webhook_subscription_hook_table'; const SUBSCRIPTION_ID = '1'; - /** - * Contents of dummy config element - */ - const TOPICS_XML = - '<test> - <a> - <label>label</label> - </a> - <c> - <label>label</label> - </c> - </test>'; /** @var \PHPUnit_Framework_MockObject_MockObject */ private $_selectMock; @@ -67,7 +55,7 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_selectMock = $this->_makeMock('Magento\DB\Select'); - $this->_resourceMock = $this->_makeMock('Magento\Core\Model\Resource'); + $this->_resourceMock = $this->_makeMock('Magento\App\Resource'); $this->_adapterMock = $this->_makeMock('Magento\DB\Adapter\Pdo\Mysql'); $this->_adapterMock->expects($this->any()) ->method('select') @@ -75,8 +63,18 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($this->_selectMock)); // Config mock - $configMethods = array('getNode', 'setNode', 'getXpath', 'reinit'); - $this->_configMock = $this->getMock('Magento\Core\Model\ConfigInterface', $configMethods, array(), '', false); + $this->_configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false); + $configArray = array( + 'a' => array( + 'label' => 'label' + ), + 'c' => array( + 'label' => 'label' + ) + ); + $this->_configMock->expects($this->once()) + ->method('getWebhooks') + ->will($this->returnValue($configArray)); } /** @@ -137,11 +135,6 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase ->method('getData') ->with('topics') ->will($this->returnValue($newTopics)); - $configElement = new \Magento\Core\Model\Config\Element(self::TOPICS_XML); - $this->_configMock->expects($this->once()) - ->method('getNode') - ->will($this->returnValue($configElement)); - // Adapter stubs $this->_adapterMock->expects($this->once()) ->method('delete') diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/Pkg.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/Pkg.php index 79e249170c3fa53bf29c92ffe3c6fc91cc9bc240..382bf2d79f210c4bb9e76b8b9636c7b4ba908d69 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/Pkg.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/Pkg.php @@ -37,20 +37,22 @@ class Pkg extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_mockConfig; - /** @var \Magento\Core\Model\Config\Element */ + /** @var array() */ protected $_modelConfigElement; protected function setUp() { $label = self::CONFIG_LABEL; $status = self::CONFIG_STATUS; - $this->_modelConfigElement = new \Magento\Core\Model\Config\Element( - "<types><type><status>{$status}</status><label>{$label}</label></type></types>" + $this->_modelConfigElement = array( + 'type' => array( + 'status' => $status, + 'label' => $label + ) ); - $this->_mockConfig = $this->getMockBuilder('Magento\Core\Model\Config') - ->disableOriginalConstructor()->getMock(); + $this->_mockConfig = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false); $this->_mockConfig->expects($this->any()) - ->method('getNode') + ->method('getWebhooks') ->will($this->returnValue($this->_modelConfigElement)); } diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php index 43b21ecbd0e588d91f5dcc480474a15854b2da62..bb335fd42a5112c3acea02fe4695eecf2407666e 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php @@ -29,46 +29,6 @@ namespace Magento\Webhook\Model\Subscription; class ConfigTest extends \PHPUnit_Framework_TestCase { - - /** - * String constants representing XML strings to be used in stub config element. - * - * Single-quotes are used because phpcs does not handle heredocs well. - */ - const SETTING_NAME_XML = - '<xml> - <setting_name> - <name>Extension Name</name> - </setting_name> - </xml>'; - - const NAME_MISSING_XML = - '<xml> - <name_missing> - <!-- Missing name on purpose --> - </name_missing> - </xml>'; - - const EXISTING_SUBSCRIPTION = - '<xml> - <setting_name_on_existing_subscription> - <name>Extension Name</name> - <topics> - <topic_one> - <subcall/> - </topic_one> - </topics> - </setting_name_on_existing_subscription> - </xml>'; - - const AUTHENTICATION_TYPE = - '<xml> - <setting_authentication_type> - <name>Extension Name</name> - <authentication_type>HMAC</authentication_type> - </setting_authentication_type> - </xml>'; - /** @var \Magento\Webhook\Model\Subscription\Config that is also our unit under test */ protected $_config; @@ -92,11 +52,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_mockSubscription = $this->_createMockSubscription(); } - - public function testSettingNameNewSubscription() { - $configNode = $this->_createStubConfigElement(self::SETTING_NAME_XML); // Set expectations $this->_mockSubscription->expects($this->atLeastOnce()) @@ -105,7 +62,12 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->method('setName') ->with($this->equalTo('Extension Name')); - $this->_stubMock($configNode); + $settingNameXml = + array( + 'setting_name' => + array('name' => 'Extension Name') + ); + $this->_stubMock($settingNameXml); // Run test $this->_config->updateSubscriptionCollection(); @@ -113,8 +75,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testNameMissing() { - $configNode = $this->_createStubConfigElement(self::NAME_MISSING_XML); - // Set expectations $this->_mockSubscription->expects($this->never()) ->method('save'); @@ -125,7 +85,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase __("Invalid config data for subscription '%1'.", 'name_missing'), ); - $this->_stubMock($configNode, null, $expectedErrors); + $nameMissingXml = array('name_missing' => array()); + $this->_stubMock($nameMissingXml, null, $expectedErrors); // Run test $this->_config->updateSubscriptionCollection(); @@ -140,7 +101,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $existingSubscription->expects($this->once()) ->method('setName'); - $configNode = $this->_createStubConfigElement(self::EXISTING_SUBSCRIPTION); // Set expectations $this->_mockSubscription->expects($this->never()) @@ -154,7 +114,16 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ) ); - $this->_stubMock($configNode, $subxCollection); + $existingArray = array( + 'setting_name_on_existing_subscription' => + array( + 'name' => 'Extension Name', + 'topics' => array( + 'topic_one' => array('subcall') + ) + ) + ); + $this->_stubMock($existingArray, $subxCollection); // Run test $this->_config->updateSubscriptionCollection(); @@ -162,7 +131,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testSettingAuthenticationType() { - $configNode = $this->_createStubConfigElement(self::AUTHENTICATION_TYPE); // Set expectations $this->_mockSubscription->expects($this->atLeastOnce()) @@ -174,7 +142,12 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->method('setAuthenticationType') ->with($this->equalTo('HMAC')); - $this->_stubMock($configNode); + $authentificationType = array( + 'setting_authentication_type' => + array('name' => 'Extension Name', + 'authentication_type' => 'HMAC') + ); + $this->_stubMock($authentificationType); // Run test $this->_config->updateSubscriptionCollection(); @@ -205,17 +178,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase return $mock; } - /** - * Creates stub config element given a fragment of valid xml string - * - * @param string $xmlString - * @return \Magento\Core\Model\Config\Element - */ - protected function _createStubConfigElement($xmlString) - { - return new \Magento\Core\Model\Config\Element($xmlString); - } - /** * Initializes a set of mocks and stubs * @@ -231,7 +193,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $this->_mockMageConfig = $this->getMockBuilder('Magento\Core\Model\Config') + $this->_mockMageConfig = $this->getMockBuilder('\Magento\Webhook\Model\Config') ->disableOriginalConstructor() ->getMock(); @@ -239,7 +201,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $this->_mockLogger = $this->getMockBuilder('Magento\Core\Model\Logger') + $this->_mockLogger = $this->getMockBuilder('Magento\Logger') ->disableOriginalConstructor() ->getMock(); @@ -255,10 +217,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->with($this->equalTo(new \Magento\Webhook\Exception(implode("\n", $expectedErrors)))); } - // Stub getNode $this->_mockMageConfig->expects($this->any()) - ->method('getNode') - ->with($this->equalTo(\Magento\Webhook\Model\Subscription\Config::XML_PATH_SUBSCRIPTIONS)) + ->method('getSubscriptions') ->will($this->returnValue($configNode)); // Get or set subscription collection mock diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/SubscriptionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/SubscriptionTest.php index 15457f0dc6a9a3bdda9621743d20ef46661989c1..565ed6c92bb52a6347fd88257e767c1bb64aa9b9 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/SubscriptionTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/SubscriptionTest.php @@ -49,7 +49,7 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase { $this->_mockEndpoint = $this->getMockBuilder('Magento\Webhook\Model\Endpoint') ->setMethods(array('_init', 'save', 'setEndpointId', 'getId', 'getUser', '_getResource', 'delete', - 'load', 'hasDataChanges')) + 'load', 'hasDataChanges', '__wakeup')) ->disableOriginalConstructor() ->getMock(); @@ -75,10 +75,11 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($mockEventDispatcher)); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = new \Magento\Stdlib\DateTime; $this->_subscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') ->setMethods(array('_init', '_hasModelChanged', '_getResource')) - ->setConstructorArgs(array($this->_mockEndpoint, $this->_mockContext, $coreRegistry)) + ->setConstructorArgs(array($this->_mockEndpoint, $this->_mockContext, $coreRegistry, $dateTime)) ->getMock(); $subscriptionResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription') @@ -111,9 +112,12 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase public function testFindRestrictedTopicsWithNoUser() { + $dateTime = new \Magento\Stdlib\DateTime; // The only way to override a pre-existing implementation is to create a new object $this->_mockEndpoint = $this->getMockBuilder('Magento\Webhook\Model\Endpoint') - ->setMethods(array('_init', 'save', 'setEndpointId', 'getId', 'getUser', '_getResource', 'delete')) + ->setMethods(array( + '__wakeup', '_init', 'save', 'setEndpointId', 'getId', 'getUser', '_getResource', 'delete' + )) ->disableOriginalConstructor() ->getMock(); @@ -125,7 +129,7 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase $this->_subscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') ->setMethods(array('_init', '_hasModelChanged', '_getResource')) - ->setConstructorArgs(array($this->_mockEndpoint, $this->_mockContext, $coreRegistry)) + ->setConstructorArgs(array($this->_mockEndpoint, $this->_mockContext, $coreRegistry, $dateTime)) ->getMock(); $this->_subscription->setTopics(array('restricted', 'allowed')); @@ -138,6 +142,7 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase public function testAfterDelete() { $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = new \Magento\Stdlib\DateTime; // it's useful to mock out more methods for the purposes of testing this one method $this->_subscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') @@ -146,7 +151,7 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase 'setRegistrationMechanism', 'getEndpointId', 'setEndpointId', 'setUpdatedAt', 'hasDataChanges', '_init', '_hasModelChanged', '_getResource') ) - ->setConstructorArgs(array($this->_mockEndpoint, $this->_mockContext, $coreRegistry)) + ->setConstructorArgs(array($this->_mockEndpoint, $this->_mockContext, $coreRegistry, $dateTime)) ->getMock(); $mockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription') @@ -176,6 +181,7 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase public function testBeforeSave($hasRegiMechanism, $hasEndpointChanges, $hasEndpointId, $hasDataChanges) { $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $dateTime = $this->getMock('\Magento\Stdlib\DateTime', array('formatDate')); // it's useful to mock out more methods for the purposes of testing this one method $this->_subscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') @@ -183,7 +189,7 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase array('hasStatus', 'setStatus', 'hasRegistrationMechanism', 'setRegistrationMechanism', 'getEndpointId', 'setEndpointId', 'setUpdatedAt', 'hasDataChanges', '_init', '_hasModelChanged', '_getResource') ) - ->setConstructorArgs(array($this->_mockEndpoint, $this->_mockContext, $coreRegistry)) + ->setConstructorArgs(array($this->_mockEndpoint, $this->_mockContext, $coreRegistry, $dateTime)) ->getMock(); $mockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription') @@ -209,7 +215,7 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase $this->_expectEndpointOrId($hasEndpointChanges, $hasEndpointId); - $this->_expectSubscriptionHasDataChanges($hasDataChanges, $mockResource); + $this->_expectSubscriptionHasDataChanges($hasDataChanges, $dateTime); $this->assertEquals($this->_subscription, $this->_subscription->save()); } @@ -293,16 +299,16 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase * Mock out the subscription depending on whether or not it will have data changes * * @param $hasDataChanges - * @param $mockResource + * @param $dateTime */ - protected function _expectSubscriptionHasDataChanges($hasDataChanges, $mockResource) + protected function _expectSubscriptionHasDataChanges($hasDataChanges, $dateTime) { $this->_subscription->expects($this->once()) ->method('hasDataChanges') ->will($this->returnValue($hasDataChanges)); if ($hasDataChanges) { $someFormattedTime = '2013-07-10 12:35:28'; - $mockResource->expects($this->once()) + $dateTime->expects($this->once()) ->method('formatDate') ->withAnyParameters() ->will($this->returnValue($someFormattedTime)); @@ -310,7 +316,7 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase ->method('setUpdatedAt') ->with($this->equalTo($someFormattedTime)); } else { - $mockResource->expects($this->never()) + $dateTime->expects($this->never()) ->method('formatDate'); $this->_subscription->expects($this->never()) ->method('setUpdatedAt'); diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/User/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/User/FactoryTest.php index 6580c811df9464e99e9f008bbf6cb4918116c0fb..b7e91da96ffdbd01dbac49b4bb11f5b12482ff07 100644 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/User/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/User/FactoryTest.php @@ -148,13 +148,18 @@ class FactoryTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); + $mockMathRandom = $this->getMockBuilder('Magento\Math\Random') + ->disableOriginalConstructor() + ->getMock(); + $this->_userFactory = new \Magento\Webhook\Model\Webapi\User\Factory( $mockRuleFactory, $mockUserFactory, + $mockRoleFactory, $this->_mockAuthConfig, $mockAclCache, - $this->_mockCoreHelper + $mockMathRandom ); } @@ -174,15 +179,6 @@ class FactoryTest extends \PHPUnit_Framework_TestCase 'company' => $company, ); - $uniq = 'unique string'; - - $this->_mockCoreHelper = $this->getMockBuilder('Magento\Core\Helper\Data') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockCoreHelper->expects($this->once()) - ->method('uniqHash') - ->will($this->returnValue($uniq)); - // Mock Role $this->_mockRole = $this->getMockBuilder('Magento\Webapi\Model\Acl\Role') ->setMethods(array('load', 'save', 'getId', 'setRoleName', 'delete')) diff --git a/dev/tests/unit/testsuite/Magento/Widget/Model/Widget/InstanceTest.php b/dev/tests/unit/testsuite/Magento/Widget/Model/Widget/InstanceTest.php index d24b23a7bde0d9ebbe9d236db4da4e713e5fa975..df7bb69fefe52b912d64c7ce916a6f908e5d4542 100644 --- a/dev/tests/unit/testsuite/Magento/Widget/Model/Widget/InstanceTest.php +++ b/dev/tests/unit/testsuite/Magento/Widget/Model/Widget/InstanceTest.php @@ -37,8 +37,8 @@ class InstanceTest extends \PHPUnit_Framework_TestCase */ protected $_viewFileSystemMock; - /** @var \Magento\Core\Model\Config|PHPUnit_Framework_MockObject_MockObject */ - protected $_coreConfigMock; + /** @var \Magento\Widget\Model\NamespaceResolver |PHPUnit_Framework_MockObject_MockObject */ + protected $_namespaceResolver; /** * @var \Magento\Widget\Model\Widget\Instance @@ -58,40 +58,30 @@ class InstanceTest extends \PHPUnit_Framework_TestCase $this->_widgetModelMock = $this->getMockBuilder('Magento\Widget\Model\Widget') ->disableOriginalConstructor() ->getMock(); - $contextMock = $this->getMockBuilder('Magento\Core\Model\Context') - ->disableOriginalConstructor() - ->getMock(); $this->_viewFileSystemMock = $this->getMockBuilder('Magento\Core\Model\View\FileSystem') ->disableOriginalConstructor() ->getMock(); - $this->_coreConfigMock = $this->getMockBuilder('Magento\Core\Model\Config') + $this->_namespaceResolver = $this->getMockBuilder('\Magento\Widget\Model\NamespaceResolver') ->disableOriginalConstructor() ->getMock(); $this->_cacheTypesListMock = $this->getMock('Magento\Core\Model\Cache\TypeListInterface'); $this->_readerMock = $this->getMockBuilder('Magento\Widget\Model\Config\Reader') ->disableOriginalConstructor() ->getMock(); - $registryMock = $this->getMockBuilder('Magento\Core\Model\Registry') - ->disableOriginalConstructor() - ->getMock(); - $coreData = $this->getMockBuilder('Magento\Core\Helper\Data') - ->disableOriginalConstructor() - ->getMock(); - $widgetData = $this->getMockBuilder('Magento\Widget\Helper\Data') - ->disableOriginalConstructor() - ->getMock(); - $productType = $this->getMockBuilder('Magento\Catalog\Model\Product\Type') - ->disableOriginalConstructor() - ->getMock(); + + $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + $args = $objectManagerHelper->getConstructArguments('Magento\Widget\Model\Widget\Instance', array( + 'viewFileSystem' => $this->_viewFileSystemMock, + 'cacheTypeList' => $this->_cacheTypesListMock, + 'reader' => $this->_readerMock, + 'widgetModel' => $this->_widgetModelMock, + 'namespaceResolver' => $this->_namespaceResolver + )); /** @var \Magento\Widget\Model\Widget\Instance _model */ $this->_model = $this->getMock( 'Magento\Widget\Model\Widget\Instance', array('_construct'), - array( - $widgetData, $coreData, $contextMock, $registryMock, $this->_viewFileSystemMock, - $this->_cacheTypesListMock, $productType, $this->_readerMock, $this->_widgetModelMock, - $this->_coreConfigMock - ), + $args, '', true ); @@ -115,7 +105,7 @@ class InstanceTest extends \PHPUnit_Framework_TestCase ), 'type' => 'label', 'helper_block' => array( - 'type' => 'Magento\Adminhtml\Block\Cms\Page\Widget\Chooser', + 'type' => 'Magento\Cms\Block\Adminhtml\Page\Widget\Chooser', 'data' => array( 'button' => array( 'open' => 'Select Page...', diff --git a/dev/tests/unit/testsuite/Magento/Widget/Model/WidgetTest.php b/dev/tests/unit/testsuite/Magento/Widget/Model/WidgetTest.php index e2168780c6dff1fbf45c69fcfcfd3cf34a8d6b70..ac960796d460149a4c27aa149155c2601366c5f8 100644 --- a/dev/tests/unit/testsuite/Magento/Widget/Model/WidgetTest.php +++ b/dev/tests/unit/testsuite/Magento/Widget/Model/WidgetTest.php @@ -40,16 +40,11 @@ class WidgetTest extends \PHPUnit_Framework_TestCase $this->_storage = $this->getMockBuilder('Magento\Widget\Model\Config\Data') ->disableOriginalConstructor() ->getMock(); - $viewUrl = $this->getMockBuilder('Magento\Core\Model\View\Url') - ->disableOriginalConstructor() - ->getMock(); - $viewFileSystem = $this->getMockBuilder('Magento\Core\Model\View\FileSystem') - ->disableOriginalConstructor() - ->getMock(); - $coreData = $this->getMockBuilder('Magento\Core\Helper\Data') - ->disableOriginalConstructor() - ->getMock(); - $this->_model = new \Magento\Widget\Model\Widget($coreData, $this->_storage, $viewUrl, $viewFileSystem); + $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + $objectManagerHelper->getObject('Magento\Widget\Model\Widget', array('dataStorage' => $this->_storage)); + $this->_model = $objectManagerHelper->getObject('Magento\Widget\Model\Widget', array( + 'dataStorage' => $this->_storage) + ); } public function testGetWidgets() @@ -103,4 +98,12 @@ class WidgetTest extends \PHPUnit_Framework_TestCase $this->assertEquals($widgetOne, $this->_model->getWidgetByClassType('type1')); $this->assertNull($this->_model->getWidgetByClassType('type2')); } + + public function testGetWidgetDeclarationTypeWithBackslashes() + { + $this->assertContains( + 'Magento\\\\Widget\\\\Backslashed\\\\ClassName', + $this->_model->getWidgetDeclaration('Magento\Widget\Backslashed\ClassName') + ); + } } diff --git a/dev/tests/unit/testsuite/Magento/Widget/Model/_files/mappedConfigArray1.php b/dev/tests/unit/testsuite/Magento/Widget/Model/_files/mappedConfigArray1.php index 52bccacd044941b0d88c7a1c3a31196e189637f1..d7c68953816e9331e14f57d36ba27d90631747e2 100644 --- a/dev/tests/unit/testsuite/Magento/Widget/Model/_files/mappedConfigArray1.php +++ b/dev/tests/unit/testsuite/Magento/Widget/Model/_files/mappedConfigArray1.php @@ -37,7 +37,7 @@ return array( ), 'type' => 'label', 'helper_block' => array( - 'type' => 'Magento\Adminhtml\Block\Cms\Page\Widget\Chooser', + 'type' => 'Magento\Cms\Block\Adminhtml\Page\Widget\Chooser', 'data' => array( 'button' => array( 'open' => 'Select Page...', diff --git a/dev/tests/unit/testsuite/Magento/_files/errors/report.php b/dev/tests/unit/testsuite/Magento/_files/errors/report.php new file mode 100644 index 0000000000000000000000000000000000000000..eff6fbdcbf7518fb66750735a4e889476f686a50 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/_files/errors/report.php @@ -0,0 +1,26 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** @var $reportData array */ +PHPUnit_Framework_Assert::assertNotEmpty($reportData); diff --git a/dev/tools/Magento/Tools/Di/Code/Scanner/CompositeScanner.php b/dev/tools/Magento/Tools/Di/Code/Scanner/CompositeScanner.php index cf26f08522e4faed8c072297198bb16b737b02fe..18e5adf99968c0b896b249bfbbe95680a7ba682e 100644 --- a/dev/tools/Magento/Tools/Di/Code/Scanner/CompositeScanner.php +++ b/dev/tools/Magento/Tools/Di/Code/Scanner/CompositeScanner.php @@ -52,9 +52,8 @@ class CompositeScanner implements ScannerInterface { $output = array(); foreach ($this->_children as $type => $scanner) { - $output = array_merge($output, $scanner->collectEntities($files[$type])); + $output[$type] = array_unique($scanner->collectEntities($files[$type])); } - $output = array_unique($output); return $output; } } diff --git a/dev/tools/Magento/Tools/Di/Code/Scanner/FileScanner.php b/dev/tools/Magento/Tools/Di/Code/Scanner/FileScanner.php deleted file mode 100644 index 276f9ba6abd8f611bd87c8e9f16507570109a978..0000000000000000000000000000000000000000 --- a/dev/tools/Magento/Tools/Di/Code/Scanner/FileScanner.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Tools\Di\Code\Scanner; - -class FileScanner implements ScannerInterface -{ - /** - * Regular expression pattern - * - * @var string - */ - protected $_pattern; - - /** - * Get array of class names - * - * @param array $files - * @return array - */ - public function collectEntities(array $files) - { - $output = array(); - foreach ($files as $file) { - $content = file_get_contents($file); - $content = $this->_prepareContent($content); - $matches = array(); - if (preg_match_all($this->_pattern, $content, $matches)) { - $output = array_merge($output, $matches[1]); - } - } - $output = array_unique($output); - $output = $this->_filterEntities($output); - return $output; - } - - /** - * Prepare file content - * - * @param string $content - * @return string - */ - protected function _prepareContent($content) - { - return $content; - } - - /** - * Filter found entities if needed - * - * @param array $output - * @return array - */ - protected function _filterEntities(array $output) - { - return $output; - } -} diff --git a/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php b/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php index ec6bc166fda1ede55ca696c504d8697c6e9847ff..195458dc70ab7beb74c0b7663a5d9407b5fb69c4 100644 --- a/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php +++ b/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php @@ -24,44 +24,150 @@ namespace Magento\Tools\Di\Code\Scanner; -class PhpScanner extends FileScanner +use \Magento\Tools\Di\Compiler\Log\Log; + +class PhpScanner implements ScannerInterface { /** - * Regular expression pattern - * - * Searches for factories specified in php files + * @var Log $log + */ + protected $_log; + + /** + * @param Log $log + */ + public function __construct(Log $log) + { + $this->_log = $log; + } + + /** + * Fetch factories from class constructor * - * @var string + * @param $file string + * @param $reflectionClass mixed + * @return array */ - protected $_pattern = - '/[ \\b\n\'"\(\\\\]{1}([A-Z]{1}[a-zA-Z0-9]*(\\\\|_)[A-Z]{1}[a-zA-Z0-9\\\\_]*(Factory))[ \\b\n\'"]{1}/'; + protected function _fetchFactories($file, $reflectionClass) + { + $absentFactories = array(); + if ($reflectionClass->hasMethod('__construct')) { + $constructor = $reflectionClass->getMethod('__construct'); + $parameters = $constructor->getParameters(); + /** @var $parameter \ReflectionParameter */ + foreach ($parameters as $parameter) { + preg_match('/\[\s\<\w+?>\s([\w\\\\]+)/s', $parameter->__toString(), $matches); + if (isset($matches[1]) && substr($matches[1], -7) == 'Factory') { + $factoryClassName = $matches[1]; + if (class_exists($factoryClassName)) { + continue; + } + $entityName = rtrim(substr($factoryClassName, 0, -7), '\\'); + if (!class_exists($entityName)) { + $this->_log->add( + Log::CONFIGURATION_ERROR, + $factoryClassName, + 'Invalid Factory for nonexistent class ' . $entityName . ' in file ' . $file + ); + continue; + } + + if (substr($factoryClassName, -8) == '\\Factory') { + $this->_log->add( + Log::CONFIGURATION_ERROR, + $factoryClassName, + 'Invalid Factory declaration for class ' . $entityName . ' in file ' . $file + ); + continue; + } + $absentFactories[] = $factoryClassName; + } + } + } + return $absentFactories; + } /** - * Prepare file content + * Get array of class names * - * @param string $content + * @param array $files + * @return array + */ + public function collectEntities(array $files) + { + $output = array(); + foreach ($files as $file) { + $classes = $this->_getDeclaredClasses($file); + foreach ($classes as $className) { + $reflectionClass = new \ReflectionClass($className); + $absentFactories = $this->_fetchFactories($file, $reflectionClass); + if (!empty($absentFactories)) { + $output = array_merge($output, $absentFactories); + } + } + } + return array_unique($output); + } + + /** + * @param $tokenIterator int + * @param $count int + * @param $tokens array * @return string */ - protected function _prepareContent($content) + protected function _fetchNamespace($tokenIterator, $count, $tokens) { - $output = ''; - $commentTokens = array(T_COMMENT); + $namespace = ''; + for ($tokenOffset = $tokenIterator + 1; $tokenOffset < $count; ++$tokenOffset) { + if ($tokens[$tokenOffset][0] === T_STRING) { + $namespace .= "\\" . $tokens[$tokenOffset][1]; + } elseif ($tokens[$tokenOffset] === '{' || $tokens[$tokenOffset] === ';') { + break; + } + } + return $namespace; + } - if (defined('T_DOC_COMMENT')) { - $commentTokens[] = T_DOC_COMMENT; + /** + * @param $namespace string + * @param $tokenIterator int + * @param $count int + * @param $tokens array + * @return array + */ + protected function _fetchClasses($namespace, $tokenIterator, $count, $tokens) + { + $classes = array(); + for ($tokenOffset = $tokenIterator + 1; $tokenOffset < $count; ++$tokenOffset) { + if ($tokens[$tokenOffset] === '{') { + $classes[]= $namespace . "\\" . $tokens[$tokenIterator + 2][1]; + } } + return $classes; + } - $tokens = token_get_all($content); + /** + * Get classes declared in the file + * + * @param string $file + * @return array + */ + protected function _getDeclaredClasses($file) + { + $classes = array (); + $namespace = ""; + $tokens = token_get_all(file_get_contents($file)); + $count = count($tokens); - foreach ($tokens as $token) { - if (is_array($token)) { - if (in_array($token[0], $commentTokens)) { - continue; - } - $token = $token[1]; + for ($tokenIterator = 0; $tokenIterator < $count; $tokenIterator ++) { + if ($tokens[$tokenIterator][0] === T_NAMESPACE) { + $namespace .= $this->_fetchNamespace($tokenIterator, $count, $tokens); + } + + if ($tokens[$tokenIterator][0] === T_CLASS) { + $classes = array_merge($classes, $this->_fetchClasses($namespace, $tokenIterator, $count, $tokens)); } - $output .= $token; } - return $output; + return array_unique($classes); } } diff --git a/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php b/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php index cc61ab365df41b3d0e31b7d5ac405c0b4fe9e7c5..c099ba7484a2b37af3443970cd471a398c9da28d 100644 --- a/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php +++ b/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php @@ -24,35 +24,47 @@ namespace Magento\Tools\Di\Code\Scanner; -class XmlScanner extends FileScanner +class XmlScanner implements ScannerInterface { /** - * Regular expression pattern - * - * @var string + * @var \Magento\Tools\Di\Compiler\Log\Log $log */ - protected $_pattern = - '/[\n\'"<>]{1}([A-Z]{1}[a-zA-Z0-9]*[_\\\\][A-Z]{1}[a-zA-Z0-9_\\\\]*(Proxy|Factory))[\n\'"<>]{1}/'; + protected $_log; /** - * Prepare xml file content - * - * @param string $content - * @return string + * @param \Magento\Tools\Di\Compiler\Log\Log $log */ - protected function _prepareContent($content) + public function __construct(\Magento\Tools\Di\Compiler\Log\Log $log) { - $dom = new \DOMDocument(); - $dom->loadXML($content); + $this->_log = $log; + } - $xpath = new \DOMXPath($dom); - /** @var $comment \DOMComment */ - foreach ($xpath->query('//comment()') as $comment) { - $comment->parentNode->removeChild($comment); + /** + * Get array of class names + * + * @param array $files + * @return array + */ + public function collectEntities(array $files) + { + $output = array(); + foreach ($files as $file) { + $dom = new \DOMDocument(); + $dom->load($file); + $xpath = new \DOMXPath($dom); + $xpath->registerNamespace("php", "http://php.net/xpath"); + $xpath->registerPhpFunctions('preg_match'); + $regex = '/(.*)Proxy/'; + $query = "/config/preference[ php:functionString('preg_match', '$regex', @type) > 0] | " + . "/config/type/param/instance[ php:functionString('preg_match', '$regex', @type) > 0] | " + . "/config/virtualType[ php:functionString('preg_match', '$regex', @type) > 0]"; + /** @var \DOMNode $node */ + foreach ($xpath->query($query) as $node) { + $output[] = $node->attributes->getNamedItem('type')->nodeValue; + } } - $output = $dom->saveXML(); - - return $output; + $output = array_unique($output); + return $this->_filterEntities($output); } /** @@ -65,10 +77,17 @@ class XmlScanner extends FileScanner { $filteredEntities = array(); foreach ($output as $className) { - $entityName = rtrim(preg_replace('/(Proxy|Factory)$/', '', $className), '\\'); - // Skip aliases that are declared in Di configuration - if (class_exists($entityName)) { - array_push($filteredEntities, $className); + $entityName = substr($className, -6) === '\Proxy' ? substr($className, 0, -6) : $className; + if (false === class_exists($className)) { + if (class_exists($entityName)) { + array_push($filteredEntities, $className); + } else { + $this->_log->add( + \Magento\Tools\Di\Compiler\Log\Log::CONFIGURATION_ERROR, + $className, + 'Invalid proxy class for ' . substr($className, 0, -5) + ); + } } } return $filteredEntities; diff --git a/dev/tools/Magento/Tools/Di/Compiler/Directory.php b/dev/tools/Magento/Tools/Di/Compiler/Directory.php index a2cc22d1767d3c31ad2d0b1f7c3886b71efe67bb..d97d3485c2f229e2cb94625e502a5d017dc62bf5 100644 --- a/dev/tools/Magento/Tools/Di/Compiler/Directory.php +++ b/dev/tools/Magento/Tools/Di/Compiler/Directory.php @@ -77,6 +77,7 @@ class Directory */ public function compile($path) { + $validator = new \Magento\Code\Validator\ConstructorIntegrity(); $rdi = new \RecursiveDirectoryIterator(realpath($path)); $recursiveIterator = new \RecursiveIteratorIterator($rdi, 1); /** @var $item \SplFileInfo */ @@ -90,9 +91,12 @@ class Directory require_once $item->getRealPath(); } try { + $validator->validate($className); $signatureReader = new \Magento\Code\Reader\ClassReader(); $this->_definitions[$className] = $signatureReader->getConstructor($className); $this->_relations[$className] = $signatureReader->getParents($className); + } catch (\Magento\Code\ValidationException $exception) { + $this->_log->add(Log::COMPILATION_ERROR, $className, $exception->getMessage()); } catch (\ReflectionException $e) { $this->_log->add(Log::COMPILATION_ERROR, $className, $e->getMessage()); } diff --git a/dev/tools/Magento/Tools/Di/Compiler/Log/Log.php b/dev/tools/Magento/Tools/Di/Compiler/Log/Log.php index ad0ea8903c43142bc03fdd6938782ae1be9ba43c..84fc600e07cda570b444889194256b0f84c29e12 100644 --- a/dev/tools/Magento/Tools/Di/Compiler/Log/Log.php +++ b/dev/tools/Magento/Tools/Di/Compiler/Log/Log.php @@ -29,38 +29,50 @@ class Log const GENERATION_ERROR = 1; const GENERATION_SUCCESS = 2; const COMPILATION_ERROR = 3; + const CONFIGURATION_ERROR = 4; /** - * Log writer + * Success log writer * * @var Writer\WriterInterface */ - protected $_writer; + protected $_successWriter; /** - * List of log entries + * Error log writer + * + * @var Writer\WriterInterface + */ + protected $_errorWriter; + + /** + * List of success log entries * * @var array */ - protected $_entries = array(); + protected $_successEntries = array(); /** - * Allowed log types + * List of error entries * * @var array */ - protected $_allowedTypes; + protected $_errorEntries = array(); /** - * @param Writer\WriterInterface $writer - * @param array $allowedTypes + * @param Writer\WriterInterface $successWriter + * @param Writer\WriterInterface $errorWriter */ - public function __construct(Writer\WriterInterface $writer, $allowedTypes = array()) + public function __construct(Writer\WriterInterface $successWriter, Writer\WriterInterface $errorWriter) { - $this->_writer = $writer; - $this->_allowedTypes = empty($allowedTypes) - ? array(self::GENERATION_ERROR, self::COMPILATION_ERROR, self::GENERATION_SUCCESS) - : $allowedTypes; + $this->_successWriter = $successWriter; + $this->_errorWriter = $errorWriter; + $this->_successEntries[self::GENERATION_SUCCESS] = array(); + $this->_errorEntries = array( + self::CONFIGURATION_ERROR => array(), + self::GENERATION_ERROR => array(), + self::COMPILATION_ERROR => array(), + ); } /** @@ -72,8 +84,10 @@ class Log */ public function add($type, $key, $message = '') { - if (in_array($type, $this->_allowedTypes)) { - $this->_entries[$type][$key][] = $message; + if (array_key_exists($type, $this->_successEntries)) { + $this->_successEntries[$type][$key][] = $message; + } else { + $this->_errorEntries[$type][$key][] = $message; } } @@ -82,6 +96,22 @@ class Log */ public function report() { - $this->_writer->write($this->_entries); + $this->_successWriter->write($this->_successEntries); + $this->_errorWriter->write($this->_errorEntries); + } + + /** + * Check whether error exists + * + * @return bool + */ + public function hasError() + { + foreach ($this->_errorEntries as $data) { + if (count($data)) { + return true; + } + } + return false; } } diff --git a/dev/tools/Magento/Tools/Di/Compiler/Log/Writer/Console.php b/dev/tools/Magento/Tools/Di/Compiler/Log/Writer/Console.php index 5a87701e4e7fbabb994a85057101b1df4cc2b359..3e3afc068303fdec2e7360f007be87b976910beb 100644 --- a/dev/tools/Magento/Tools/Di/Compiler/Log/Writer/Console.php +++ b/dev/tools/Magento/Tools/Di/Compiler/Log/Writer/Console.php @@ -33,7 +33,8 @@ class Console implements WriterInterface protected $_messages = array( Log::GENERATION_SUCCESS => 'Generated classes:', Log::GENERATION_ERROR => 'Errors during class generation:', - Log::COMPILATION_ERROR => 'Errors during compilation:' + Log::COMPILATION_ERROR => 'Errors during compilation:', + Log::CONFIGURATION_ERROR => 'Errors during configuration scanning:' ); /** @@ -44,10 +45,13 @@ class Console implements WriterInterface public function write(array $data) { foreach ($data as $type => $classes) { + if (!count($classes)) { + continue; + } echo $this->_messages[$type] . "\n"; foreach ($classes as $className => $messages) { - echo "\t" . $className . "\n"; if (count($messages)) { + echo "\t" . $className . "\n"; foreach ($messages as $message) { if ($message) { echo "\t\t - " . $message . "\n"; diff --git a/dev/tools/Magento/Tools/Di/compiler.php b/dev/tools/Magento/Tools/Di/compiler.php index a22a198deb1047b4a84e12396621ace0dbf5654f..10b90276adab1858bdc9f64208f1c9b242796726 100644 --- a/dev/tools/Magento/Tools/Di/compiler.php +++ b/dev/tools/Magento/Tools/Di/compiler.php @@ -34,17 +34,13 @@ use Magento\Tools\Di\Compiler\Log\Log, $filePatterns = array( 'php' => '/.*\.php$/', - 'etc' => '/\/app\/etc\/[a-z0-9\.]*\.xml$/', 'di' => '/\/etc\/([a-zA-Z_]*\/di|di)\.xml$/', - 'view' => '/\/view\/[a-z0-9A-Z\/\.]*\.xml$/', - 'design' => '/\/app\/design\/[a-z0-9A-Z\/\._]*\.xml$/', ); $codeScanDir = realpath($rootDir . '/app'); try { $opt = new Zend_Console_Getopt(array( 'serializer=w' => 'serializer function that should be used (serialize|binary) default = serialize', 'verbose|v' => 'output report after tool run', - 'log|l=s' => 'log level (all|error) default = all', 'extra-classes-file=s' => 'path to file with extra proxies and factories to generate', 'generation=s' => 'absolute path to generated classes, <magento_root>/var/generation by default', 'di=s' => 'absolute path to DI definitions directory, <magento_root>/var/di by default' @@ -65,11 +61,13 @@ try { $generationDir, ); - $writer = $opt->getOption('v') ? new Writer\Console() : new Writer\Quiet(); - $allowedLogTypes = $opt->getOption('log') == 'error' ? - array(Log::COMPILATION_ERROR, Log::GENERATION_ERROR) - : array(); - $log = new Log($writer, $allowedLogTypes); + /** @var Writer\WriterInterface $logWriter Writer model for success messages */ + $logWriter = $opt->getOption('v') ? new Writer\Console() : new Writer\Quiet(); + + /** @var Writer\WriterInterface $logWriter Writer model for error messages */ + $errorWriter = new Writer\Console(); + + $log = new Log($logWriter, $errorWriter); $serializer = ($opt->getOption('serializer') == 'binary') ? new Serializer\Igbinary() : new Serializer\Standard(); // 1 Code generation @@ -80,21 +78,47 @@ try { $entities = array(); $scanner = new Scanner\CompositeScanner(); - $scanner->addChild(new Scanner\PhpScanner(), 'php'); - $scanner->addChild(new Scanner\XmlScanner(), 'etc'); - $scanner->addChild(new Scanner\XmlScanner(), 'di'); - $scanner->addChild(new Scanner\XmlScanner(), 'view'); - $scanner->addChild(new Scanner\XmlScanner(), 'design'); + $scanner->addChild(new Scanner\PhpScanner($log), 'php'); + $scanner->addChild(new Scanner\XmlScanner($log), 'di'); $scanner->addChild(new Scanner\ArrayScanner(), 'additional'); $entities = $scanner->collectEntities($files); $interceptorScanner = new Scanner\XmlInterceptorScanner(); - $entities = array_merge($entities, $interceptorScanner->collectEntities($files['di'])); + $entities['di'] = array_merge($entities['di'], $interceptorScanner->collectEntities($files['di'])); - // 1.2 Generation + // 1.2 Generation of Factory and Additional Classes $generatorIo = new \Magento\Code\Generator\Io(null, null, $generationDir); $generator = new \Magento\Code\Generator(null, null, $generatorIo); - foreach ($entities as $entityName) { + foreach (array('php', 'additional') as $type) { + foreach ($entities[$type] as $entityName) { + switch ($generator->generateClass($entityName)) { + case \Magento\Code\Generator::GENERATION_SUCCESS: + $log->add(Log::GENERATION_SUCCESS, $entityName); + break; + + case \Magento\Code\Generator::GENERATION_ERROR: + $log->add(Log::GENERATION_ERROR, $entityName); + break; + + case \Magento\Code\Generator::GENERATION_SKIP: + default: + //no log + break; + } + } + } + + // 2. Compilation + // 2.1 Code scan + $directoryCompiler = new Directory($log); + foreach ($compilationDirs as $path) { + if (is_readable($path)) { + $directoryCompiler->compile($path); + } + } + + // 2.1.1 Generation of Proxy and Interceptor Classes + foreach ($entities['di'] as $entityName) { switch ($generator->generateClass($entityName)) { case \Magento\Code\Generator::GENERATION_SUCCESS: $log->add(Log::GENERATION_SUCCESS, $entityName); @@ -111,14 +135,9 @@ try { } } - // 2. Compilation - // 2.1 Code scan - $directoryCompiler = new Directory($log); - foreach ($compilationDirs as $path) { - if (is_readable($path)) { - $directoryCompiler->compile($path); - } - } + //2.1.2 Compile definitions for Proxy/Interceptor classes + $directoryCompiler->compile($generationDir); + list($definitions, $relations) = $directoryCompiler->getResult(); // 2.2 Compression @@ -132,14 +151,17 @@ try { file_put_contents($compiledFile, $output); file_put_contents($relationsFile, $serializer->serialize($relations)); - // 3. Plugin Definition Compilation $pluginScanner = new Scanner\CompositeScanner(); $pluginScanner->addChild(new Scanner\PluginScanner(), 'di'); $pluginDefinitions = array(); - foreach ($pluginScanner->collectEntities($files) as $entity) { - $pluginDefinitions[$entity] = get_class_methods($entity); + $pluginList = $pluginScanner->collectEntities($files); + foreach ($pluginList as $type => $entityList) { + foreach ($entityList as $entity) { + $pluginDefinitions[$entity] = get_class_methods($entity); + } } + $output = $serializer->serialize($pluginDefinitions); if (!file_exists(dirname($pluginDefFile))) { @@ -147,8 +169,14 @@ try { } file_put_contents($pluginDefFile, $output); + //Reporter $log->report(); + + if ($log->hasError()) { + exit(1); + } + } catch (Zend_Console_Getopt_Exception $e) { echo $e->getUsageMessage(); echo 'Please, use quotes(") for wrapping strings.' . "\n"; diff --git a/dev/tools/Magento/Tools/I18n/Code/ServiceLocator.php b/dev/tools/Magento/Tools/I18n/Code/ServiceLocator.php index 9142b97904823fe8f0712c89867d31e762307ede..1fe658cbebe2827f4e4e5baec4491d52130b6dff 100644 --- a/dev/tools/Magento/Tools/I18n/Code/ServiceLocator.php +++ b/dev/tools/Magento/Tools/I18n/Code/ServiceLocator.php @@ -115,7 +115,7 @@ class ServiceLocator private static function _getFactory() { if (null === self::$_factory) { - self::$_factory = new Factory(); + self::$_factory = new \Magento\Tools\I18n\Code\Factory(); } return self::$_factory; } diff --git a/dev/tools/Magento/Tools/Migration/themes_view.php b/dev/tools/Magento/Tools/Migration/themes_view.php index b94559199d4e21245ddcab19bd815bc809f37d39..3f9ee7c779ff3c232e5f05a52c1f6b9ac09c087b 100644 --- a/dev/tools/Magento/Tools/Migration/themes_view.php +++ b/dev/tools/Magento/Tools/Migration/themes_view.php @@ -26,13 +26,11 @@ require_once __DIR__ . '/../../../../../app/bootstrap.php'; $rootDir = realpath(__DIR__ . '/../../../../..'); try { - $config = new \Magento\Core\Model\Config\Primary($rootDir, array()); - $entryPoint = new \Magento\Core\Model\EntryPoint\Cron($config); + $entryPoint = new \Magento\App\EntryPoint\EntryPoint($rootDir, array()); - $objectManager = new \Magento\Core\Model\ObjectManager($config); + $objectManager = new \Magento\App\ObjectManager($config); /** @var $configModel \Magento\Core\Model\Config */ $configModel = $objectManager->get('Magento\Core\Model\Config'); - $configModel->removeCache(); $configModel->reinit(); $config = array(); @@ -51,7 +49,7 @@ try { /** * Replace {{skin url=""}} with {{view url=""}} for given table field * - * @param \Magento\Core\Model\Config\Primary $objectManager + * @param \Magento\ObjectManager $objectManager * @param string $table * @param string $col */ diff --git a/dev/tools/Magento/Tools/View/generator.php b/dev/tools/Magento/Tools/View/generator.php index 0e826808e3e0c2cada7f0ac41da6a7c9d3d679e5..438ca4c0177b65e440ac65d59cb2a6f2c16817f1 100644 --- a/dev/tools/Magento/Tools/View/generator.php +++ b/dev/tools/Magento/Tools/View/generator.php @@ -30,6 +30,9 @@ require __DIR__ . '/../../../../../app/bootstrap.php'; \Magento\Autoload\IncludePath::addIncludePath(__DIR__.'/../../../'); +/** + * Command line usage help + */ define('SYNOPSIS', <<<USAGE Usage: php -f generator.php -- [--source <dir>] [--destination <dir>] [--dry-run] php -f generator.php -- --help @@ -64,9 +67,9 @@ try { $filesystem = new \Magento\Filesystem(new \Magento\Filesystem\Adapter\Local); $dirs = new \Magento\App\Dir($config->getSourceDir()); $objectManager = new \Magento\ObjectManager\ObjectManager(); - - $themes = new \Magento\Core\Model\Theme\Collection($filesystem, $objectManager, $dirs); - $themes->setItemObjectClass(' \Magento\Tools\View\Generator\ThemeLight'); + $entityFactory = new Magento\Core\Model\EntityFactory($objectManager); + $themes = new \Magento\Core\Model\Theme\Collection($filesystem, $dirs, $entityFactory); + $themes->setItemObjectClass('\Magento\Tools\View\Generator\ThemeLight'); $themes->addDefaultPattern('*'); $fallbackFactory = new \Magento\View\Design\Fallback\Factory($dirs); diff --git a/downloader/app/Magento/Downloader/Controller.php b/downloader/app/Magento/Downloader/Controller.php index c1819344efbd00649aa2cf56500e3ae15a292086..b7db3018a378e848037ebdfb6e7209561c0e4f0f 100755 --- a/downloader/app/Magento/Downloader/Controller.php +++ b/downloader/app/Magento/Downloader/Controller.php @@ -512,11 +512,11 @@ final class Controller } include_once self::$_instance->getBootstrapPath(); - \Magento\Core\Model\ObjectManager::getInstance() + \Magento\App\ObjectManager::getInstance() ->get('Magento\App\State') ->setIsDownloader(); } - \Magento\Core\Model\ObjectManager::getInstance()->get('Magento\Core\Model\App'); + \Magento\App\ObjectManager::getInstance()->get('Magento\Core\Model\App'); if (self::isInstalled()) { \Mage::getSingleton('Magento\Backend\Model\Url')->turnOffSecretKey(); } @@ -943,9 +943,9 @@ final class Controller // reinit config and apply all updates \Mage::app()->getConfig()->reinit(); - /** @var $updater \Magento\App\UpdaterInterface*/ - $updater = \Magento\Core\Model\ObjectManager::getInstance() - ->get('Magento\App\UpdaterInterface'); + /** @var $updater \Magento\Module\UpdaterInterface*/ + $updater = \Magento\App\ObjectManager::getInstance() + ->get('Magento\Module\UpdaterInterface'); $updater->updateScheme(); $updater->updateData(); $message .= 'Cache cleaned successfully'; @@ -1032,7 +1032,7 @@ final class Controller ->setName($archiveName) ->setBackupsDir(\Mage::getBaseDir('var') . DS . 'backups'); - \Magento\Core\Model\ObjectManager::getInstance() + \Magento\App\ObjectManager::getInstance() ->get('Magento\Core\Model\Registry') ->register('backup_manager', $backupManager); diff --git a/downloader/lib/Magento/Backup/Snapshot.php b/downloader/lib/Magento/Backup/Snapshot.php index c971c2ae51c635f2e902d5506ec443a21b74728c..0e2e9bc66cadd474e1900e801c1a1039fc465916 100755 --- a/downloader/lib/Magento/Backup/Snapshot.php +++ b/downloader/lib/Magento/Backup/Snapshot.php @@ -45,7 +45,7 @@ class Snapshot extends \Magento\Backup\Filesystem /** * Dirs instance * - * @var \Magento\Core\Model\Dir + * @var \Magento\App\Dir */ protected $_dirs; @@ -55,11 +55,11 @@ class Snapshot extends \Magento\Backup\Filesystem protected $_backupFactory; /** - * @param \Magento\Core\Model\Dir $dirs - * @param \Magento\Backup\Factory $backupFactory + * @param \Magento\App\Dir $dirs + * @param Factory $backupFactory */ public function __construct( - \Magento\Core\Model\Dir $dirs, + \Magento\App\Dir $dirs, \Magento\Backup\Factory $backupFactory ) { $this->_dirs = $dirs; diff --git a/index.php b/index.php index 421ab28afeea7fc6dd8f2e6a527c437011beecec..0bedba34c928e4a6903a77e8a1c72cb18afc26f9 100644 --- a/index.php +++ b/index.php @@ -8,7 +8,7 @@ * $params['MAGE_RUN_CODE'] = 'website2'; * $params['MAGE_RUN_TYPE'] = 'website'; * ... - * $entryPoint = new \Magento\Core\Model\EntryPoint\Http(new \Magento\Core\Model\Config\Primary(BP, $params)); + * $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); * -------------------------------------------- * * Magento @@ -35,6 +35,7 @@ require __DIR__ . '/app/bootstrap.php'; \Magento\Profiler::start('magento'); -$entryPoint = new \Magento\Core\Model\EntryPoint\Http(new \Magento\Core\Model\Config\Primary(BP, $_SERVER)); -$entryPoint->processRequest(); +$entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $_SERVER); +$result = $entryPoint->run('Magento\App\Http'); \Magento\Profiler::stop('magento'); +return $result; \ No newline at end of file diff --git a/lib/Magento/Acl/Resource/Provider.php b/lib/Magento/Acl/Resource/Provider.php index f3a17df8766c4fd98f8abe07dbc2ea217c61f7a5..a563542c366dd4d017be441e60c0b609081889c3 100644 --- a/lib/Magento/Acl/Resource/Provider.php +++ b/lib/Magento/Acl/Resource/Provider.php @@ -31,28 +31,28 @@ class Provider implements \Magento\Acl\Resource\ProviderInterface protected $_configReader; /** - * @var \Magento\Config\ScopeInterface + * @var \Magento\Acl\Resource\TreeBuilder */ - protected $_scope; + protected $_resourceTreeBuilder; /** - * @var \Magento\Acl\Resource\TreeBuilder + * @var \Magento\App\State */ - protected $_resourceTreeBuilder; + protected $_appState; /** * @param \Magento\Config\ReaderInterface $configReader - * @param \Magento\Config\ScopeInterface $scope * @param \Magento\Acl\Resource\TreeBuilder $resourceTreeBuilder + * @param \Magento\App\State $appState */ public function __construct( \Magento\Config\ReaderInterface $configReader, - \Magento\Config\ScopeInterface $scope, - \Magento\Acl\Resource\TreeBuilder $resourceTreeBuilder + \Magento\Acl\Resource\TreeBuilder $resourceTreeBuilder, + \Magento\App\State $appState ) { $this->_configReader = $configReader; - $this->_scope = $scope; $this->_resourceTreeBuilder = $resourceTreeBuilder; + $this->_appState = $appState; } /** @@ -60,7 +60,7 @@ class Provider implements \Magento\Acl\Resource\ProviderInterface */ public function getAclResources() { - $aclResourceConfig = $this->_configReader->read($this->_scope->getCurrentScope()); + $aclResourceConfig = $this->_configReader->read($this->_appState->getAreaCode()); if (!empty($aclResourceConfig['config']['acl']['resources'])) { return $this->_resourceTreeBuilder->build($aclResourceConfig['config']['acl']['resources']); } diff --git a/lib/Magento/App/Area/FrontNameResolverFactory.php b/lib/Magento/App/Area/FrontNameResolverFactory.php index 8c81099b540a6292a143d4e942ea6b670798545b..b0b1e68400aac9991c90874587aa431806efefa1 100644 --- a/lib/Magento/App/Area/FrontNameResolverFactory.php +++ b/lib/Magento/App/Area/FrontNameResolverFactory.php @@ -1,5 +1,7 @@ <?php /** + * Application area front name resolver factory + * * Magento * * NOTICE OF LICENSE diff --git a/lib/Magento/App/Area/FrontNameResolverInterface.php b/lib/Magento/App/Area/FrontNameResolverInterface.php index 9c311b441ce4429240de54fad3adc8128be3530d..1e5538dea5c89e10ec4d57c9a9721297e9d879ed 100644 --- a/lib/Magento/App/Area/FrontNameResolverInterface.php +++ b/lib/Magento/App/Area/FrontNameResolverInterface.php @@ -1,5 +1,7 @@ <?php /** + * Application area front name resolver + * * Magento * * NOTICE OF LICENSE diff --git a/lib/Magento/App/AreaList.php b/lib/Magento/App/AreaList.php index 091c226ca2f898f222de89f875aed75a336b6476..28eed05e1b5d8dfcdd2cd4524ce9215c20ee9735 100644 --- a/lib/Magento/App/AreaList.php +++ b/lib/Magento/App/AreaList.php @@ -1,5 +1,7 @@ <?php /** + * Application area list + * * Magento * * NOTICE OF LICENSE @@ -47,7 +49,7 @@ class AreaList * @param array $areas * @param string $default */ - public function __construct(\Magento\App\Area\FrontNameResolverFactory $resolverFactory, array $areas, $default) + public function __construct(Area\FrontNameResolverFactory $resolverFactory, array $areas, $default) { $this->_resolverFactory = $resolverFactory; $this->_areas = $areas; @@ -94,4 +96,15 @@ class AreaList { return array_keys($this->_areas); } + + /** + * Retrieve default area router id + * + * @param string $areaCode + * @return string + */ + public function getDefaultRouter($areaCode) + { + return isset($this->_areas[$areaCode]['router']) ? $this->_areas[$areaCode]['router'] : null; + } } \ No newline at end of file diff --git a/app/code/Magento/Core/Model/CacheInterface.php b/lib/Magento/App/CacheInterface.php similarity index 95% rename from app/code/Magento/Core/Model/CacheInterface.php rename to lib/Magento/App/CacheInterface.php index ef7750479e52320dafba40a3558907f949794f0a..018476ad8e6f6a1de3f4a28cf224843f60172da9 100644 --- a/app/code/Magento/Core/Model/CacheInterface.php +++ b/lib/Magento/App/CacheInterface.php @@ -1,5 +1,7 @@ <?php /** + * System cache model interface + * * Magento * * NOTICE OF LICENSE @@ -18,16 +20,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * System cache model interface - */ -namespace Magento\Core\Model; +namespace Magento\App; interface CacheInterface { diff --git a/app/code/Magento/Core/Model/Config/Local.php b/lib/Magento/App/Config.php similarity index 67% rename from app/code/Magento/Core/Model/Config/Local.php rename to lib/Magento/App/Config.php index 9790f0284191299e3a07fc6f9ad3506a2fd237c7..43ab07fdd98d4e2e5523ba30cefb6e72e58a03f1 100644 --- a/app/code/Magento/Core/Model/Config/Local.php +++ b/lib/Magento/App/Config.php @@ -23,9 +23,9 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App; -class Local +class Config { /** * Config data @@ -35,36 +35,41 @@ class Local protected $_data; /** - * DI configuration + * Configuration loader * - * @var array + * @var \Magento\App\Config\Loader */ - protected $_configuration = array(); + protected $_loader; /** - * @var \Magento\Core\Model\Config\Loader\Local + * Application options + * + * @var array */ - protected $_loader; + protected $_parameters; /** - * @param \Magento\Core\Model\Config\Loader\Local $loader + * @param array $parameters + * @param Config\Loader $loader */ - public function __construct(\Magento\Core\Model\Config\Loader\Local $loader) + public function __construct(array $parameters, Config\Loader $loader) { $this->_loader = $loader; - $this->_data = $loader->load(); + $this->_parameters = $parameters; + $this->_data = array_replace_recursive($this->_parseParams($loader->load()), $parameters); } /** + * @param array $input * @return array */ - public function getParams() + protected function _parseParams(array $input) { - $stack = $this->_data; + $stack = $input; unset($stack['resource']); unset($stack['connection']); $separator = '.'; - $parameters = array(); + $output = array(); while ($stack) { list($key, $value) = each($stack); @@ -80,9 +85,11 @@ class Local $stack = $build + $stack; continue; } - $parameters[$key] = $value; + $output[$key] = $value; } - return $parameters; + $output['connection'] = isset($input['connection']) ? $input['connection'] : array(); + $output['resource'] = isset($input['resource']) ? $input['resource'] : array(); + return $output; } /** @@ -109,13 +116,18 @@ class Local } /** - * Retrieve resources + * Retrieve key * - * @return array + * @param string $key + * @param mixed $defaultValue + * @return array|null */ - public function getResources() + public function get($key = null, $defaultValue = null) { - return isset($this->_data['resource']) ? $this->_data['resource'] : array(); + if ($key === null) { + return $this->_data; + } + return isset($this->_data[$key]) ? $this->_data[$key] : $defaultValue; } /** @@ -123,6 +135,6 @@ class Local */ public function reload() { - $this->_data = $this->_loader->load(); + $this->_data = array_replace_recursive($this->_parseParams($this->_loader->load()), $this->_parameters); } } diff --git a/app/code/Magento/Core/Model/Config/FileResolver/Primary.php b/lib/Magento/App/Config/FileResolver/Primary.php similarity index 97% rename from app/code/Magento/Core/Model/Config/FileResolver/Primary.php rename to lib/Magento/App/Config/FileResolver/Primary.php index b84b42fb2edf6975e3c832aa9c84077f166cff52..37c7a6ca47136ec62e92d96a765df27bac2d53c6 100644 --- a/app/code/Magento/Core/Model/Config/FileResolver/Primary.php +++ b/lib/Magento/App/Config/FileResolver/Primary.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\FileResolver; +namespace Magento\App\Config\FileResolver; /*** * @SuppressWarnings(PHPMD.UnusedFormalParameter) diff --git a/app/code/Magento/Core/Model/Config/Loader/Local.php b/lib/Magento/App/Config/Loader.php similarity index 82% rename from app/code/Magento/Core/Model/Config/Loader/Local.php rename to lib/Magento/App/Config/Loader.php index 5adf806c3b091e86b33cb757726d29bdc706664b..f0e830c767b8e4f98f6d51fb203ca290d2d60561 100644 --- a/app/code/Magento/Core/Model/Config/Loader/Local.php +++ b/lib/Magento/App/Config/Loader.php @@ -23,10 +23,17 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Loader; +namespace Magento\App\Config; -class Local +use \Magento\App\Dir; + +class Loader { + /** + * Local configuration file + */ + const PARAM_CUSTOM_FILE = 'custom.options.file'; + /** * Local configuration file */ @@ -46,13 +53,6 @@ class Local */ protected $_customFile; - /** - * Custom configuration string - * - * @var string - */ - protected $_customConfig; - /** * Configuration identifier attributes * @@ -61,15 +61,13 @@ class Local protected $_idAttributes = array('/config/resource' => 'name', '/config/connection' => 'name'); /** - * @param string $configDirectory - * @param string $customConfig + * @param Dir $dirs * @param string $customFile */ - public function __construct($configDirectory, $customConfig = null, $customFile = null) + public function __construct(Dir $dirs, $customFile = null) { - $this->_dir = $configDirectory; + $this->_dir = $dirs->getDir(Dir::CONFIG); $this->_customFile = $customFile; - $this->_customConfig = $customConfig; } /** @@ -93,10 +91,6 @@ class Local } } - // 3. extra local configuration string - if ($this->_customConfig) { - $localConfig->merge($this->_customConfig); - } $converter = new \Magento\Config\Converter\Dom\Flat($this->_idAttributes); $result = $converter->convert($localConfig->getDom()); diff --git a/app/code/Magento/Core/Model/Config/ValidationState.php b/lib/Magento/App/Config/ValidationState.php similarity index 97% rename from app/code/Magento/Core/Model/Config/ValidationState.php rename to lib/Magento/App/Config/ValidationState.php index ecd1e612ef081f91e9fce9b4e09b7d18bed55797..38f3e02751b973b911541d8a01b0d8bfd61fd460 100644 --- a/app/code/Magento/Core/Model/Config/ValidationState.php +++ b/lib/Magento/App/Config/ValidationState.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; class ValidationState implements \Magento\Config\ValidationStateInterface { diff --git a/lib/Magento/App/Cron.php b/lib/Magento/App/Cron.php new file mode 100644 index 0000000000000000000000000000000000000000..e4f10f8484ac2c1844d93f76e971ace18347ecca --- /dev/null +++ b/lib/Magento/App/Cron.php @@ -0,0 +1,67 @@ +<?php +/** + * Cron application + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App; + +use \Magento\Config\ScopeInterface, + \Magento\App\ObjectManager\ConfigLoader, + \Magento\Event\ManagerInterface; + +class Cron implements \Magento\AppInterface +{ + /** + * @var \Magento\Event\ManagerInterface + */ + protected $_eventManager; + + /** + * @var State + */ + protected $_state; + + /** + * @param ManagerInterface $eventManager + * @param State $state + */ + public function __construct( + ManagerInterface $eventManager, + State $state + ) { + $this->_eventManager = $eventManager; + $this->_state = $state; + } + + /** + * Execute application + * + * @return int + */ + public function execute() + { + $this->_state->setAreaCode('crontab'); + $this->_eventManager->dispatch('default'); + return 0; + } +} diff --git a/lib/Magento/App/DefaultPath/DefaultPath.php b/lib/Magento/App/DefaultPath/DefaultPath.php new file mode 100644 index 0000000000000000000000000000000000000000..32b39d308b25b78dc40432df153945797337156c --- /dev/null +++ b/lib/Magento/App/DefaultPath/DefaultPath.php @@ -0,0 +1,55 @@ +<?php +/** + * Application default url + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App\DefaultPath; + +class DefaultPath implements \Magento\App\DefaultPathInterface +{ + /** + * Default path parts + * + * @var array + */ + protected $_parts; + + /** + * @param array $parts + */ + public function __construct(array $parts) + { + $this->_parts = $parts; + } + + /** + * Retrieve path part by key + * + * @param string $code + * @return string + */ + public function getPart($code) + { + return isset($this->_parts[$code]) ? $this->_parts[$code] : null; + } +} \ No newline at end of file diff --git a/lib/Magento/App/DefaultPathInterface.php b/lib/Magento/App/DefaultPathInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..757998877586dd1e20f28503a0a59b794622a3e4 --- /dev/null +++ b/lib/Magento/App/DefaultPathInterface.php @@ -0,0 +1,35 @@ +<?php +/** + * Abstract application router + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App; + +interface DefaultPathInterface +{ + /** + * @param string $code + * @return string + */ + public function getPart($code); +} \ No newline at end of file diff --git a/lib/Magento/App/Dir.php b/lib/Magento/App/Dir.php index 5ac0e745a96aef167e5a05983bbd6bab0e816358..f9ad9d74171e34a2c2c8501b1d79375d21006c48 100644 --- a/lib/Magento/App/Dir.php +++ b/lib/Magento/App/Dir.php @@ -30,6 +30,16 @@ namespace Magento\App; class Dir { + /** + * Custom application dirs + */ + const PARAM_APP_DIRS = 'app_dirs'; + + /** + * Custom application uris + */ + const PARAM_APP_URIS = 'app_uris'; + /** * Code base root */ diff --git a/lib/Magento/App/EntryPoint/EntryPoint.php b/lib/Magento/App/EntryPoint/EntryPoint.php new file mode 100644 index 0000000000000000000000000000000000000000..163829840eeeb9fa972d4ad8d6aafed24d9d2efa --- /dev/null +++ b/lib/Magento/App/EntryPoint/EntryPoint.php @@ -0,0 +1,104 @@ +<?php +/** + * Application entry point, used to bootstrap and run application + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App\EntryPoint; + +use Magento\App\State, + Magento\App\EntryPointInterface, + Magento\ObjectManager; +use Magento\Webapi\Exception; + +class EntryPoint implements EntryPointInterface +{ + /** + * @var string + */ + protected $_rootDir; + + /** + * @var array + */ + protected $_parameters; + + /** + * Application object manager + * + * @var ObjectManager + */ + protected $_locator; + + /** + * @param string $rootDir + * @param array $parameters + * @param ObjectManager $objectManager + * @SuppressWarnings(PHPMD.ExitExpression) + */ + public function __construct( + $rootDir, + array $parameters = array(), + ObjectManager $objectManager = null + ) { + $this->_rootDir = $rootDir; + $this->_parameters = $parameters; + $this->_locator = $objectManager; + } + + /** + * Run application + * + * @param string $applicationName + * @param array $arguments + * @return int + */ + public function run($applicationName, array $arguments = array()) + { + try { + if (!$this->_locator) { + $locatorFactory = new \Magento\App\ObjectManagerFactory(); + $this->_locator = $locatorFactory->create($this->_rootDir, $this->_parameters); + } + return $this->_locator->create($applicationName, $arguments)->execute(); + } catch (\Exception $exception) { + if (isset($this->_parameters[state::PARAM_MODE]) + && $this->_parameters[State::PARAM_MODE] == State::MODE_DEVELOPER + ) { + print $exception->getMessage() . "\n\n"; + print $exception->getTraceAsString(); + } else { + $message = "Error happened during application run.\n"; + try { + if (!$this->_locator) { + throw new \DomainException(); + } + $this->_locator->get('Magento\Core\Model\Logger')->logException($exception); + } catch (\Exception $e) { + $message .= "Could not write error message to log. Please use developer mode to see the message.\n"; + } + print $message; + } + return 1; + } + } +} diff --git a/lib/Magento/App/EntryPointInterface.php b/lib/Magento/App/EntryPointInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..002127e82069ba8ee2d043c520eef1447deb4a0f --- /dev/null +++ b/lib/Magento/App/EntryPointInterface.php @@ -0,0 +1,35 @@ +<?php +/** + * Application entry point. Bootstraps and runs application + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App; + +interface EntryPointInterface +{ + /** + * @param string $applicationName + * @param array $arguments + */ + public function run($applicationName, array $arguments = array()); +} diff --git a/lib/Magento/App/Error/Handler.php b/lib/Magento/App/Error/Handler.php new file mode 100644 index 0000000000000000000000000000000000000000..b59e900001029a0462c5b036f2ea5addac3ed16d --- /dev/null +++ b/lib/Magento/App/Error/Handler.php @@ -0,0 +1,102 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Default Error Handler + */ +namespace Magento\App\Error; + +class Handler extends \Magento\Error\Handler +{ + /** + * @var \Magento\Logger + */ + protected $_logger; + + /** + * @var \Magento\App\Dir + */ + protected $_dir; + + /** + * @var \Magento\App\State + */ + protected $_appState; + + /** + * @param \Magento\Logger $logger + * @param \Magento\App\Dir $dir + * @param \Magento\App\State $appState + */ + public function __construct( + \Magento\Logger $logger, + \Magento\App\Dir $dir, + \Magento\App\State $appState + ) { + $this->_logger = $logger; + $this->_dir = $dir; + $this->_appState = $appState; + } + + /** + * Process exception + * + * @param \Exception $exception + * @param array $params + */ + public function processException(\Exception $exception, array $params = array()) + { + if ($this->_appState->getMode() == \Magento\App\State::MODE_DEVELOPER) { + parent::processException($exception, $params); + } else { + $reportData = array($exception->getMessage(), $exception->getTraceAsString()) + $params; + // retrieve server data + if (isset($_SERVER)) { + if (isset($_SERVER['REQUEST_URI'])) { + $reportData['url'] = $_SERVER['REQUEST_URI']; + } + if (isset($_SERVER['SCRIPT_NAME'])) { + $reportData['script_name'] = $_SERVER['SCRIPT_NAME']; + } + } + require_once($this->_dir->getDir(\Magento\App\Dir::PUB) . DS . 'errors' . DS . 'report.php'); + } + } + + /** + * Show error as exception or log it + * + * @throws \Exception + */ + protected function _processError($errorMessage) + { + if ($this->_appState->getMode() == \Magento\App\State::MODE_DEVELOPER) { + parent::_processError($errorMessage); + } else { + $exception = new \Exception($errorMessage); + $errorMessage .= $exception->getTraceAsString(); + $this->_logger->log($errorMessage, \Zend_Log::ERR); + } + } +} diff --git a/lib/Magento/App/FrontController.php b/lib/Magento/App/FrontController.php index 52e0d7760dbf11b4a24efcc7dace7afffbdd7a6b..bd2847d5f23febf3ba2dc808d98048c771eeb851 100644 --- a/lib/Magento/App/FrontController.php +++ b/lib/Magento/App/FrontController.php @@ -33,7 +33,7 @@ class FrontController implements FrontControllerInterface protected $_defaults = array(); /** - * @var \Magento\App\RouterList + * @var \Magento\App\RouterInterface[] */ protected $_routerList; @@ -47,67 +47,26 @@ class FrontController implements FrontControllerInterface */ protected $_response; - /** - * @var \Magento\Event\ManagerInterface - */ - protected $_eventManager; - /** * @var ActionInterface */ protected $_action; /** - * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\App\ResponseInterface $response * @param RouterList $routerList * @param array $data * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( - \Magento\Event\ManagerInterface $eventManager, \Magento\App\ResponseInterface $response, RouterList $routerList, array $data = array() ) { - $this->_eventManager = $eventManager; $this->_routerList = $routerList; $this->_response = $response; } - /** - * Set Default Value - * - * @param string $key - * @param mixed $value - * @return $this - */ - public function setDefault($key, $value = null) - { - if (is_array($key)) { - $this->_defaults = $key; - } else { - $this->_defaults[$key] = $value; - } - return $this; - } - - /** - * Retrieve default value - * - * @param string $key - * @return mixed - */ - public function getDefault($key=null) - { - if (is_null($key)) { - return $this->_defaults; - } elseif (isset($this->_defaults[$key])) { - return $this->_defaults[$key]; - } - return false; - } - /** * Retrieve request object * @@ -148,6 +107,7 @@ class FrontController implements FrontControllerInterface /** * @param RequestInterface $request + * @return ResponseInterface * @throws \LogicException */ public function dispatch(RequestInterface $request) @@ -156,11 +116,7 @@ class FrontController implements FrontControllerInterface \Magento\Profiler::start('routers_match'); $routingCycleCounter = 0; while (!$request->isDispatched() && $routingCycleCounter++ < 100) { - /** @var $router \Magento\App\Router\AbstractRouter */ - foreach ($this->_routerList->getRouters() as $router) { - $router->setFront($this); - - /** @var $controllerInstance \Magento\App\ActionInterface */ + foreach ($this->_routerList as $router) { $controllerInstance = $router->match($this->getRequest()); if ($controllerInstance) { $controllerInstance->dispatch($request->getActionName()); @@ -172,12 +128,6 @@ class FrontController implements FrontControllerInterface if ($routingCycleCounter > 100) { throw new \LogicException('Front controller reached 100 router match iterations'); } - // This event gives possibility to launch something before sending output (allow cookie setting) - $this->_eventManager->dispatch('controller_front_send_response_before', array('front' => $this)); - \Magento\Profiler::start('send_response'); - $this->_eventManager->dispatch('http_response_send_before', array('response' => $this)); - $this->getResponse()->sendResponse(); - \Magento\Profiler::stop('send_response'); - $this->_eventManager->dispatch('controller_front_send_response_after', array('front' => $this)); + return $this->getResponse(); } } diff --git a/lib/Magento/App/FrontControllerInterface.php b/lib/Magento/App/FrontControllerInterface.php index fe382c2a00f094eae470da505c43867ef1ef8cf2..6af31082f36790103b76f2f82acdeab02adc52a3 100644 --- a/lib/Magento/App/FrontControllerInterface.php +++ b/lib/Magento/App/FrontControllerInterface.php @@ -31,6 +31,7 @@ interface FrontControllerInterface * Dispatch application action * * @param RequestInterface $request + * @return ResponseInterface */ public function dispatch(RequestInterface $request); } diff --git a/lib/Magento/App/Http.php b/lib/Magento/App/Http.php new file mode 100644 index 0000000000000000000000000000000000000000..14c3ec801ae284deb3fe6a01e29d18195f2550ae --- /dev/null +++ b/lib/Magento/App/Http.php @@ -0,0 +1,151 @@ +<?php +/** + * Http application + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App; + +use \Magento\Config\Scope, + \Magento\App\ObjectManager\ConfigLoader, + \Magento\Event; + +class Http implements \Magento\AppInterface +{ + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\Event\Manager + */ + protected $_eventManager; + + /** + * @var AreaList + */ + protected $_areaList; + + /** + * @var RequestInterface + */ + protected $_request; + + /** + * @var \Magento\Config\Scope + */ + protected $_configScope; + + /** + * @var ConfigLoader + */ + protected $_configLoader; + + /** + * @var State + */ + protected $_state; + + /** + * @var Dir + */ + protected $_dir; + + /** + * @param \Magento\ObjectManager $objectManager + * @param Event\Manager $eventManager + * @param AreaList $areaList + * @param RequestInterface $request + * @param Scope $configScope + * @param ConfigLoader $configLoader + * @param State $state + * @param Dir $dir + */ + public function __construct( + \Magento\ObjectManager $objectManager, + Event\Manager $eventManager, + AreaList $areaList, + RequestInterface $request, + Scope $configScope, + ConfigLoader $configLoader, + State $state, + Dir $dir + ) { + $this->_objectManager = $objectManager; + $this->_eventManager = $eventManager; + $this->_areaList = $areaList; + $this->_request = $request; + $this->_configScope = $configScope; + $this->_configLoader = $configLoader; + $this->_state = $state; + $this->_dir = $dir; + } + + /** + * Execute application + */ + public function execute() + { + try { + $areaCode = $this->_areaList->getCodeByFrontName($this->_request->getFrontName()); + $this->_state->setAreaCode($areaCode); + $this->_objectManager->configure($this->_configLoader->load($areaCode)); + $response = $this->_objectManager->get('Magento\App\FrontControllerInterface')->dispatch($this->_request); + // This event gives possibility to launch something before sending output (allow cookie setting) + $eventParams = array('request' => $this->_request, 'response' => $response); + $this->_eventManager->dispatch('controller_front_send_response_before', $eventParams); + \Magento\Profiler::start('send_response'); + $response->sendResponse(); + \Magento\Profiler::stop('send_response'); + $this->_eventManager->dispatch('controller_front_send_response_after', $eventParams); + return 0; + } catch(\Exception $exception) { + echo $exception->getMessage() . "\n"; + try { + if ($this->_state->getMode() == State::MODE_DEVELOPER) { + header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500); + print '<pre>'; + print $exception->getMessage() . "\n\n"; + print $exception->getTraceAsString(); + print '</pre>'; + } else { + $reportData = array($exception->getMessage(), $exception->getTraceAsString()); + // retrieve server data + if (isset($_SERVER)) { + if (isset($_SERVER['REQUEST_URI'])) { + $reportData['url'] = $_SERVER['REQUEST_URI']; + } + if (isset($_SERVER['SCRIPT_NAME'])) { + $reportData['script_name'] = $_SERVER['SCRIPT_NAME']; + } + } + require_once ($this->_dir->getDir(Dir::PUB) . DS . 'errors' . DS . 'report.php'); + } + } catch (\Exception $exception) { + header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500); + print "Unknown error happened."; + } + return -1; + } + } +} diff --git a/lib/Magento/App/ObjectManager.php b/lib/Magento/App/ObjectManager.php new file mode 100644 index 0000000000000000000000000000000000000000..29e623ba424fb706b9f2c6f08c5b5eb80cbad9af --- /dev/null +++ b/lib/Magento/App/ObjectManager.php @@ -0,0 +1,83 @@ +<?php +/** + * Magento application object manager. Configures and application application + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App; +use Magento\ObjectManager\Factory; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class ObjectManager extends \Magento\ObjectManager\ObjectManager +{ + /** + * @var \Magento\App\ObjectManager + */ + protected static $_instance; + + /** + * @var \Magento\ObjectManager\Relations + */ + protected $_compiledRelations; + + /** + * Retrieve object manager + * + * TODO: Temporary solution for serialization, should be removed when Serialization problem is resolved + * + * @deprecated + * @return \Magento\ObjectManager + * @throws \RuntimeException + */ + public static function getInstance() + { + if (!self::$_instance instanceof \Magento\ObjectManager) { + throw new \RuntimeException('ObjectManager isn\'t initialized'); + } + return self::$_instance; + } + + /** + * Set object manager instance + * + * @param \Magento\ObjectManager $objectManager + * @throws \LogicException + */ + public static function setInstance(\Magento\ObjectManager $objectManager) + { + self::$_instance = $objectManager; + } + + /** + * @param Factory $factory + * @param \Magento\ObjectManager\Config $config + * @param array $sharedInstances + */ + public function __construct( + Factory $factory = null, \Magento\ObjectManager\Config $config = null, array $sharedInstances = array() + ) { + parent::__construct($factory, $config, $sharedInstances); + self::$_instance = $this; + } +} diff --git a/app/code/Magento/Core/Model/ObjectManager/ConfigCache.php b/lib/Magento/App/ObjectManager/ConfigCache.php similarity index 96% rename from app/code/Magento/Core/Model/ObjectManager/ConfigCache.php rename to lib/Magento/App/ObjectManager/ConfigCache.php index a657c6da5ab3877ccbb506d6fbdca032a39b7733..c04219569f3037c11677eba66281ee6c445d9e96 100644 --- a/app/code/Magento/Core/Model/ObjectManager/ConfigCache.php +++ b/lib/Magento/App/ObjectManager/ConfigCache.php @@ -1,5 +1,7 @@ <?php /** + * Object manager configuration cache + * * Magento * * NOTICE OF LICENSE @@ -22,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\ObjectManager; +namespace Magento\App\ObjectManager; class ConfigCache implements \Magento\ObjectManager\ConfigCache { diff --git a/app/code/Magento/Core/Model/ObjectManager/ConfigLoader.php b/lib/Magento/App/ObjectManager/ConfigLoader.php similarity index 97% rename from app/code/Magento/Core/Model/ObjectManager/ConfigLoader.php rename to lib/Magento/App/ObjectManager/ConfigLoader.php index 117f6799ca3f61a24c040e29c3036499b2178e72..cb5c244426034210cbb99ff16e2a46a4e3b9bf1f 100644 --- a/app/code/Magento/Core/Model/ObjectManager/ConfigLoader.php +++ b/lib/Magento/App/ObjectManager/ConfigLoader.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\ObjectManager; +namespace Magento\App\ObjectManager; class ConfigLoader { diff --git a/app/code/Magento/Core/Model/ObjectManager/ConfigLoader/Primary.php b/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php similarity index 87% rename from app/code/Magento/Core/Model/ObjectManager/ConfigLoader/Primary.php rename to lib/Magento/App/ObjectManager/ConfigLoader/Primary.php index d8d4bb71f00026502445812da8e9e34fb6c24ca1..253b364fd38e60f92abb9f4bcc6a644550227cc3 100644 --- a/app/code/Magento/Core/Model/ObjectManager/ConfigLoader/Primary.php +++ b/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php @@ -1,5 +1,7 @@ <?php /** + * Primary configuration loader for application object manager + * * Magento * * NOTICE OF LICENSE @@ -21,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\ObjectManager\ConfigLoader; +namespace Magento\App\ObjectManager\ConfigLoader; class Primary { @@ -55,10 +57,10 @@ class Primary public function load() { $reader = new \Magento\ObjectManager\Config\Reader\Dom( - new \Magento\Core\Model\Config\FileResolver\Primary($this->_dirs), + new \Magento\App\Config\FileResolver\Primary($this->_dirs), new \Magento\ObjectManager\Config\Mapper\Dom(), new \Magento\ObjectManager\Config\SchemaLocator(), - new \Magento\Core\Model\Config\ValidationState($this->_appMode) + new \Magento\App\Config\ValidationState($this->_appMode) ); return $reader->read('primary'); diff --git a/lib/Magento/App/ObjectManagerFactory.php b/lib/Magento/App/ObjectManagerFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..8ac370c8441bf38774dc9dbe7047e3119b54f560 --- /dev/null +++ b/lib/Magento/App/ObjectManagerFactory.php @@ -0,0 +1,173 @@ +<?php +/** + * Initialize application object manager. + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\App; + +use Magento\App\Dir, + Magento\App\Config, + Magento\ObjectManager\Factory\Factory, + Magento\Profiler; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * Class ObjectManagerFactory + * @package Magento\App + */ +class ObjectManagerFactory +{ + /** + * Locator class name + * + * @var string + */ + protected $_locatorClassName = '\Magento\ObjectManager\ObjectManager'; + + /** + * Config class name + * + * @var string + */ + protected $_configClassName = '\Magento\ObjectManager\Config\Config'; + + /** + * Create object manager + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + * @SuppressWarnings(PHPMD.NPathComplexity) + * + * @param string $rootDir + * @param array $arguments + * @return \Magento\ObjectManager\ObjectManager + * @throws \Magento\BootstrapException + */ + public function create($rootDir, array $arguments) + { + $directories = new Dir( + $rootDir, + isset($arguments[Dir::PARAM_APP_URIS]) ? $arguments[Dir::PARAM_APP_URIS] : array(), + isset($arguments[Dir::PARAM_APP_DIRS]) ? $arguments[Dir::PARAM_APP_DIRS] : array() + ); + + \Magento\Autoload\IncludePath::addIncludePath(array($directories->getDir(Dir::GENERATION))); + + $options = new Config( + $arguments, + new Config\Loader( + $directories, + isset($arguments[Config\Loader::PARAM_CUSTOM_FILE]) + ? $arguments[Config\Loader::PARAM_CUSTOM_FILE] + : null + ) + ); + + $definitionFactory = new \Magento\ObjectManager\DefinitionFactory( + $directories->getDir(DIR::DI), + $directories->getDir(DIR::GENERATION), + $options->get('definition.format', 'serialized') + ); + + $definitions = $definitionFactory->createClassDefinition($options->get('definitions')); + $relations = $definitionFactory->createRelations(); + $configClass = $this->_configClassName; + /** @var \Magento\ObjectManager\Config\Config $diConfig */ + $diConfig = new $configClass($relations, $definitions); + $appMode = $options->get(State::PARAM_MODE, State::MODE_DEFAULT); + + $configData = $this->_loadPrimaryConfig($directories, $appMode); + + if ($configData) { + $diConfig->extend($configData); + } + + $factory = new Factory($diConfig, null, $definitions, $options->get()); + + $className = $this->_locatorClassName; + /** @var \Magento\ObjectManager $locator */ + $locator = new $className($factory, $diConfig, array( + 'Magento\App\Config' => $options, + 'Magento\App\Dir' => $directories + )); + + \Magento\App\ObjectManager::setInstance($locator); + + /** @var \Magento\App\Dir\Verification $verification */ + $verification = $locator->get('Magento\App\Dir\Verification'); + $verification->createAndVerifyDirectories(); + + $diConfig->setCache($locator->get('Magento\App\ObjectManager\ConfigCache')); + $locator->configure( + $locator->get('Magento\App\ObjectManager\ConfigLoader')->load('global') + ); + $locator->get('Magento\Config\ScopeInterface')->setCurrentScope('global'); + $locator->get('Magento\App\Resource')->setCache($locator->get('Magento\App\CacheInterface')); + + $relations = $definitionFactory->createRelations(); + + $interceptionConfig = $locator->create('Magento\Interception\Config\Config', array( + 'relations' => $relations, + 'omConfig' => $diConfig, + 'classDefinitions' => $definitions instanceof \Magento\ObjectManager\Definition\Compiled + ? $definitions + : null, + )); + + $pluginList = $locator->create('Magento\Interception\PluginList\PluginList', array( + 'relations' => $relations, + 'definitions' => $definitionFactory->createPluginDefinition(), + 'omConfig' => $diConfig, + 'classDefinitions' => $definitions instanceof \Magento\ObjectManager\Definition\Compiled + ? $definitions + : null, + )); + $factory = $locator->create('Magento\Interception\FactoryDecorator', array( + 'factory' => $factory, + 'config' => $interceptionConfig, + 'pluginList' => $pluginList + )); + $locator->setFactory($factory); + return $locator; + } + + /** + * Load primary config data + * + * @param Dir $directories + * @param string $appMode + * @return array + * @throws \Magento\BootstrapException + */ + protected function _loadPrimaryConfig(Dir $directories, $appMode) + { + $configData = null; + $primaryLoader = new \Magento\App\ObjectManager\ConfigLoader\Primary($directories, $appMode); + try { + $configData = $primaryLoader->load(); + } catch (\Exception $e) { + throw new \Magento\BootstrapException($e->getMessage()); + } + return $configData; + } +} \ No newline at end of file diff --git a/lib/Magento/App/Request/Http.php b/lib/Magento/App/Request/Http.php index 218f6fdcc2f4870d91aed90ff6514a8a62351a4a..819b1bc4b2188a70e0ec91d5dac69ec97dd4eb42 100644 --- a/lib/Magento/App/Request/Http.php +++ b/lib/Magento/App/Request/Http.php @@ -67,9 +67,9 @@ class Http extends \Zend_Controller_Request_Http implements \Magento\App\Request protected $_beforeForwardInfo = array(); /** - * @var \Magento\App\RouterListInterface + * @var \Magento\App\Route\ConfigInterface */ - protected $_routerList; + protected $_routeConfig; /** * @var PathInfoProcessorInterface @@ -77,18 +77,18 @@ class Http extends \Zend_Controller_Request_Http implements \Magento\App\Request private $_pathInfoProcessor; /** - * @param \Magento\App\RouterListInterface $routerList + * @param \Magento\App\Route\ConfigInterface $routeConfig * @param string $uri * @param array $directFrontNames * @param PathInfoProcessorInterface $pathInfoProcessor */ public function __construct( - \Magento\App\RouterListInterface $routerList, + \Magento\App\Route\ConfigInterface $routeConfig, $uri = null, $directFrontNames = array(), \Magento\App\Request\PathInfoProcessorInterface $pathInfoProcessor = null ) { - $this->_routerList = $routerList; + $this->_routeConfig = $routeConfig; $this->_directFrontNames = $directFrontNames; parent::__construct($uri); $this->_pathInfoProcessor = $pathInfoProcessor; @@ -226,11 +226,7 @@ class Http extends \Zend_Controller_Request_Http implements \Magento\App\Request public function setRouteName($route) { $this->_route = $route; - $router = $this->_routerList->getRouterByRoute($route); - if (!$router) { - return $this; - } - $module = $router->getFrontNameByRoute($route); + $module = $this->_routeConfig->getRouteFrontName($route); if ($module) { $this->setModuleName($module); } @@ -384,8 +380,7 @@ class Http extends \Zend_Controller_Request_Http implements \Magento\App\Request if ($this->_requestedRouteName === null) { if ($this->_rewritedPathInfo !== null && isset($this->_rewritedPathInfo[0])) { $frontName = $this->_rewritedPathInfo[0]; - $router = $this->_routerList->getRouterByFrontName($frontName); - $this->_requestedRouteName = $router->getRouteByFrontName($frontName); + $this->_requestedRouteName = $this->_routeConfig->getRouteByFrontName($frontName); } else { // no rewritten path found, use default route name return $this->getRouteName(); diff --git a/app/code/Magento/Core/Model/Resource.php b/lib/Magento/App/Resource.php similarity index 71% rename from app/code/Magento/Core/Model/Resource.php rename to lib/Magento/App/Resource.php index 00484ecb40dcc9e1593ef748efad3c3b064ad3b9..0374460798595691d5d841b3421c84c646a700b4 100644 --- a/app/code/Magento/Core/Model/Resource.php +++ b/lib/Magento/App/Resource.php @@ -23,16 +23,16 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\App; class Resource { - const AUTO_UPDATE_CACHE_KEY = 'DB_AUTOUPDATE'; const AUTO_UPDATE_ONCE = 0; const AUTO_UPDATE_NEVER = -1; const AUTO_UPDATE_ALWAYS = 1; const PARAM_TABLE_PREFIX = 'db.table_prefix'; + const DEFAULT_READ_RESOURCE = 'core_read'; /** * Instances of actual connections @@ -51,21 +51,21 @@ class Resource /** * Resource config * - * @var \Magento\Core\Model\Config\ResourceInterface + * @var \Magento\App\Resource\ConfigInterface */ - protected $_resourceConfig; + protected $_config; /** * Resource connection adapter factory * - * @var \Magento\Core\Model\Resource\ConnectionFactory + * @var \Magento\App\Resource\ConnectionFactory */ protected $_connectionFactory; /** * Application cache * - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $_cache; @@ -75,27 +75,19 @@ class Resource protected $_tablePrefix; /** - * @var \Magento\Core\Model\AppInterface - */ - protected $_app; - - /** - * @param \Magento\Core\Model\CacheInterface $cache - * @param \Magento\Core\Model\AppInterface $app - * @param \Magento\Core\Model\Config\ResourceInterface $resourceConfig - * @param \Magento\Core\Model\Resource\ConnectionFactory $adapterFactory + * @param \Magento\App\CacheInterface $cache + * @param \Magento\App\Resource\ConfigInterface $resourceConfig + * @param \Magento\App\Resource\ConnectionFactory $adapterFactory * @param string $tablePrefix */ public function __construct( - \Magento\Core\Model\CacheInterface $cache, - \Magento\Core\Model\AppInterface $app, - \Magento\Core\Model\Config\ResourceInterface $resourceConfig, - \Magento\Core\Model\Resource\ConnectionFactory $adapterFactory, + \Magento\App\CacheInterface $cache, + Resource\ConfigInterface $resourceConfig, + Resource\ConnectionFactory $adapterFactory, $tablePrefix = '' ) { $this->_cache = $cache; - $this->_app = $app; - $this->_resourceConfig = $resourceConfig; + $this->_config = $resourceConfig; $this->_connectionFactory = $adapterFactory; $this->_tablePrefix = $tablePrefix; } @@ -103,21 +95,22 @@ class Resource /** * Set cache instance * - * @param \Magento\Core\Model\CacheInterface $cache + * @param \Magento\App\CacheInterface $cache */ - public function setCache(\Magento\Core\Model\CacheInterface $cache) + public function setCache(\Magento\App\CacheInterface $cache) { $this->_cache = $cache; } /** - * Retrieve connection adapter class name by connection type + * Set table prefix + * Added for console installation * - * @param \Magento\Core\Model\Config\ResourceInterface $resourceConfig + * @param string $tablePrefix */ - public function setConfig(\Magento\Core\Model\Config\ResourceInterface $resourceConfig) + public function setTablePrefix($tablePrefix) { - $this->_resourceConfig = $resourceConfig; + $this->_tablePrefix = $tablePrefix; } /** @@ -128,7 +121,7 @@ class Resource */ public function getConnection($resourceName) { - $connectionName = $this->_resourceConfig->getConnectionName($resourceName); + $connectionName = $this->_config->getConnectionName($resourceName); if (isset($this->_connections[$connectionName])) { return $this->_connections[$connectionName]; } @@ -143,16 +136,6 @@ class Resource return $connection; } - /** - * Retrieve default connection name by required connection name - * - * @param string $requiredConnectionName - * @return string - */ - protected function _getDefaultResourceName($requiredConnectionName) - { - } - /** * Get resource table name, validated by db adapter * @@ -181,8 +164,7 @@ class Resource if ($tableSuffix) { $tableName .= '_' . $tableSuffix; } - return $this->getConnection('core_read') - ->getTableName($tableName); + return $this->getConnection(self::DEFAULT_READ_RESOURCE)->getTableName($tableName); } /** @@ -190,7 +172,7 @@ class Resource * * @param string $tableName * @param string $mappedName - * @return \Magento\Core\Model\Resource + * @return \Magento\App\Resource */ public function setMappedTableName($tableName, $mappedName) { @@ -213,20 +195,6 @@ class Resource } } - public function checkDbConnection() - { - } - - public function getAutoUpdate() - { - return self::AUTO_UPDATE_ALWAYS; - } - - public function setAutoUpdate($value) - { - return $this; - } - /** * Retrieve 32bit UNIQUE HASH for a Table index * @@ -237,7 +205,7 @@ class Resource */ public function getIdxName($tableName, $fields, $indexType = \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX) { - return $this->getConnection('core_read') + return $this->getConnection(self::DEFAULT_READ_RESOURCE) ->getIndexName($this->getTableName($tableName), $fields, $indexType); } @@ -252,7 +220,7 @@ class Resource */ public function getFkName($priTableName, $priColumnName, $refTableName, $refColumnName) { - return $this->getConnection('core_read') + return $this->getConnection(self::DEFAULT_READ_RESOURCE) ->getForeignKeyName($this->getTableName($priTableName), $priColumnName, $this->getTableName($refTableName), $refColumnName); } diff --git a/app/code/Magento/Core/Model/Config/Resource.php b/lib/Magento/App/Resource/Config.php similarity index 74% rename from app/code/Magento/Core/Model/Config/Resource.php rename to lib/Magento/App/Resource/Config.php index e6fbae397cd17f615f89d82039b273ddfadd6028..291f5156f3306aad6ca738f481143d26a3c65a80 100644 --- a/app/code/Magento/Core/Model/Config/Resource.php +++ b/lib/Magento/App/Resource/Config.php @@ -23,13 +23,14 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Resource; -class Resource extends \Magento\Config\Data\Scoped - implements \Magento\Core\Model\Config\ResourceInterface +class Config extends \Magento\Config\Data\Scoped + implements \Magento\App\Resource\ConfigInterface { const DEFAULT_SETUP_CONNECTION = 'default'; + const PARAM_INITIAL_RESOURCES = 'resource'; /** * List of connection names per resource * @@ -38,18 +39,27 @@ class Resource extends \Magento\Config\Data\Scoped protected $_connectionNames = array(); /** - * @param \Magento\Core\Model\Resource\Config\Reader $reader + * @param Config\Reader $reader * @param \Magento\Config\ScopeInterface $configScope * @param \Magento\Config\CacheInterface $cache * @param string $cacheId + * @param array $initialResources + * @throws \InvalidArgumentException */ public function __construct( - \Magento\Core\Model\Resource\Config\Reader $reader, + Config\Reader $reader, \Magento\Config\ScopeInterface $configScope, \Magento\Config\CacheInterface $cache, - $cacheId = 'resourcesCache' + $cacheId = 'resourcesCache', + $initialResources = array() ) { parent::__construct($reader, $configScope, $cache, $cacheId); + foreach ($initialResources as $resourceName => $resourceData) { + if (!isset($resourceData['connection'])) { + throw new \InvalidArgumentException('Invalid initial resource configuration'); + } + $this->_connectionNames[$resourceName] = $resourceData['connection']; + } } /** @@ -71,6 +81,9 @@ class Resource extends \Magento\Config\Data\Scoped $connectionName = $resourcesConfig[$pointerResourceName]['connection']; $this->_connectionNames[$resourceName] = $connectionName; break; + } elseif (isset($this->_connectionNames[$pointerResourceName])) { + $this->_connectionNames[$resourceName] = $this->_connectionNames[$pointerResourceName]; + break; } elseif (isset($resourcesConfig[$pointerResourceName]['extends'])) { $pointerResourceName = $resourcesConfig[$pointerResourceName]['extends']; } else { diff --git a/app/code/Magento/Core/Model/Resource/Config/Converter.php b/lib/Magento/App/Resource/Config/Converter.php similarity index 97% rename from app/code/Magento/Core/Model/Resource/Config/Converter.php rename to lib/Magento/App/Resource/Config/Converter.php index 53022f623ef081c4061f4c8d92ba67ac05a60f55..9c00a49c357d265b0e767041e8aed87805989d97 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Converter.php +++ b/lib/Magento/App/Resource/Config/Converter.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Config; +namespace Magento\App\Resource\Config; class Converter implements \Magento\Config\ConverterInterface { diff --git a/app/code/Magento/Core/Model/Resource/Config/Reader.php b/lib/Magento/App/Resource/Config/Reader.php similarity index 66% rename from app/code/Magento/Core/Model/Resource/Config/Reader.php rename to lib/Magento/App/Resource/Config/Reader.php index 62814cbf3ff0905f600cd5222a557fdb71e48586..04386d522b0ae4f98daa06254ca73bb9dee335ef 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Reader.php +++ b/lib/Magento/App/Resource/Config/Reader.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Config; +namespace Magento\App\Resource\Config; class Reader extends \Magento\Config\Reader\Filesystem { @@ -36,44 +36,31 @@ class Reader extends \Magento\Config\Reader\Filesystem '/config/resource' => 'name' ); - /** - * @var \Magento\Core\Model\Config\Local - */ - protected $_configLocal; - /** * @param \Magento\Config\FileResolverInterface $fileResolver - * @param \Magento\Core\Model\Resource\Config\Converter $converter - * @param \Magento\Core\Model\Resource\Config\SchemaLocator $schemaLocator + * @param \Magento\App\Resource\Config\Converter $converter + * @param \Magento\App\Resource\Config\SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState - * @param \Magento\Core\Model\Config\Local $configLocal * @param string $fileName */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, - \Magento\Core\Model\Resource\Config\Converter $converter, - \Magento\Core\Model\Resource\Config\SchemaLocator $schemaLocator, + \Magento\App\Resource\Config\Converter $converter, + \Magento\App\Resource\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, - \Magento\Core\Model\Config\Local $configLocal, $fileName = 'resources.xml' ) { - $this->_configLocal = $configLocal; parent::__construct($fileResolver, $converter, $schemaLocator, $validationState, $fileName); } /** - * Load configuration scope + * Read resource configuration * - * @param string|null $scope + * @param string $scope * @return array - * @SuppressWarnings(PHPMD.NPathComplexity) - * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function read($scope = null) { - $data = parent::read(); - $data = array_replace($data, $this->_configLocal->getResources()); - - return $data; + return ($scope !== 'primary') ? parent::read($scope) : array(); } } diff --git a/lib/Magento/App/Resource/Config/SchemaLocator.php b/lib/Magento/App/Resource/Config/SchemaLocator.php new file mode 100644 index 0000000000000000000000000000000000000000..57db1e856764fa6cdcfd51fb94bbfc853f734829 --- /dev/null +++ b/lib/Magento/App/Resource/Config/SchemaLocator.php @@ -0,0 +1,49 @@ +<?php +/** + * Resource configuration schema locator + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App\Resource\Config; + +class SchemaLocator implements \Magento\Config\SchemaLocatorInterface +{ + /** + * Get path to per file validation schema + * + * @return string|null + */ + public function getPerFileSchema() + { + return realpath(__DIR__ . '/../../etc/resources.xsd'); + } + + /** + * Get path to merged config schema + * + * @return string|null + */ + public function getSchema() + { + return $this->getPerFileSchema(); + } +} diff --git a/app/code/Magento/Core/Model/Config/ResourceInterface.php b/lib/Magento/App/Resource/ConfigInterface.php similarity index 94% rename from app/code/Magento/Core/Model/Config/ResourceInterface.php rename to lib/Magento/App/Resource/ConfigInterface.php index 0e084b210ed7ead84a199c79e48c7f43d35044d8..ba22433576c4e316f45922278b207786fc73366b 100644 --- a/app/code/Magento/Core/Model/Config/ResourceInterface.php +++ b/lib/Magento/App/Resource/ConfigInterface.php @@ -23,9 +23,9 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Resource; -interface ResourceInterface +interface ConfigInterface { /** * Retrieve resource connection instance name diff --git a/app/code/Magento/Core/Model/Resource/ConnectionAdapterInterface.php b/lib/Magento/App/Resource/ConnectionAdapterInterface.php similarity index 96% rename from app/code/Magento/Core/Model/Resource/ConnectionAdapterInterface.php rename to lib/Magento/App/Resource/ConnectionAdapterInterface.php index 2c92e10f549e3cb966b87e9a628cd50239e9e454..bf62f0b534f5ccdb8b7fbd7aeedeb9df1b06c428 100644 --- a/app/code/Magento/Core/Model/Resource/ConnectionAdapterInterface.php +++ b/lib/Magento/App/Resource/ConnectionAdapterInterface.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\App\Resource; interface ConnectionAdapterInterface { diff --git a/app/code/Magento/Core/Model/Resource/ConnectionFactory.php b/lib/Magento/App/Resource/ConnectionFactory.php similarity index 88% rename from app/code/Magento/Core/Model/Resource/ConnectionFactory.php rename to lib/Magento/App/Resource/ConnectionFactory.php index 030f371a4e49d34dfbe66016ebee5539a23c2262..bb6f89960afc4c32465ce30b08661aa21b0b42a7 100644 --- a/app/code/Magento/Core/Model/Resource/ConnectionFactory.php +++ b/lib/Magento/App/Resource/ConnectionFactory.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\App\Resource; class ConnectionFactory { @@ -33,15 +33,15 @@ class ConnectionFactory protected $_objectManager; /** - * @var \Magento\Core\Model\Config\Local + * @var \Magento\App\Config */ protected $_localConfig; /** * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\Config\Local $localConfig + * @param \Magento\App\Config $localConfig */ - public function __construct(\Magento\ObjectManager $objectManager, \Magento\Core\Model\Config\Local $localConfig) + public function __construct(\Magento\ObjectManager $objectManager, \Magento\App\Config $localConfig) { $this->_objectManager = $objectManager; $this->_localConfig = $localConfig; @@ -67,7 +67,7 @@ class ConnectionFactory $adapterInstance = $this->_objectManager->create($connectionConfig['adapter'], $connectionConfig); - if (!($adapterInstance instanceof \Magento\Core\Model\Resource\ConnectionAdapterInterface)) { + if (!($adapterInstance instanceof ConnectionAdapterInterface)) { throw new \InvalidArgumentException('Trying to create wrong connection adapter'); } diff --git a/lib/Magento/App/Route/Config.php b/lib/Magento/App/Route/Config.php new file mode 100644 index 0000000000000000000000000000000000000000..7dfe9a41a19d6b01eeca7db98d7775aad55e522f --- /dev/null +++ b/lib/Magento/App/Route/Config.php @@ -0,0 +1,154 @@ +<?php +/** + * Routes configuration model + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App\Route; + +class Config implements \Magento\App\Route\ConfigInterface +{ + /** + * @var \Magento\App\Route\Config\Reader + */ + protected $_reader; + + /** + * @var \Magento\Cache\FrontendInterface + */ + protected $_cache; + + /** + * @var string + */ + protected $_cacheId; + + /** + * @var \Magento\Config\ScopeInterface + */ + protected $_configScope; + + /** + * @var \Magento\App\AreaList + */ + protected $_areaList; + + /** + * @var array + */ + protected $_routes; + + /** + * @param Config\Reader $reader + * @param \Magento\Config\CacheInterface $cache + * @param \Magento\Config\ScopeInterface $configScope + * @param \Magento\App\AreaList $areaList + * @param string $cacheId + */ + public function __construct( + Config\Reader $reader, + \Magento\Config\CacheInterface $cache, + \Magento\Config\ScopeInterface $configScope, + \Magento\App\AreaList $areaList, + $cacheId = 'RoutesConfig' + ) { + $this->_reader = $reader; + $this->_cache = $cache; + $this->_cacheId = $cacheId; + $this->_configScope = $configScope; + $this->_areaList = $areaList; + } + + /** + * Fetch routes from configs by area code and router id + * + * @param string $scope + * @return array + */ + protected function _getRoutes($scope = null) + { + $scope = $scope ?: $this->_configScope->getCurrentScope(); + if (isset($this->_routes[$scope])) { + return $this->_routes[$scope]; + } + $cacheId = $scope . '::' . $this->_cacheId; + $cachedRoutes = unserialize($this->_cache->load($cacheId)); + if (is_array($cachedRoutes)) { + $this->_routes[$scope] = $cachedRoutes; + return $cachedRoutes; + } + + $routers = $this->_reader->read($scope); + $routes = $routers[$this->_areaList->getDefaultRouter($scope)]['routes']; + $this->_cache->save(serialize($routes), $cacheId); + $this->_routes[$scope] = $routes; + return $routes; + } + + /** + * Retrieve route front name + * + * @param string $routeId + * @param null $scope + * @return string + */ + public function getRouteFrontName($routeId, $scope = null) + { + $routes = $this->_getRoutes($scope); + return isset($routes[$routeId]) ? $routes[$routeId]['frontName'] : $routeId; + } + + /** + * @param string $frontName + * @param string $scope + * @return bool|int|string + */ + public function getRouteByFrontName($frontName, $scope = null) + { + foreach ($this->_getRoutes($scope) as $routeId => $routeData) { + if ($routeData['frontName'] == $frontName) { + return $routeId; + } + } + + return false; + } + + /** + * @param string $frontName + * @param string $scope + * @return array + */ + public function getModulesByFrontName($frontName, $scope = null) + { + $routes = $this->_getRoutes($scope); + $modules = array(); + foreach ($routes as $routeData) { + if ($routeData['frontName'] == $frontName && isset($routeData['modules'])) { + $modules = $routeData['modules']; + break; + } + } + + return array_unique($modules); + } +} diff --git a/app/code/Magento/Core/Model/Route/Config/Converter.php b/lib/Magento/App/Route/Config/Converter.php similarity index 98% rename from app/code/Magento/Core/Model/Route/Config/Converter.php rename to lib/Magento/App/Route/Config/Converter.php index 7f4db35908b756e44ee03126d510d0b114304ebf..89caa8523d0ca3edf7d2ec60a48a4d36509efdc9 100644 --- a/app/code/Magento/Core/Model/Route/Config/Converter.php +++ b/lib/Magento/App/Route/Config/Converter.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Route\Config; +namespace Magento\App\Route\Config; class Converter implements \Magento\Config\ConverterInterface { diff --git a/app/code/Magento/Core/Model/Route/Config/Reader.php b/lib/Magento/App/Route/Config/Reader.php similarity index 84% rename from app/code/Magento/Core/Model/Route/Config/Reader.php rename to lib/Magento/App/Route/Config/Reader.php index dca9ad5df9316d8959afde100925ce9abfcead0b..1782547938933445f646117dccd5a58a62ed325b 100644 --- a/app/code/Magento/Core/Model/Route/Config/Reader.php +++ b/lib/Magento/App/Route/Config/Reader.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Route\Config; +namespace Magento\App\Route\Config; class Reader extends \Magento\Config\Reader\Filesystem { @@ -40,15 +40,15 @@ class Reader extends \Magento\Config\Reader\Filesystem /** * @param \Magento\Config\FileResolverInterface $fileResolver - * @param \Magento\Core\Model\Route\Config\Converter $converter - * @param \Magento\Core\Model\Route\Config\SchemaLocator $schemaLocator + * @param \Magento\App\Route\Config\Converter $converter + * @param \Magento\App\Route\Config\SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, - \Magento\Core\Model\Route\Config\Converter $converter, - \Magento\Core\Model\Route\Config\SchemaLocator $schemaLocator, + \Magento\App\Route\Config\Converter $converter, + \Magento\App\Route\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, $fileName = 'routes.xml' ) { diff --git a/lib/Magento/App/Route/Config/SchemaLocator.php b/lib/Magento/App/Route/Config/SchemaLocator.php new file mode 100644 index 0000000000000000000000000000000000000000..f0e62036c2b61bd3be4a3869ccafc806879e36cf --- /dev/null +++ b/lib/Magento/App/Route/Config/SchemaLocator.php @@ -0,0 +1,49 @@ +<?php +/** + * Routes configuration schema locator + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App\Route\Config; + +class SchemaLocator implements \Magento\Config\SchemaLocatorInterface +{ + /** + * Get path to merged config schema + * + * @return string + */ + public function getSchema() + { + return realpath(__DIR__ . '/../../etc/routes_merged.xsd'); + } + + /** + * Get path to pre file validation schema + * + * @return string + */ + public function getPerFileSchema() + { + return realpath(__DIR__ . '/../../etc/routes.xsd'); + } +} diff --git a/app/code/Magento/Core/Model/Config/Resource/Primary.php b/lib/Magento/App/Route/ConfigInterface.php similarity index 58% rename from app/code/Magento/Core/Model/Config/Resource/Primary.php rename to lib/Magento/App/Route/ConfigInterface.php index 8b95a9b97e7fa144ece3856e2494172d87be0436..2c7e7805227304ba078b8b7c530f0e8c04d54519 100644 --- a/app/code/Magento/Core/Model/Config/Resource/Primary.php +++ b/lib/Magento/App/Route/ConfigInterface.php @@ -1,6 +1,6 @@ <?php /** - * Primary resource configuration. Only uses + * Routes configuration interface * * Magento * @@ -23,28 +23,34 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Resource; +namespace Magento\App\Route; -class Primary implements \Magento\Core\Model\Config\ResourceInterface +interface ConfigInterface { - protected $_resourceList; - - public function __construct(\Magento\Core\Model\Config\Local $configLocal) - { - $this->_resourceList = $configLocal->getResources(); - } - + /** + * Retrieve route front name + * + * @param string $routeId + * @param string $scope + * @return string + */ + public function getRouteFrontName($routeId, $scope = null); /** - * Retrieve connection config + * Get route id by route front name * - * @param string $resourceName + * @param string $frontName + * @param string $scope * @return string */ - public function getConnectionName($resourceName) - { - return isset($this->_resourceList[$resourceName]['connection']) - ? $this->_resourceList[$resourceName]['connection'] - : \Magento\Core\Model\Config\Resource::DEFAULT_SETUP_CONNECTION; - } + public function getRouteByFrontName($frontName, $scope = null); + + /** + * Retrieve list of moudles by route front name + * + * @param string $frontName + * @param string $scope + * @return array + */ + public function getModulesByFrontName($frontName, $scope = null); } diff --git a/lib/Magento/App/Router/AbstractRouter.php b/lib/Magento/App/Router/AbstractRouter.php index 12f509a38ae0d0a8e284c6cf01469a6704121deb..157d96f0d3481e8a6ca93b128aecd4405f89ab78 100644 --- a/lib/Magento/App/Router/AbstractRouter.php +++ b/lib/Magento/App/Router/AbstractRouter.php @@ -25,11 +25,9 @@ */ namespace Magento\App\Router; -use \Magento\App\FrontControllerInterface, - \Magento\App\ActionFactory, - \Magento\App\RequestInterface; +use \Magento\App\ActionFactory; -abstract class AbstractRouter +abstract class AbstractRouter implements \Magento\App\RouterInterface { /** * @var \Magento\App\FrontController @@ -39,65 +37,13 @@ abstract class AbstractRouter /** * @var \Magento\App\ActionFactory */ - protected $_controllerFactory; + protected $_actionFactory; /** - * @param \Magento\App\ActionFactory $controllerFactory + * @param \Magento\App\ActionFactory $actionFactory */ - public function __construct(ActionFactory $controllerFactory) + public function __construct(ActionFactory $actionFactory) { - $this->_controllerFactory = $controllerFactory; + $this->_actionFactory = $actionFactory; } - - /** - * Assign front controller instance - * - * @param $front FrontControllerInterface - * @return AbstractRouter - */ - public function setFront(FrontControllerInterface $front) - { - $this->_front = $front; - return $this; - } - - /** - * Retrieve front controller instance - * - * @return FrontControllerInterface - */ - public function getFront() - { - return $this->_front; - } - - /** - * Retrieve front name by route - * - * @param string $routeId - * @return string - */ - public function getFrontNameByRoute($routeId) - { - return $routeId; - } - - /** - * Retrieve route by module front name - * - * @param string $frontName - * @return string - */ - public function getRouteByFrontName($frontName) - { - return $frontName; - } - - /** - * Match controller by request - * - * @param RequestInterface $request - * @return \Magento\App\Action\AbstractAction - */ - abstract public function match(RequestInterface $request); } diff --git a/lib/Magento/App/Router/DefaultRouter.php b/lib/Magento/App/Router/DefaultRouter.php index cedd6b063d9d428cdc24c6218b3184eaf1eaf9a5..56d8016cd5be3134c7b57a9a0e12ee66e86434ab 100644 --- a/lib/Magento/App/Router/DefaultRouter.php +++ b/lib/Magento/App/Router/DefaultRouter.php @@ -36,14 +36,14 @@ class DefaultRouter extends AbstractRouter protected $_noRouteHandlerList; /** - * @param ActionFactory $controllerFactory + * @param ActionFactory $actionFactory * @param \Magento\App\Router\NoRouteHandlerList $noRouteHandlerList */ public function __construct( - ActionFactory $controllerFactory, + ActionFactory $actionFactory, \Magento\App\Router\NoRouteHandlerList $noRouteHandlerList ) { - parent::__construct($controllerFactory); + parent::__construct($actionFactory); $this->_noRouteHandlerList = $noRouteHandlerList; } @@ -61,7 +61,7 @@ class DefaultRouter extends AbstractRouter } } - return $this->_controllerFactory->createController('Magento\App\Action\Forward', + return $this->_actionFactory->createController('Magento\App\Action\Forward', array('request' => $request) ); } diff --git a/lib/Magento/Appl/Router/NoRouteHandlerInterface.php b/lib/Magento/App/Router/NoRouteHandlerInterface.php similarity index 97% rename from lib/Magento/Appl/Router/NoRouteHandlerInterface.php rename to lib/Magento/App/Router/NoRouteHandlerInterface.php index acc2f68b5d7d3b13b713e39cf5faa165db1b6619..b3225b192f4e2b1607d3fce5fba8a35e1845eb65 100644 --- a/lib/Magento/Appl/Router/NoRouteHandlerInterface.php +++ b/lib/Magento/App/Router/NoRouteHandlerInterface.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Appl\Router; +namespace Magento\App\Router; interface NoRouteHandlerInterface { diff --git a/app/code/Magento/Core/Model/Config/LoaderInterface.php b/lib/Magento/App/RouterInterface.php similarity index 78% rename from app/code/Magento/Core/Model/Config/LoaderInterface.php rename to lib/Magento/App/RouterInterface.php index 740220349d747cdc5ff882f894ab98c6712e0a56..e68df36b1c99a236a76ff3268a2b7c0f2831d787 100644 --- a/app/code/Magento/Core/Model/Config/LoaderInterface.php +++ b/lib/Magento/App/RouterInterface.php @@ -1,6 +1,6 @@ <?php /** - * Application config loader interface + * Router. Matches action from request * * Magento * @@ -23,14 +23,15 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App; -interface LoaderInterface +interface RouterInterface { /** - * Populate configuration object + * Match application action by request * - * @param \Magento\Core\Model\Config\Base $config + * @param RequestInterface $request + * @return ActionInterface */ - public function load(\Magento\Core\Model\Config\Base $config); -} + public function match(RequestInterface $request); +} \ No newline at end of file diff --git a/lib/Magento/App/RouterList.php b/lib/Magento/App/RouterList.php index 90781da07b5ab2f04f7ded8a4ffc1b275fd24d2d..dc0c8d4a56205e3efd2818570bf75cddcd9f1d97 100644 --- a/lib/Magento/App/RouterList.php +++ b/lib/Magento/App/RouterList.php @@ -26,8 +26,6 @@ */ namespace Magento\App; -use \Magento\App\RouterListInterface; - class RouterList implements RouterListInterface { /** @@ -42,13 +40,6 @@ class RouterList implements RouterListInterface */ protected $_routerList; - /** - * List of active routers objects - * - * @var array - */ - protected $_activeRouters = array(); - /** * @param \Magento\ObjectManager $objectManager * @param array $routerList @@ -57,138 +48,101 @@ class RouterList implements RouterListInterface { $this->_objectManager = $objectManager; $this->_routerList = $routerList; + $this->_routerList = array_filter($routerList, function ($item) { + return (!isset($item['disable']) || !$item['disable']) && $item['instance']; + }); + uasort($this->_routerList, array($this, '_compareRoutersSortOrder')); } /** - * Get list of active routers - * sorted by sortOrder + * Retrieve router instance by id * - * @return array + * @param string $routerId + * @return RouterInterface */ - public function getRouters() + protected function _getRouterInstance($routerId) { - if (empty($this->_activeRouters)) { - $this->_loadRouters(); + if (!isset($this->_routerList[$routerId]['object'])) { + $this->_routerList[$routerId]['object'] = $this->_objectManager->create( + $this->_routerList[$routerId]['instance'] + ); } - - return $this->_activeRouters; + return $this->_routerList[$routerId]['object']; } /** - * Load active routers - * - * @return array + * (PHP 5 >= 5.0.0)<br/> + * Return the current element + * @link http://php.net/manual/en/iterator.current.php + * @return RouterInterface */ - protected function _loadRouters() + public function current() { - foreach ($this->_getSortedRouterList() as $routerCode => $routerData) { - if ((!isset($routerData['disable']) || !$routerData['disable']) && $routerData['instance']) { - $this->_activeRouters[$routerCode] = $this->_objectManager->create($routerData['instance']); - } - } - - return $this->_activeRouters; + return $this->_getRouterInstance(key($this->_routerList)); } /** - * Sort routerList by sortOrder - * - * @return array + * (PHP 5 >= 5.0.0)<br/> + * Move forward to next element + * @link http://php.net/manual/en/iterator.next.php + * @return void Any returned value is ignored. */ - protected function _getSortedRouterList() + public function next() { - uasort($this->_routerList, array($this, '_compareRoutersSortOrder')); - return $this->_routerList; + next($this->_routerList); } /** - * Compare routers sortOrder - * - * @param array $routerData1 - * @param array $routerData2 - * @return int + * (PHP 5 >= 5.0.0)<br/> + * Return the key of the current element + * @link http://php.net/manual/en/iterator.key.php + * @return mixed scalar on success, or null on failure. */ - protected function _compareRoutersSortOrder($routerData1, $routerData2) + public function key() { - if ((int)$routerData1['sortOrder'] == (int)$routerData2['sortOrder']) { - return 0; - } - - if ((int)$routerData1['sortOrder'] < (int)$routerData2['sortOrder']) { - return -1; - } else { - return 1; - } + key($this->_routerList); } /** - * Get router by route - * - * @param string $routeId - * @return \Magento\App\Router\AbstractRouter + * (PHP 5 >= 5.0.0)<br/> + * Checks if current position is valid + * @link http://php.net/manual/en/iterator.valid.php + * @return boolean The return value will be casted to boolean and then evaluated. + * Returns true on success or false on failure. */ - public function getRouterByRoute($routeId) + public function valid() { - $activeRouters = $this->getRouters(); - // empty route supplied - return base url - if (empty($routeId)) { - return $activeRouters['standard']; - } - - if (isset($activeRouters['admin'])) { - $router = $activeRouters['admin']; - if ($router->getFrontNameByRoute($routeId)) { - return $router; - } - } - - if (isset($activeRouters['standard'])) { - $router = $activeRouters['standard']; - if ($router->getFrontNameByRoute($routeId)) { - return $router; - } - } - - if (isset($activeRouters[$routeId])) { - $router = $activeRouters[$routeId]; - if ($router->getFrontNameByRoute($routeId)) { - return $router; - } - } + return !!current($this->_routerList); + } - $router = $activeRouters['default'];; - return $router; + /** + * (PHP 5 >= 5.0.0)<br/> + * Rewind the Iterator to the first element + * @link http://php.net/manual/en/iterator.rewind.php + * @return void Any returned value is ignored. + */ + public function rewind() + { + reset($this->_routerList); } /** - * Get router by frontName + * Compare routers sortOrder * - * @param string $frontName - * @return \Magento\App\Router\AbstractRouter + * @param array $routerDataFirst + * @param array $routerDataSecond + * @return int */ - public function getRouterByFrontName($frontName) + protected function _compareRoutersSortOrder($routerDataFirst, $routerDataSecond) { - $activeRouters = $this->getRouters(); - // empty route supplied - return base url - if (empty($frontName)) { - return $activeRouters['standard']; - } - - if (isset($activeRouters['admin'])) { - $router = $activeRouters['admin']; - if ($router->getRouteByFrontname($frontName)) { - return $router; - } + if ((int)$routerDataFirst['sortOrder'] == (int)$routerDataSecond['sortOrder']) { + return 0; } - if (isset($activeRouters['standard'])) { - $router = $activeRouters['standard']; - if ($router->getRouteByFrontname($frontName)) { - return $router; - } + if ((int)$routerDataFirst['sortOrder'] < (int)$routerDataSecond['sortOrder']) { + return -1; + } else { + return 1; } - - $router = $activeRouters['default'];; - return $router; } } diff --git a/lib/Magento/App/RouterListInterface.php b/lib/Magento/App/RouterListInterface.php index 0222bf8f932408d9446abb50f9251708e61520d7..3f59fd4ee4fbfd6900abf55c534c89c3704e163f 100644 --- a/lib/Magento/App/RouterListInterface.php +++ b/lib/Magento/App/RouterListInterface.php @@ -25,29 +25,6 @@ */ namespace Magento\App; -interface RouterListInterface +interface RouterListInterface extends \Iterator { - /** - * Get list of active routers - * sorted by sortOrder - * - * @return array - */ - public function getRouters(); - - /** - * Get router by route - * - * @param string $routeId - * @return \Magento\App\Router\AbstractRouter - */ - public function getRouterByRoute($routeId); - - /** - * Get router by frontName - * - * @param string $frontName - * @return \Magento\App\Router\AbstractRouter - */ - public function getRouterByFrontName($frontName); } \ No newline at end of file diff --git a/lib/Magento/App/State.php b/lib/Magento/App/State.php index 7825ab03b0edfeaeb13f77bb181b8a5641d19bc7..311ee8753494bcbede919480546b274e4bc40976 100644 --- a/lib/Magento/App/State.php +++ b/lib/Magento/App/State.php @@ -23,13 +23,15 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\App; -use Zend\Soap\Exception\InvalidArgumentException; - class State { + /** + * Application run code + */ + const PARAM_MODE = 'MAGE_MODE'; + /** * Application mode * @@ -58,6 +60,20 @@ class State */ protected $_installDate; + /** + * Config scope model + * + * @var \Magento\Config\ScopeInterface + */ + protected $_configScope; + + /** + * Area code + * + * @var string + */ + protected $_areaCode; + /**#@+ * Application modes */ @@ -69,13 +85,15 @@ class State const PARAM_INSTALL_DATE = 'install.date'; /** + * @param \Magento\Config\ScopeInterface $configScope * @param string $installDate * @param string $mode * @throws \LogicException */ - public function __construct($installDate, $mode = self::MODE_DEFAULT) + public function __construct(\Magento\Config\ScopeInterface $configScope, $installDate, $mode = self::MODE_DEFAULT) { $this->_installDate = strtotime((string)$installDate); + $this->_configScope = $configScope; switch ($mode) { case self::MODE_DEVELOPER: case self::MODE_PRODUCTION: @@ -147,4 +165,55 @@ class State { $this->_installDate = $date; } + + /** + * Set area code + * + * @param string $code + * @throws \Magento\Exception + */ + public function setAreaCode($code) + { + if (isset($this->_areaCode)) { + throw new \Magento\Exception('Area code is already set'); + } + $this->_configScope->setCurrentScope($code); + $this->_areaCode = $code; + } + + /** + * Get area code + * + * @return string + * @throws \Magento\Exception + */ + public function getAreaCode() + { + if (!isset($this->_areaCode)) { + throw new \Magento\Exception('Area code is not set'); + } + return $this->_areaCode; + } + + /** + * Emulate callback inside some area code + * + * @param string $areaCode + * @param callable $callback + * @return mixed + * @throws \Exception + */ + public function emulateAreaCode($areaCode, $callback) + { + $currentArea = $this->_areaCode; + $this->_areaCode = $areaCode; + try { + $result = call_user_func($callback); + } catch (\Exception $e) { + $this->_areaCode = $currentArea; + throw $e; + } + $this->_areaCode = $currentArea; + return $result; + } } diff --git a/app/code/Magento/Core/etc/resources.xsd b/lib/Magento/App/etc/resources.xsd similarity index 100% rename from app/code/Magento/Core/etc/resources.xsd rename to lib/Magento/App/etc/resources.xsd diff --git a/app/code/Magento/Core/etc/routes.xsd b/lib/Magento/App/etc/routes.xsd similarity index 100% rename from app/code/Magento/Core/etc/routes.xsd rename to lib/Magento/App/etc/routes.xsd diff --git a/app/code/Magento/Core/etc/routes_merged.xsd b/lib/Magento/App/etc/routes_merged.xsd similarity index 100% rename from app/code/Magento/Core/etc/routes_merged.xsd rename to lib/Magento/App/etc/routes_merged.xsd diff --git a/lib/Magento/AppInterface.php b/lib/Magento/AppInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..99d740f0b344eebf2c46ad1233812d148d5fb83e --- /dev/null +++ b/lib/Magento/AppInterface.php @@ -0,0 +1,34 @@ +<?php +/** + * Application. Performs user requested actions. + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento; + +interface AppInterface +{ + /** + * @return int + */ + public function execute(); +} \ No newline at end of file diff --git a/lib/Magento/Code/Generator.php b/lib/Magento/Code/Generator.php index 8ad43dbd43e5c1fb60482161bf69395451ee8de7..5335734ea675948ebe0a7a3fadf289d160d47195 100644 --- a/lib/Magento/Code/Generator.php +++ b/lib/Magento/Code/Generator.php @@ -154,6 +154,8 @@ class Generator throw new \InvalidArgumentException('Unknown generation entity.'); break; } + } else { + $this->_generator->init($sourceClassName, $resultClassName); } return $this->_generator; diff --git a/lib/Magento/Code/Generator/ClassGenerator.php b/lib/Magento/Code/Generator/Autoloader.php similarity index 58% rename from lib/Magento/Code/Generator/ClassGenerator.php rename to lib/Magento/Code/Generator/Autoloader.php index 3243fd29564d2391cc4efa7aac913eaf8602be4b..7314f337f3973f32fbceebc885de77a962a7e2a8 100644 --- a/lib/Magento/Code/Generator/ClassGenerator.php +++ b/lib/Magento/Code/Generator/Autoloader.php @@ -18,15 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Code * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Code\Generator; -class ClassGenerator +class Autoloader { /** * @var \Magento\Code\Generator @@ -36,31 +34,21 @@ class ClassGenerator /** * @param \Magento\Code\Generator $generator */ - public function __construct(\Magento\Code\Generator $generator = null) + public function __construct(\Magento\Code\Generator $generator) { - $this->_generator = $generator ?: new \Magento\Code\Generator(); + $this->_generator = $generator; } /** - * Generate all not existing entity classes in constructor + * Load specified class name and generate it if necessary * * @param string $className */ - public function generateForConstructor($className) + public function load($className) { if (!class_exists($className)) { - $this->_generator->generateClass($className); - } - $reflectionClass = new \ReflectionClass($className); - if ($reflectionClass->hasMethod('__construct')) { - $constructor = $reflectionClass->getMethod('__construct'); - $parameters = $constructor->getParameters(); - /** @var $parameter \ReflectionParameter */ - foreach ($parameters as $parameter) { - preg_match('/\[\s\<\w+?>\s([\w\\\\]+)/s', $parameter->__toString(), $matches); - if (isset($matches[1])) { - $this->_generator->generateClass($matches[1]); - } + if (\Magento\Code\Generator::GENERATION_SUCCESS === $this->_generator->generateClass($className)) { + \Magento\Autoload\IncludePath::load($className); } } } diff --git a/lib/Magento/Code/Generator/DefinitionDecorator.php b/lib/Magento/Code/Generator/DefinitionDecorator.php deleted file mode 100644 index 0ec371a4de9b54b8b399f9a43e01601480d66746..0000000000000000000000000000000000000000 --- a/lib/Magento/Code/Generator/DefinitionDecorator.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/** - * Object manager definition decorator. Generates all proxies and factories declared - * in class constructor signatures before reading it's definition - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Code\Generator; - -class DefinitionDecorator implements \Magento\ObjectManager\Definition -{ - /** - * Processed classes list - * - * @var array - */ - protected $_processedClasses = array(); - - /** - * Class generator - * - * @var \Magento\Code\Generator\ClassGenerator - */ - protected $_generator; - - /** - * Decorated objectManager definition - * - * @var \Magento\ObjectManager\Definition - */ - protected $_decoratedDefinition; - - /** - * @param \Magento\ObjectManager\Definition $definition - * @param \Magento\Code\Generator\ClassGenerator $generator - */ - public function __construct( - \Magento\ObjectManager\Definition $definition, \Magento\Code\Generator\ClassGenerator $generator = null - ) { - $this->_decoratedDefinition = $definition; - $this->_generator = $generator ?: new \Magento\Code\Generator\ClassGenerator(); - } - - /** - * Get list of method parameters - * - * Retrieve an ordered list of constructor parameters. - * Each value is an array with following entries: - * - * array( - * 0, // string: Parameter name - * 1, // string|null: Parameter type - * 2, // bool: whether this param is required - * 3, // mixed: default value - * ); - * - * @param string $className - * @return array|null - */ - public function getParameters($className) - { - if (!array_key_exists($className, $this->_processedClasses)) { - $this->_generator->generateForConstructor($className); - $this->_processedClasses[$className] = 1; - } - return $this->_decoratedDefinition->getParameters($className); - } - - /** - * Retrieve list of all classes covered with definitions - * - * @return array - */ - public function getClasses() - { - return $this->_decoratedDefinition->getClasses(); - } -} diff --git a/lib/Magento/Code/Generator/EntityAbstract.php b/lib/Magento/Code/Generator/EntityAbstract.php index 3f71db6b9343b8056b386f1b2dbd69386e2bec8d..b5c1dd3d2bed3ddc23864e1216f7bb071badad84 100644 --- a/lib/Magento/Code/Generator/EntityAbstract.php +++ b/lib/Magento/Code/Generator/EntityAbstract.php @@ -370,4 +370,16 @@ abstract class EntityAbstract return $parameterInfo; } + + /** + * Reinit generator + * + * @param string $sourceClassName + * @param string $resultClassName + */ + public function init($sourceClassName, $resultClassName) + { + $this->_sourceClassName = $sourceClassName; + $this->_resultClassName = $resultClassName; + } } diff --git a/lib/Magento/Code/Generator/Factory.php b/lib/Magento/Code/Generator/Factory.php index 8df985d9be896a90dc096cfee7a954fdcb0f997e..d8a13b616b3afd52fc84d80bf6080df824a170fb 100644 --- a/lib/Magento/Code/Generator/Factory.php +++ b/lib/Magento/Code/Generator/Factory.php @@ -126,4 +126,25 @@ class Factory extends \Magento\Code\Generator\EntityAbstract return array($construct, $create); } + + /** + * {@inheritdoc} + */ + protected function _validateData() + { + $result = parent::_validateData(); + + if ($result) { + $sourceClassName = $this->_getSourceClassName(); + $resultClassName = $this->_getResultClassName(); + + if ($resultClassName !== $sourceClassName . 'Factory') { + $this->_addError('Invalid Factory class name [' + . $resultClassName . ']. Use ' . $sourceClassName . 'Factory' + ); + $result = false; + } + } + return $result; + } } diff --git a/lib/Magento/Code/Generator/Interceptor.php b/lib/Magento/Code/Generator/Interceptor.php index cd95da270e760c88c882cbbf120ce3474da2231e..8889cd28254c5ecc5211f3018fd4049ed362f22b 100644 --- a/lib/Magento/Code/Generator/Interceptor.php +++ b/lib/Magento/Code/Generator/Interceptor.php @@ -223,7 +223,7 @@ class Interceptor extends \Magento\Code\Generator\EntityAbstract 'docblock' => array( 'shortDescription' => 'Retrieve ObjectManager from the global scope', ), - 'body' => '$this->_objectManager = \Magento\Core\Model\ObjectManager::getInstance();' + 'body' => '$this->_objectManager = \Magento\App\ObjectManager::getInstance();' . "\n\$this->_pluginList = \$this->_objectManager->get('Magento\Interception\PluginList');", ); @@ -312,4 +312,25 @@ class Interceptor extends \Magento\Code\Generator\EntityAbstract } return parent::_generateCode(); } + + /** + * {@inheritdoc} + */ + protected function _validateData() + { + $result = parent::_validateData(); + + if ($result) { + $sourceClassName = $this->_getSourceClassName(); + $resultClassName = $this->_getResultClassName(); + + if ($resultClassName !== $sourceClassName . '\\Interceptor') { + $this->_addError('Invalid Interceptor class name [' + . $resultClassName . ']. Use ' . $sourceClassName . '\\Interceptor' + ); + $result = false; + } + } + return $result; + } } diff --git a/lib/Magento/Code/Generator/Proxy.php b/lib/Magento/Code/Generator/Proxy.php index a9bdbe0f9bb3ac3d434be2a91b6c740674c336c3..7ebd7e49d5c83e8a9b50a63ea1fc22543ea4758a 100644 --- a/lib/Magento/Code/Generator/Proxy.php +++ b/lib/Magento/Code/Generator/Proxy.php @@ -110,7 +110,7 @@ class Proxy extends \Magento\Code\Generator\EntityAbstract ); $methods[] = array( 'name' => '__wakeup', - 'body' => '$this->_objectManager = \Magento\Core\Model\ObjectManager::getInstance();', + 'body' => '$this->_objectManager = \Magento\App\ObjectManager::getInstance();', 'docblock' => array( 'shortDescription' => 'Retrieve ObjectManager from global scope', ), @@ -250,4 +250,24 @@ class Proxy extends \Magento\Code\Generator\EntityAbstract } return 'return $this->_getSubject()->' . $methodCall . ';'; } + + /** + * {@inheritdoc} + */ + protected function _validateData() + { + $result = parent::_validateData(); + if ($result) { + $sourceClassName = $this->_getSourceClassName(); + $resultClassName = $this->_getResultClassName(); + + if ($resultClassName !== $sourceClassName . '\\Proxy') { + $this->_addError('Invalid Proxy class name [' + . $resultClassName . ']. Use ' . $sourceClassName . '\\Proxy' + ); + $result = false; + } + } + return $result; + } } diff --git a/lib/Magento/Code/Reader/ClassReader.php b/lib/Magento/Code/Reader/ClassReader.php index 22a3d32bf2cb7feecce9822b98735b56c354d666..f69599a9b1b4769621709235107e96fd3d5ad12f 100644 --- a/lib/Magento/Code/Reader/ClassReader.php +++ b/lib/Magento/Code/Reader/ClassReader.php @@ -51,8 +51,7 @@ class ClassReader null ); } catch (\ReflectionException $e) { - $message = $e->getMessage() . "\n"; - $message .= 'Are you sure that you didn\'t use virtual type in constructor signature?'; + $message = $e->getMessage(); throw new \ReflectionException($message, 0, $e); } } diff --git a/lib/Magento/Code/ValidationException.php b/lib/Magento/Code/ValidationException.php new file mode 100644 index 0000000000000000000000000000000000000000..8d484ebf966773f921b8fee5394e222c2a1665c0 --- /dev/null +++ b/lib/Magento/Code/ValidationException.php @@ -0,0 +1,30 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Code; + +class ValidationException extends \Exception +{ + +} diff --git a/lib/Magento/Code/Validator/ConstructorIntegrity.php b/lib/Magento/Code/Validator/ConstructorIntegrity.php new file mode 100644 index 0000000000000000000000000000000000000000..4fb80e59f24fe2e14e283a2d160666ab6206c13d --- /dev/null +++ b/lib/Magento/Code/Validator/ConstructorIntegrity.php @@ -0,0 +1,209 @@ +<?php +/** + * Class constructor validator. Validates call of parent construct + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Code\Validator; + +class ConstructorIntegrity +{ + /** + * Validate class + * + * @param $className + * @return bool + * @throws \Magento\Code\ValidationException + */ + public function validate($className) + { + $class = new \ReflectionClass($className); + $parent = $class->getParentClass(); + + /** Check whether parent class exists and has __construct method */ + if (!$parent || !$parent->hasMethod('__construct')) { + return true; + } + + /** Check whether class has __construct */ + $classArguments = $this->_getConstructorArguments($class); + if (null === $classArguments) { + return true; + } + + /** Check whether class has parent::__construct call */ + $callArguments = $this->_getParentCall($class, $classArguments); + if (null === $callArguments) { + return true; + } + + /** Get parent class __construct arguments */ + $parentArguments = $this->_getConstructorArguments($parent, true); + + foreach ($parentArguments as $index => $requiredArgument) { + if (isset($callArguments[$index])) { + $actualArgument = $callArguments[$index]; + } else { + if ($requiredArgument['isOptional']) { + continue; + } + + throw new \Magento\Code\ValidationException('Missed required argument ' . $requiredArgument['name'] + . ' in parent::__construct call. File: ' . $class->getFileName() + ); + } + + if (false == $this->_isCompatibleType($requiredArgument['type'], $actualArgument['type'])) { + throw new \Magento\Code\ValidationException('Incompatible argument type: Required type: ' + . $requiredArgument['type'] . '. Actual type: ' . $actualArgument['type'] + . '; File: ' . $class->getFileName() + ); + } + } + + /** + * Try to detect unused arguments + * Check whether count of passed parameters less or equal that count of count parent class arguments + */ + if (count($callArguments) > count($parentArguments)) { + $extraParameters = array_slice($callArguments, count($parentArguments)); + $names = array(); + foreach ($extraParameters as $param) { + $names[] = '$' . $param['name']; + } + + throw new \Magento\Code\ValidationException( + 'Extra parameters passed to parent construct: ' + . implode(', ', $names) + . '. File: ' . $class->getFileName() + ); + } + return true; + } + + /** + * Check argument type compatibility + * + * @param string $requiredType + * @param string $actualType + * @return bool + */ + protected function _isCompatibleType($requiredType, $actualType) + { + /** Types are compatible if type names are equal */ + if ($requiredType === $actualType) { + return true; + } + + /** Types are 'semi-compatible' if one of them are undefined */ + if ($requiredType === null || $actualType === null) { + return true; + } + + /** + * Special case for scalar arguments + * Array type is compatible with array or null type. Both of these types are checked above + */ + if ($requiredType === 'array' || $actualType === 'array') { + return false; + } + + return is_subclass_of($actualType, $requiredType); + } + + /** + * Get arguments of parent __construct call + * + * @param \ReflectionClass $class + * @param array $classArguments + * @return array|null + */ + protected function _getParentCall(\ReflectionClass $class, array $classArguments) + { + $trimFunction = function (&$value) { + $value = trim($value, PHP_EOL . ' $'); + }; + + $method = $class->getMethod('__construct'); + $start = $method->getStartLine(); + $end = $method->getEndLine(); + $length = $end - $start; + + $source = file($class->getFileName()); + $content = implode('', array_slice($source, $start, $length)); + $pattern = '/parent::__construct\(([a-zA-Z0-9_$, \n]*)\);/'; + + if (!preg_match($pattern, $content, $matches)) { + return null; + } + + $arguments = $matches[1]; + if (!trim($arguments)) { + return null; + } + + $arguments = explode(',', $arguments); + array_walk($arguments, $trimFunction); + + $output = array(); + foreach ($arguments as $argumentPosition => $argumentName) { + $type = isset($classArguments[$argumentName]) ? $classArguments[$argumentName]['type'] : null; + $output[$argumentPosition] = array( + 'name' => $argumentName, + 'position' => $argumentPosition, + 'type' => $type, + ); + } + return $output; + } + + /** + * Get class constructor + * + * @param \ReflectionClass $class + * @param bool $groupByPosition + * @return array|null + */ + protected function _getConstructorArguments(\ReflectionClass $class, $groupByPosition = false) + { + if (false == $class->hasMethod('__construct')) { + return null; + } + + $output = array(); + foreach ($class->getConstructor()->getParameters() as $parameter) { + $name = $parameter->getName(); + $position = $parameter->getPosition(); + $parameterClass = $parameter->getClass(); + $type = $parameterClass ? $parameterClass->getName() : ($parameter->isArray() ? 'array' : null); + $index = $groupByPosition ? $position : $name; + $output[$index] = array( + 'name' => $name, + 'position' => $position, + 'type' => $type, + 'isOptional' => $parameter->isOptional() + ); + } + return $output; + } +} diff --git a/lib/Magento/Config/Data/Scoped.php b/lib/Magento/Config/Data/Scoped.php index ad7e427f174ed840ab8cac7d63258e4cb391ccb1..97782ea9dbb812b2aa3bd5bc8ec86d6641d1bbd6 100644 --- a/lib/Magento/Config/Data/Scoped.php +++ b/lib/Magento/Config/Data/Scoped.php @@ -110,12 +110,13 @@ class Scoped extends \Magento\Config\Data } foreach ($this->_scopePriorityScheme as $scopeCode) { if (false == isset($this->_loadedScopes[$scopeCode])) { - $data = $this->_cache->load($scopeCode . '::' . $this->_cacheId); - if (false === $data) { - $data = $this->_reader->read($scopeCode); - $this->_cache->save(serialize($data), $scopeCode . '::' . $this->_cacheId); - } else { + if ($scopeCode !== 'primary' && $data = $this->_cache->load($scopeCode . '::' . $this->_cacheId)) { $data = unserialize($data); + } else { + $data = $this->_reader->read($scopeCode); + if ($scopeCode !== 'primary') { + $this->_cache->save(serialize($data), $scopeCode . '::' . $this->_cacheId); + } } $this->merge($data); $this->_loadedScopes[$scopeCode] = true; diff --git a/lib/Magento/Config/Scope.php b/lib/Magento/Config/Scope.php index 7ccff434ce2b5f58c3456806503fc28f433a3956..c1c9447013b78012e8b0e7b6e52bd7ad422916d4 100644 --- a/lib/Magento/Config/Scope.php +++ b/lib/Magento/Config/Scope.php @@ -50,7 +50,7 @@ class Scope implements \Magento\Config\ScopeInterface * @param \Magento\App\AreaList $areaList * @param string $defaultScope */ - public function __construct(\Magento\App\AreaList $areaList, $defaultScope = 'global') + public function __construct(\Magento\App\AreaList $areaList, $defaultScope = 'primary') { $this->_defaultScope = $this->_currentScope = $defaultScope; $this->_areaList = $areaList; diff --git a/lib/Magento/Convert/ConvertArray.php b/lib/Magento/Convert/ConvertArray.php new file mode 100644 index 0000000000000000000000000000000000000000..097bcae91f5122b8caeccf8a8d67aa9eb54ce244 --- /dev/null +++ b/lib/Magento/Convert/ConvertArray.php @@ -0,0 +1,96 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Convert; + +/** + * Convert the array data to SimpleXMLElement object + */ +class ConvertArray +{ + /** + * Transform an assoc array to \SimpleXMLElement object + * Array has some limitations. Appropriate exceptions will be thrown + * + * @param array $array + * @param string $rootName + * @return \SimpleXMLElement + * @throws \Magento\Exception + */ + public function assocToXml(array $array, $rootName = '_') + { + if (empty($rootName) || is_numeric($rootName)) { + throw new \Magento\Exception('Root element must not be empty or numeric'); + } + + $xmlStr = <<<XML +<?xml version='1.0' encoding='UTF-8' standalone='yes'?> +<$rootName></$rootName> +XML; + $xml = new \SimpleXMLElement($xmlStr); + foreach (array_keys($array) as $key) { + if (is_numeric($key)) { + throw new \Magento\Exception('Array root keys must not be numeric.'); + } + } + return self::_assocToXml($array, $rootName, $xml); + } + + /** + * Function, that actually recursively transforms array to xml + * + * @param array $array + * @param string $rootName + * @param \SimpleXMLElement $xml + * @return \SimpleXMLElement + * @throws \Magento\Exception + */ + private function _assocToXml(array $array, $rootName, \SimpleXMLElement &$xml) + { + $hasNumericKey = false; + $hasStringKey = false; + foreach ($array as $key => $value) { + if (!is_array($value)) { + if (is_string($key)) { + if ($key === $rootName) { + throw new \Magento\Exception( + 'Associative key must not be the same as its parent associative key.' + ); + } + $hasStringKey = true; + $xml->$key = $value; + } elseif (is_int($key)) { + $hasNumericKey = true; + $xml->{$rootName}[$key] = $value; + } + } else { + self::_assocToXml($value, $key, $xml->$key); + } + } + if ($hasNumericKey && $hasStringKey) { + throw new \Magento\Exception('Associative and numeric keys must not be mixed at one level.'); + } + return $xml; + } +} diff --git a/lib/Magento/Convert/ConvertException.php b/lib/Magento/Convert/ConvertException.php index 23cb644e4c1f7ee2fad30604cadd256be0f21fc8..521c7528f0a83cfae89cbe7b652683d6fdab1631 100644 --- a/lib/Magento/Convert/ConvertException.php +++ b/lib/Magento/Convert/ConvertException.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Convert; /** * Convert exception - * - * @category Magento - * @package Magento_Convert - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Convert; - class ConvertException extends \Magento\Exception { const NOTICE = 'NOTICE'; diff --git a/lib/Magento/Convert/Excel.php b/lib/Magento/Convert/Excel.php index aaff97b93f071110253caf1d2337f9e729334216..b4121b2c370eec9898f8632c730112f48ab0b547 100644 --- a/lib/Magento/Convert/Excel.php +++ b/lib/Magento/Convert/Excel.php @@ -24,12 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Convert; + /** * Convert the data to XML Excel */ - -namespace Magento\Convert; - class Excel { /** diff --git a/lib/Magento/Convert/Xml.php b/lib/Magento/Convert/Xml.php new file mode 100644 index 0000000000000000000000000000000000000000..d8dc893bff247ba93326c0e870979faf55ac22b6 --- /dev/null +++ b/lib/Magento/Convert/Xml.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Convert; + +/** + * Convert xml data (SimpleXMLElement object) to array + */ +class Xml +{ + /** + * Transform \SimpleXMLElement to associative array + * \SimpleXMLElement must be conform structure, generated by assocToXml() + * + * @param \SimpleXMLElement $xml + * @return array + */ + public function xmlToAssoc(\SimpleXMLElement $xml) + { + $array = array(); + foreach ($xml as $key => $value) { + if (isset($value->$key)) { + $i = 0; + foreach ($value->$key as $v) { + $array[$key][$i++] = (string)$v; + } + } else { + // try to transform it into string value, trimming spaces between elements + $array[$key] = trim((string)$value); + if (empty($array[$key]) && !empty($value)) { + $array[$key] = $this->xmlToAssoc($value); + } else { + // untrim strings values + $array[$key] = (string)$value; + } + } + } + return $array; + } +} diff --git a/lib/Magento/DB/Adapter/Pdo/Mysql.php b/lib/Magento/DB/Adapter/Pdo/Mysql.php index e37d7b403989482ec61ecda56807bf649d1ee725..ddb5666d2aeadb99942f18ef75be4f402e3da320 100644 --- a/lib/Magento/DB/Adapter/Pdo/Mysql.php +++ b/lib/Magento/DB/Adapter/Pdo/Mysql.php @@ -224,15 +224,31 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad */ protected $_dirs; + /** + * @var \Magento\Stdlib\String + */ + protected $string; + + /** + * @var \Magento\Stdlib\DateTime + */ + protected $dateTime; + /** * @param \Magento\App\Dir $dirs + * @param \Magento\Stdlib\String $string + * @param \Magento\Stdlib\DateTime $dateTime * @param array $config */ public function __construct( \Magento\App\Dir $dirs, + \Magento\Stdlib\String $string, + \Magento\Stdlib\DateTime $dateTime, array $config = array() ) { $this->_dirs = $dirs; + $this->string = $string; + $this->dateTime = $dateTime; parent::__construct($config); } @@ -345,7 +361,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad } if (!isset($this->_config['host'])) { - throw new \Zend_Db_Adapter_Exception('No host configured to connect to' . mageDebugBacktrace(true)); + throw new \Zend_Db_Adapter_Exception('No host configured to connect'); } if (strpos($this->_config['host'], '/') !== false) { @@ -1666,7 +1682,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad $options['precision'] = $columnData['PRECISION']; } - $comment = uc_words($columnData['COLUMN_NAME'], ' '); + $comment = $this->string->upperCaseWords($columnData['COLUMN_NAME'], '_', ' '); $result = array( 'name' => $columnData['COLUMN_NAME'], @@ -1690,7 +1706,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad { $describe = $this->describeTable($tableName); $table = $this->newTable($newTableName) - ->setComment(uc_words($newTableName, ' ')); + ->setComment($this->string->upperCaseWords($newTableName, '_', ' ')); foreach ($describe as $columnData) { $columnInfo = $this->getColumnCreateByDescribe($columnData); @@ -2605,7 +2621,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad */ public function formatDate($date, $includeTime = true) { - $date = \Magento\Date::formatDate($date, $includeTime); + $date = $this->dateTime->formatDate($date, $includeTime); if ($date === null) { return new \Zend_Db_Expr('NULL'); diff --git a/lib/Magento/Data/Collection/Db.php b/lib/Magento/Data/Collection/Db.php index ff412df38249111e885bf52230c4d97c8af32695..39a65dca0b17147c7e79c789bf0323bf629d7bd3 100644 --- a/lib/Magento/Data/Collection/Db.php +++ b/lib/Magento/Data/Collection/Db.php @@ -92,7 +92,7 @@ class Db extends \Magento\Data\Collection protected $_isOrdersRendered = false; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $_logger; @@ -102,13 +102,13 @@ class Db extends \Magento\Data\Collection private $_fetchStrategy; /** - * @param \Magento\Core\Model\Logger $logger + * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Core\Model\EntityFactory $entityFactory * @param null $conn */ public function __construct( - \Magento\Core\Model\Logger $logger, + \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Core\Model\EntityFactory $entityFactory, $conn = null diff --git a/lib/Magento/Data/Form.php b/lib/Magento/Data/Form.php index 14a79742a72d3e40d5a127e01e9f8614652a06ce..e52eaefa9fc412256903d3cde3ea2ee3c0fe2a19 100644 --- a/lib/Magento/Data/Form.php +++ b/lib/Magento/Data/Form.php @@ -24,20 +24,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Data form - * - * @category Magento - * @package Magento_Data - * @author Magento Core Team <core@magentocommerce.com> - * - * @method \Magento\Data\Form setParent($block) - * @method \Magento\Backend\Block\Widget\Form getParent() - * @method \Magento\Backend\Block\Widget\Form setUseContainer($flag) - */ namespace Magento\Data; -use \Magento\Core\Model\Session\AbstractSession; +use \Magento\Core\Model\Session; class Form extends \Magento\Data\Form\AbstractForm { @@ -67,15 +56,18 @@ class Form extends \Magento\Data\Form\AbstractForm static protected $_defaultFieldsetElementRenderer; /** - * @param \Magento\Data\Form\Element\Factory $factoryElement - * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param Session $session + * @param Form\Element\Factory $factoryElement + * @param Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( + Session $session, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { + $this->_session = $session; parent::__construct($factoryElement, $factoryCollection, $attributes); $this->_allElements = $this->_factoryCollection->create(array('container' => $this)); } @@ -83,10 +75,10 @@ class Form extends \Magento\Data\Form\AbstractForm /** * Set session instance * - * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Core\Model\Session $session * @return \Magento\Data\Form */ - public function setSession(AbstractSession $session) + public function setSession(Session $session) { $this->_session = $session; return $this; @@ -100,9 +92,6 @@ class Form extends \Magento\Data\Form\AbstractForm */ protected function _getSession() { - if (null == $this->_session) { - throw new \Magento\Exception('Session is not set'); - } return $this->_session; } @@ -148,10 +137,11 @@ class Form extends \Magento\Data\Form\AbstractForm /** * Add form element * - * @param \Magento\Data\Form\Element\AbstractElement $element - * @return \Magento\Data\Form + * @param \Magento\Data\Form\Element\AbstractElement $element + * @param bool $after + * @return \Magento\Data\Form */ - public function addElement(\Magento\Data\Form\Element\AbstractElement $element, $after=false) + public function addElement(\Magento\Data\Form\Element\AbstractElement $element, $after = false) { $this->checkElementId($element->getId()); parent::addElement($element, $after); @@ -170,6 +160,10 @@ class Form extends \Magento\Data\Form\AbstractForm return isset($this->_elementsIndex[$elementId]); } + /** + * @param \Magento\Data\Form\Element\AbstractElement $element + * @return $this + */ public function addElementToCollection($element) { $this->_elementsIndex[$element->getId()] = $element; @@ -177,14 +171,22 @@ class Form extends \Magento\Data\Form\AbstractForm return $this; } + /** + * @param string $elementId + * @return bool + * @throws \Exception + */ public function checkElementId($elementId) { if ($this->_elementIdExists($elementId)) { - throw new \Exception('Element with id "'.$elementId.'" already exists'); + throw new \InvalidArgumentException('Element with id "' . $elementId . '" already exists'); } return true; } + /** + * @return $this + */ public function getForm() { return $this; @@ -204,6 +206,10 @@ class Form extends \Magento\Data\Form\AbstractForm return null; } + /** + * @param array $values + * @return $this + */ public function setValues($values) { foreach ($this->_allElements as $element) { @@ -216,13 +222,18 @@ class Form extends \Magento\Data\Form\AbstractForm return $this; } + /** + * @param array $values + * @return $this + */ public function addValues($values) { if (!is_array($values)) { return $this; } - foreach ($values as $elementId=>$value) { - if ($element = $this->getElement($elementId)) { + foreach ($values as $elementId => $value) { + $element = $this->getElement($elementId); + if ($element) { $element->setValue($value); } } @@ -246,6 +257,11 @@ class Form extends \Magento\Data\Form\AbstractForm return $this; } + /** + * @param string $name + * @param string $suffix + * @return string + */ public function addSuffixToName($name, $suffix) { if (!$name) { @@ -253,15 +269,19 @@ class Form extends \Magento\Data\Form\AbstractForm } $vars = explode('[', $name); $newName = $suffix; - foreach ($vars as $index=>$value) { - $newName.= '['.$value; - if ($index==0) { - $newName.= ']'; + foreach ($vars as $index => $value) { + $newName .= '[' . $value; + if ($index == 0) { + $newName .= ']'; } } return $newName; } + /** + * @param string $elementId + * @return $this|Form\AbstractForm + */ public function removeField($elementId) { if ($this->_elementIdExists($elementId)) { @@ -270,25 +290,36 @@ class Form extends \Magento\Data\Form\AbstractForm return $this; } + /** + * @param string $prefix + * @return $this + */ public function setFieldContainerIdPrefix($prefix) { $this->setData('field_container_id_prefix', $prefix); return $this; } + /** + * @return string + */ public function getFieldContainerIdPrefix() { return $this->getData('field_container_id_prefix'); } + /** + * @return string + */ public function toHtml() { \Magento\Profiler::start('form/toHtml'); $html = ''; - if ($useContainer = $this->getUseContainer()) { - $html .= '<form '.$this->serialize($this->getHtmlAttributes()).'>'; + $useContainer = $this->getUseContainer(); + if ($useContainer) { + $html .= '<form ' . $this->serialize($this->getHtmlAttributes()) . '>'; $html .= '<div>'; - if (strtolower($this->getData('method')) == 'post') { + if (strtolower($this->getData('method')) == 'post' && null !== $this->_getSession()) { $html .= '<input name="form_key" type="hidden" value="' . $this->_getSession()->getFormKey() . '" />'; diff --git a/lib/Magento/Data/Form/Element/AbstractElement.php b/lib/Magento/Data/Form/Element/AbstractElement.php index 51b4ca27f2004e5e0576a65f19cb8677dba783c1..9928b00c9298553b2f4edd4a158d8c66a11dbdc1 100644 --- a/lib/Magento/Data/Form/Element/AbstractElement.php +++ b/lib/Magento/Data/Form/Element/AbstractElement.php @@ -51,23 +51,23 @@ abstract class AbstractElement extends \Magento\Data\Form\AbstractForm protected $_advanced = false; /** - * @var \Magento\Core\Helper\Data + * @var \Magento\Escaper */ - protected $_coreData; + protected $_escaper; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - $this->_coreData = $coreData; + $this->_escaper = $escaper; parent::__construct($factoryElement, $factoryCollection, $attributes); $this->_renderer = \Magento\Data\Form::getElementRenderer(); } @@ -76,9 +76,10 @@ abstract class AbstractElement extends \Magento\Data\Form\AbstractForm * Add form element * * @param \Magento\Data\Form\Element\AbstractElement $element + * @param bool $after * @return \Magento\Data\Form */ - public function addElement(\Magento\Data\Form\Element\AbstractElement $element, $after=false) + public function addElement(\Magento\Data\Form\Element\AbstractElement $element, $after = false) { if ($this->getForm()) { $this->getForm()->checkElementId($element->getId()); @@ -236,13 +237,13 @@ abstract class AbstractElement extends \Magento\Data\Form\AbstractForm { $html = ''; if ($this->getBeforeElementHtml()) { - $html .= '<label class="addbefore" for="' . $this->getHtmlId() . '">' . $this->getBeforeElementHtml() . '</label>'; + $html .= '<label class="addbefore" for="' . $this->getHtmlId() . '">' . $this->getBeforeElementHtml() . '</label>'; } $html .= '<input id="' . $this->getHtmlId() . '" name="' . $this->getName() . '" ' . $this->_getUiId() . ' value="' . $this->getEscapedValue() . '" ' . $this->serialize($this->getHtmlAttributes()) . '/>'; if ($this->getAfterElementHtml()) { - $html.= '<label class="addafter" for="' . $this->getHtmlId() . '">' . $this->getAfterElementHtml() . '</label>'; + $html.= '<label class="addafter" for="' . $this->getHtmlId() . '">' . $this->getAfterElementHtml() . '</label>'; } return $html; } @@ -353,14 +354,14 @@ abstract class AbstractElement extends \Magento\Data\Form\AbstractForm return $this; } if (!is_array($values)) { - $values = $this->_coreData->escapeHtml(trim($values)); + $values = $this->_escaper->escapeHtml(trim($values)); $values = array($values => $values); } $elementValues = $this->getValues(); if (!empty($elementValues)) { foreach ($values as $key => $value) { if ((isset($elementValues[$key]) && $overwrite) || !isset($elementValues[$key])) { - $elementValues[$key] = $this->_coreData->escapeHtml($value); + $elementValues[$key] = $this->_escaper->escapeHtml($value); } } $values = $elementValues; diff --git a/lib/Magento/Data/Form/Element/Button.php b/lib/Magento/Data/Form/Element/Button.php index 97c05f862b4e8c2093b26f7d60a904eff9c3964e..9d897738e993186618925a2c6e79259dc2ea493f 100644 --- a/lib/Magento/Data/Form/Element/Button.php +++ b/lib/Magento/Data/Form/Element/Button.php @@ -43,18 +43,18 @@ class Button extends \Magento\Data\Form\Element\AbstractElement protected $_htmlAttributes = array('data-mage-init'); /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('button'); $this->setExtType('textfield'); } diff --git a/lib/Magento/Data/Form/Element/Checkbox.php b/lib/Magento/Data/Form/Element/Checkbox.php index 6499ee47b704293478352ae2a7672f0dc4b12c3c..7baccef9fe25955d9efec061cc9c92b946ef324b 100644 --- a/lib/Magento/Data/Form/Element/Checkbox.php +++ b/lib/Magento/Data/Form/Element/Checkbox.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Checkbox extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('checkbox'); $this->setExtType('checkbox'); } diff --git a/lib/Magento/Data/Form/Element/Checkboxes.php b/lib/Magento/Data/Form/Element/Checkboxes.php index 39b72a2d70314500052568316aec3fd0f24d97c9..40db99312418ee57fa48af2229538458ba695cc7 100644 --- a/lib/Magento/Data/Form/Element/Checkboxes.php +++ b/lib/Magento/Data/Form/Element/Checkboxes.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Checkboxes extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('checkbox'); $this->setExtType('checkboxes'); } diff --git a/lib/Magento/Data/Form/Element/Column.php b/lib/Magento/Data/Form/Element/Column.php index 419b7de5b96aba5c31775ccc8667eb733c62a609..c15cb351448b3b743b370f8a73663d4087a17001 100644 --- a/lib/Magento/Data/Form/Element/Column.php +++ b/lib/Magento/Data/Form/Element/Column.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Column extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('column'); } } diff --git a/lib/Magento/Data/Form/Element/Date.php b/lib/Magento/Data/Form/Element/Date.php index 8d036682d504cd18ff46b51fe5c1b69581b40739..39a634b2f63fb3bf804012267210e31578682309 100644 --- a/lib/Magento/Data/Form/Element/Date.php +++ b/lib/Magento/Data/Form/Element/Date.php @@ -41,18 +41,18 @@ class Date extends \Magento\Data\Form\Element\AbstractElement protected $_value; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('text'); $this->setExtType('textfield'); if (isset($attributes['value'])) { @@ -103,7 +103,7 @@ class Date extends \Magento\Data\Form\Element\AbstractElement } // last check, if input format was set if (null === $format) { - $format = \Magento\Date::DATETIME_INTERNAL_FORMAT; + $format = \Magento\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT; if ($this->getInputFormat()) { $format = $this->getInputFormat(); } diff --git a/lib/Magento/Data/Form/Element/Editor.php b/lib/Magento/Data/Form/Element/Editor.php index e44f2804c3902a3c47d5308e07cb7b8a19bbc612..18cd3e0340847169217e8b38fda7aae2d4f27986 100644 --- a/lib/Magento/Data/Form/Element/Editor.php +++ b/lib/Magento/Data/Form/Element/Editor.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Editor extends \Magento\Data\Form\Element\Textarea { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); if($this->isEnabled()) { $this->setType('wysiwyg'); diff --git a/lib/Magento/Data/Form/Element/Fieldset.php b/lib/Magento/Data/Form/Element/Fieldset.php index 2ad98eb5f5a6f5754438d907dd77f4fc18e7f120..ef8716e16eb76d10b852b6a048f942e7005227fe 100644 --- a/lib/Magento/Data/Form/Element/Fieldset.php +++ b/lib/Magento/Data/Form/Element/Fieldset.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Fieldset extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->_renderer = \Magento\Data\Form::getFieldsetRenderer(); $this->setType('fieldset'); if (isset($attributes['advancedSection'])) { diff --git a/lib/Magento/Data/Form/Element/File.php b/lib/Magento/Data/Form/Element/File.php index a3154e84f831a0b670ceefa536e4cd530fffc8e6..1df53fc0c0a458b94d5074eb4158c614f5b3aaab 100644 --- a/lib/Magento/Data/Form/Element/File.php +++ b/lib/Magento/Data/Form/Element/File.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class File extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('file'); $this->setExtType('file'); } diff --git a/lib/Magento/Data/Form/Element/Gallery.php b/lib/Magento/Data/Form/Element/Gallery.php index 21a8a714814b755f6b62d6b90a8c765c13a73de8..f1b1195ff584b6e5ec85959650e43992270b798e 100644 --- a/lib/Magento/Data/Form/Element/Gallery.php +++ b/lib/Magento/Data/Form/Element/Gallery.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Gallery extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('file'); } diff --git a/lib/Magento/Data/Form/Element/Hidden.php b/lib/Magento/Data/Form/Element/Hidden.php index c751819bd71927ed82e043880566631d15a5afef..038b6b940c7a2a62f8caf3b9bbc3497994a73de7 100644 --- a/lib/Magento/Data/Form/Element/Hidden.php +++ b/lib/Magento/Data/Form/Element/Hidden.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Hidden extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('hidden'); $this->setExtType('hiddenfield'); } diff --git a/lib/Magento/Data/Form/Element/Image.php b/lib/Magento/Data/Form/Element/Image.php index c45dfb9626794cd73ea9a179a9c1dfa7763382d7..15b99a7c1b49362e5012cd0521a7063b0f9fe9b9 100644 --- a/lib/Magento/Data/Form/Element/Image.php +++ b/lib/Magento/Data/Form/Element/Image.php @@ -40,21 +40,21 @@ class Image extends \Magento\Data\Form\Element\AbstractElement */ protected $_urlBuilder; /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\UrlInterface $urlBuilder * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\UrlInterface $urlBuilder, $attributes = array() ) { $this->_urlBuilder = $urlBuilder; - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('file'); } diff --git a/lib/Magento/Data/Form/Element/Imagefile.php b/lib/Magento/Data/Form/Element/Imagefile.php index 2790df980ef55d9f8d7472c9750d677840dc8315..9515bc923086ab926bff8fe92c9824b4fbe4c411 100644 --- a/lib/Magento/Data/Form/Element/Imagefile.php +++ b/lib/Magento/Data/Form/Element/Imagefile.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Imagefile extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('file'); $this->setExtType('imagefile'); $this->setAutosubmit(false); diff --git a/lib/Magento/Data/Form/Element/Label.php b/lib/Magento/Data/Form/Element/Label.php index 17cf5ec0761b544f0dcfc63b36090d3929f2193c..20b54b6d63b7208890f26d2364248ca7c61402cf 100644 --- a/lib/Magento/Data/Form/Element/Label.php +++ b/lib/Magento/Data/Form/Element/Label.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Label extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('label'); } diff --git a/lib/Magento/Data/Form/Element/Link.php b/lib/Magento/Data/Form/Element/Link.php index 16041edf216f9a1f5e464c8ab76d4fb55b0630c8..86c6d16883b502b02bd3bf97b8a9f6e0a65d672a 100644 --- a/lib/Magento/Data/Form/Element/Link.php +++ b/lib/Magento/Data/Form/Element/Link.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Link extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('link'); } diff --git a/lib/Magento/Data/Form/Element/Multiline.php b/lib/Magento/Data/Form/Element/Multiline.php index e2fb5c783a8f07e2c0fc5642a48f2c269f2f7994..ec9da9dd58df70719a198497080bee0dbda7c3c6 100644 --- a/lib/Magento/Data/Form/Element/Multiline.php +++ b/lib/Magento/Data/Form/Element/Multiline.php @@ -34,18 +34,18 @@ namespace Magento\Data\Form\Element; class Multiline extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('text'); $this->setLineCount(2); } diff --git a/lib/Magento/Data/Form/Element/Multiselect.php b/lib/Magento/Data/Form/Element/Multiselect.php index 4a26742dc54f60caae63e30ed9a8accf6c92f521..7b7ee7904acb41414d1501309d4f40c0ac588096 100644 --- a/lib/Magento/Data/Form/Element/Multiselect.php +++ b/lib/Magento/Data/Form/Element/Multiselect.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Multiselect extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('select'); $this->setExtType('multiple'); $this->setSize(10); diff --git a/lib/Magento/Data/Form/Element/Note.php b/lib/Magento/Data/Form/Element/Note.php index ee05217fa1016a1bdd5146b228c559773396e0d2..9aacb94eb3f895c001f5454256e9ecbd39557f81 100644 --- a/lib/Magento/Data/Form/Element/Note.php +++ b/lib/Magento/Data/Form/Element/Note.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Note extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('note'); } diff --git a/lib/Magento/Data/Form/Element/Password.php b/lib/Magento/Data/Form/Element/Password.php index 81fe50d6aed5b079d6f45fa145760424d82f6cca..a12fd0b1cf8bed98e45ae39ce4490a073248c33f 100644 --- a/lib/Magento/Data/Form/Element/Password.php +++ b/lib/Magento/Data/Form/Element/Password.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Password extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('password'); $this->setExtType('textfield'); } diff --git a/lib/Magento/Data/Form/Element/Radio.php b/lib/Magento/Data/Form/Element/Radio.php index 2d18f3cd2598228c9a3b27d2c3b837e4a2a65d2f..9a5a2c86aa4bff5af0efd3059c0e7a64f2dddb72 100644 --- a/lib/Magento/Data/Form/Element/Radio.php +++ b/lib/Magento/Data/Form/Element/Radio.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Radio extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('radio'); $this->setExtType('radio'); } diff --git a/lib/Magento/Data/Form/Element/Radios.php b/lib/Magento/Data/Form/Element/Radios.php index e0cdfa71a9c8a76231a6a223b45fc2681caaca1b..95d3e0a5a27890a0a4696619ec1fa616fa883f59 100644 --- a/lib/Magento/Data/Form/Element/Radios.php +++ b/lib/Magento/Data/Form/Element/Radios.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Radios extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('radios'); } diff --git a/lib/Magento/Data/Form/Element/Reset.php b/lib/Magento/Data/Form/Element/Reset.php index e78283af098e90a3ea3696454a4dde4b5424a923..7eeada145eaa96955b02844f8642407476d69b3e 100644 --- a/lib/Magento/Data/Form/Element/Reset.php +++ b/lib/Magento/Data/Form/Element/Reset.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Reset extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('text'); $this->setExtType('textfield'); } diff --git a/lib/Magento/Data/Form/Element/Select.php b/lib/Magento/Data/Form/Element/Select.php index 1d1869c0953bfab1b9bf415aec4b582a5beaddd1..1e40cb45248ec12f7630b0854bccf65ca2594d05 100644 --- a/lib/Magento/Data/Form/Element/Select.php +++ b/lib/Magento/Data/Form/Element/Select.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Select extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('select'); $this->setExtType('combobox'); $this->_prepareOptions(); diff --git a/lib/Magento/Data/Form/Element/Submit.php b/lib/Magento/Data/Form/Element/Submit.php index d966c02e3a6630e00016cfe667e98b15ad479f87..ca1ccec4418993c2908554ec86b543c6aa7ee530 100644 --- a/lib/Magento/Data/Form/Element/Submit.php +++ b/lib/Magento/Data/Form/Element/Submit.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Submit extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setExtType('submit'); $this->setType('submit'); } diff --git a/lib/Magento/Data/Form/Element/Text.php b/lib/Magento/Data/Form/Element/Text.php index bd5c083d24e945911d03d0ae578ecd9b8d18f82c..d80d7568e92843201451278b1fe15ea335e01a08 100644 --- a/lib/Magento/Data/Form/Element/Text.php +++ b/lib/Magento/Data/Form/Element/Text.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Text extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('text'); $this->setExtType('textfield'); } diff --git a/lib/Magento/Data/Form/Element/Textarea.php b/lib/Magento/Data/Form/Element/Textarea.php index 2dc79d8b1b148b77a4fece51d886cd73aa8beb4c..4720b01f7c41ee46579d978966cc144a7dd5ed96 100644 --- a/lib/Magento/Data/Form/Element/Textarea.php +++ b/lib/Magento/Data/Form/Element/Textarea.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Textarea extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('textarea'); $this->setExtType('textarea'); $this->setRows(2); diff --git a/lib/Magento/Data/Form/Element/Time.php b/lib/Magento/Data/Form/Element/Time.php index 57f6814bd69ecae22aab0210dabd25674903cdd7..77e3fdfc8e2bc9d7cc76c2178a99d7a516d603e6 100644 --- a/lib/Magento/Data/Form/Element/Time.php +++ b/lib/Magento/Data/Form/Element/Time.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Time extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param array $attributes */ public function __construct( - \Magento\Core\Helper\Data $coreData, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, $attributes = array() ) { - parent::__construct($coreData, $factoryElement, $factoryCollection, $attributes); + parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); $this->setType('time'); } diff --git a/lib/Magento/Data/Form/Filter/Date.php b/lib/Magento/Data/Form/Filter/Date.php index 1dd64c7003b4ff1bd5c8e633682b5826589accf5..8a34aaf4d1aaceab554532190b34149875aac315 100644 --- a/lib/Magento/Data/Form/Filter/Date.php +++ b/lib/Magento/Data/Form/Filter/Date.php @@ -59,7 +59,7 @@ class Date implements \Magento\Data\Form\Filter\FilterInterface public function __construct($format = null, $locale = null) { if (is_null($format)) { - $format = \Magento\Date::DATE_INTERNAL_FORMAT; + $format = \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT; } $this->_dateFormat = $format; $this->_locale = $locale; @@ -78,7 +78,7 @@ class Date implements \Magento\Data\Form\Filter\FilterInterface 'locale' => $this->_locale )); $filterInternal = new \Zend_Filter_NormalizedToLocalized(array( - 'date_format' => \Magento\Date::DATE_INTERNAL_FORMAT, + 'date_format' => \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT, 'locale' => $this->_locale )); @@ -96,7 +96,7 @@ class Date implements \Magento\Data\Form\Filter\FilterInterface public function outputFilter($value) { $filterInput = new \Zend_Filter_LocalizedToNormalized(array( - 'date_format' => \Magento\Date::DATE_INTERNAL_FORMAT, + 'date_format' => \Magento\Stdlib\DateTime::DATE_INTERNAL_FORMAT, 'locale' => $this->_locale )); $filterInternal = new \Zend_Filter_NormalizedToLocalized(array( diff --git a/lib/Magento/Data/Form/Factory.php b/lib/Magento/Data/FormFactory.php similarity index 83% rename from lib/Magento/Data/Form/Factory.php rename to lib/Magento/Data/FormFactory.php index 0e283cbfd90f10bacff6ae7d75fdeca178cf742b..628a14c901354450bafd5a57ecd57e73a8fa0caa 100644 --- a/lib/Magento/Data/Form/Factory.php +++ b/lib/Magento/Data/FormFactory.php @@ -23,12 +23,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Data\Form; +namespace Magento\Data; /** * Form factory class */ -class Factory +class FormFactory { /** * Object Manager instance @@ -44,27 +44,17 @@ class Factory */ protected $_instanceName; - /** - * Session instance - * - * @var \Magento\Core\Model\Session\AbstractSession - */ - protected $_session; - /** * Factory construct * * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\Session\AbstractSession $session * @param string $instanceName */ public function __construct( \Magento\ObjectManager $objectManager, - \Magento\Core\Model\Session\AbstractSession $session, $instanceName = 'Magento\Data\Form' ) { $this->_objectManager = $objectManager; - $this->_session = $session; $this->_instanceName = $instanceName; } @@ -80,9 +70,8 @@ class Factory /** @var $form \Magento\Data\Form */ $form = $this->_objectManager->create($this->_instanceName, $data); if (!$form instanceof \Magento\Data\Form) { - throw new \Magento\Exception($this->_instanceName . ' doesn\'t extends \Magento\Data\Form'); + throw new \Magento\Exception($this->_instanceName . ' doesn\'t extend \Magento\Data\Form'); } - $form->setSession($this->_session); return $form; } } diff --git a/lib/Magento/Debug.php b/lib/Magento/Debug.php index 14052488d212010e19f3d6840390ce9afe7944d8..6c12d4570cb647538f8bfca94f2588085b94efc3 100644 --- a/lib/Magento/Debug.php +++ b/lib/Magento/Debug.php @@ -36,6 +36,7 @@ namespace Magento; class Debug { public static $argLength = 16; + /** * Magento Root path * @@ -61,11 +62,11 @@ class Debug } /** - * Prints or return a backtrace + * Prints or returns a backtrace * * @param bool $return return or print * @param bool $html output in HTML format - * @param bool $withArgs add short argumets of methods + * @param bool $withArgs add short arguments of methods * @return string|bool */ public static function backtrace($return = false, $html = true, $withArgs = true) @@ -80,7 +81,7 @@ class Debug * @param array $trace trace array * @param bool $return return or print * @param bool $html output in HTML format - * @param bool $withArgs add short argumets of methods + * @param bool $withArgs add short arguments of methods * @return string|bool */ public static function trace(array $trace, $return = false, $html = true, $withArgs = true) @@ -96,7 +97,7 @@ class Debug continue; } - // prepare method argments + // prepare method arguments $args = array(); if (isset($data['args']) && $withArgs) { foreach ($data['args'] as $arg) { @@ -160,6 +161,7 @@ class Debug * Format argument in called method * * @param mixed $arg + * @return string */ protected static function _formatCalledArgument($arg) { diff --git a/lib/Magento/Crypt.php b/lib/Magento/Encryption/Crypt.php old mode 100755 new mode 100644 similarity index 98% rename from lib/Magento/Crypt.php rename to lib/Magento/Encryption/Crypt.php index 687e753c4b3ee126451ae13e748bc960e335ee3c..50b6fe9b9963bb9775e623d856951b9bb72b0677 --- a/lib/Magento/Crypt.php +++ b/lib/Magento/Encryption/Crypt.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Crypt + * @package Magento_Encryption * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +27,7 @@ /** * Class encapsulates cryptographic algorithm */ -namespace Magento; +namespace Magento\Encryption; class Crypt { diff --git a/lib/Magento/Encryption/CryptFactory.php b/lib/Magento/Encryption/CryptFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..ae5b87d0190b9c9146020bf53bf0df5feafacfab --- /dev/null +++ b/lib/Magento/Encryption/CryptFactory.php @@ -0,0 +1,59 @@ +<?php +/** + * Crypt object factory. + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Encryption; + +/** + * Crypt factory + */ +class CryptFactory +{ + /** + * Object manager + * + * @var \Magento\ObjectManager + */ + private $_objectManager; + + /** + * @param \Magento\ObjectManager $objectManager + */ + public function __construct(\Magento\ObjectManager $objectManager) + { + $this->_objectManager = $objectManager; + } + + /** + * Create new magento crypt instance + * + * @param array $data + * @return \Magento\Encryption\Crypt + */ + public function create($data = array()) + { + return $this->_objectManager->create('Magento\Encryption\Crypt', $data); + } +} diff --git a/app/code/Magento/Core/Model/Encryption.php b/lib/Magento/Encryption/Encryptor.php similarity index 67% rename from app/code/Magento/Core/Model/Encryption.php rename to lib/Magento/Encryption/Encryptor.php index dcb12324ddfc6cd2d39c39028ab8c6de6ce692ed..064215eed617382063755b97ffb85e115721164e 100644 --- a/app/code/Magento/Core/Model/Encryption.php +++ b/lib/Magento/Encryption/Encryptor.php @@ -24,75 +24,55 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Encryption; + /** * Provides basic logic for hashing passwords and encrypting/decrypting misc data - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Model; - -class Encryption implements \Magento\Core\Model\EncryptionInterface +class Encryptor implements EncryptorInterface { + /** + * Crypt key + */ const PARAM_CRYPT_KEY = 'crypt.key'; /** - * @var \Magento\Crypt + * @var \Magento\Math\Random */ - protected $_crypt; + protected $_randomGenerator; /** + * Cryptographic key + * * @var string */ - protected $_helper; + protected $_cryptKey; /** - * @var \Magento\ObjectManager|null + * @var \Magento\Encryption\CryptFactory */ - protected $_objectManager = null; + protected $_cryptFactory; /** - * Cryptographic key - * - * @var string + * @var \Magento\Encryption\Crypt */ - protected $_cryptKey; + protected $_crypt; /** - * @param \Magento\ObjectManager $objectManager + * @param \Magento\Math\Random $randomGenerator + * @param \Magento\Encryption\CryptFactory $cryptFactory * @param string $cryptKey */ public function __construct( - \Magento\ObjectManager $objectManager, + \Magento\Math\Random $randomGenerator, + \Magento\Encryption\CryptFactory $cryptFactory, $cryptKey ) { - $this->_objectManager = $objectManager; + $this->_randomGenerator = $randomGenerator; + $this->_cryptFactory = $cryptFactory; $this->_cryptKey = $cryptKey; } - /** - * Set helper instance - * - * @param \Magento\Core\Helper\Data|string $helper - * @return \Magento\Core\Model\Encryption - * @throws \InvalidArgumentException - */ - public function setHelper($helper) - { - if (!is_string($helper)) { - if ($helper instanceof \Magento\Core\Helper\AbstractHelper) { - $helper = get_class($helper); - } else { - throw new \InvalidArgumentException( - 'Input parameter "$helper" must be either "string" or instance of "Magento\Core\Helper\AbstractHelper"' - ); - } - } - $this->_helper = $helper; - return $this; - } - /** * Generate a [salted] hash. * @@ -108,7 +88,7 @@ class Encryption implements \Magento\Core\Model\EncryptionInterface public function getHash($password, $salt = false) { if (is_integer($salt)) { - $salt = $this->_objectManager->get($this->_helper)->getRandomString($salt); + $salt = $this->_randomGenerator->getRandomString($salt); } return $salt === false ? $this->hash($password) : $this->hash($salt . $password) . ':' . $salt; } @@ -129,7 +109,7 @@ class Encryption implements \Magento\Core\Model\EncryptionInterface * * @param string $password * @param string $hash - * @throws \Magento\Core\Exception + * @throws \InvalidArgumentException * @return bool */ public function validateHash($password, $hash) @@ -140,27 +120,10 @@ class Encryption implements \Magento\Core\Model\EncryptionInterface return $this->hash($password) === $hash; case 2: return $this->hash($hashArr[1] . $password) === $hashArr[0]; + default: + break; } - throw new \Magento\Core\Exception('Invalid hash.'); - } - - /** - * Instantiate crypt model - * - * @param string $key - * @return \Magento\Crypt - */ - protected function _getCrypt($key = null) - { - if (null !== $key) { - return $this->_objectManager->create('Magento\Crypt', array('key' => $key)); - } - - if (!$this->_crypt) { - $this->_crypt = $this->_objectManager->create('Magento\Crypt', array('key' => $this->_cryptKey)); - } - - return $this->_crypt; + throw new \InvalidArgumentException('Invalid hash.'); } /** @@ -171,6 +134,9 @@ class Encryption implements \Magento\Core\Model\EncryptionInterface */ public function encrypt($data) { + if (empty($this->_cryptKey)) { + return $data; + } return base64_encode($this->_getCrypt()->encrypt((string)$data)); } @@ -182,6 +148,10 @@ class Encryption implements \Magento\Core\Model\EncryptionInterface */ public function decrypt($data) { + if (empty($this->_cryptKey)) { + return $data; + } + return trim($this->_getCrypt()->decrypt(base64_decode((string)$data))); } @@ -189,10 +159,28 @@ class Encryption implements \Magento\Core\Model\EncryptionInterface * Return crypt model, instantiate if it is empty * * @param string $key - * @return \Magento\Crypt + * @return \Magento\Encryption\Crypt */ public function validateKey($key) { return $this->_getCrypt($key); } + + /** + * Instantiate crypt model + * + * @param string $key + * @return \Magento\Encryption\Crypt + */ + protected function _getCrypt($key = null) + { + if ($key === null) { + if (!$this->_crypt) { + $this->_crypt = $this->_cryptFactory->create(array('key' => $this->_cryptKey)); + } + return $this->_crypt; + } else { + return $this->_cryptFactory->create(array('key' => $key)); + } + } } diff --git a/app/code/Magento/Core/Model/EncryptionInterface.php b/lib/Magento/Encryption/EncryptorInterface.php similarity index 85% rename from app/code/Magento/Core/Model/EncryptionInterface.php rename to lib/Magento/Encryption/EncryptorInterface.php index f30881d2450b652b271e40d25045394690d49c7c..3b9f9e51f0e4d09e42032ceb7879c7f7033eeca0 100644 --- a/app/code/Magento/Core/Model/EncryptionInterface.php +++ b/lib/Magento/Encryption/EncryptorInterface.php @@ -21,19 +21,13 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Encryption; -interface EncryptionInterface +/** + * Encryptor interface + */ +interface EncryptorInterface { - /** - * Set helper instance - * - * @param \Magento\Core\Helper\Data|string $helper - * @return \Magento\Core\Model\Encryption - * @throws \InvalidArgumentException - */ - public function setHelper($helper); - /** * Generate a [salted] hash. * @@ -62,7 +56,7 @@ interface EncryptionInterface * @param string $password * @param string $hash * @return bool - * @throws Exception + * @throws \Exception */ public function validateHash($password, $hash); @@ -86,7 +80,7 @@ interface EncryptionInterface * Return crypt model, instantiate if it is empty * * @param string $key - * @return \Magento\Crypt + * @return \Magento\Encryption\Crypt */ public function validateKey($key); } diff --git a/lib/Magento/Error/Handler.php b/lib/Magento/Error/Handler.php new file mode 100644 index 0000000000000000000000000000000000000000..62f2a2e277e81c649bf21904d73736552d348610 --- /dev/null +++ b/lib/Magento/Error/Handler.php @@ -0,0 +1,118 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Error; + +/** + * Default Error Handler + */ +class Handler implements HandlerInterface +{ + /** + * Error messages + * + * @var array + */ + protected $errorPhrases = array( + E_ERROR => 'Error', + E_WARNING => 'Warning', + E_PARSE => 'Parse Error', + E_NOTICE => 'Notice', + E_CORE_ERROR => 'Core Error', + E_CORE_WARNING => 'Core Warning', + E_COMPILE_ERROR => 'Compile Error', + E_COMPILE_WARNING => 'Compile Warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', + E_STRICT => 'Strict Notice', + E_RECOVERABLE_ERROR => 'Recoverable Error', + E_DEPRECATED => 'Deprecated Functionality', + E_USER_DEPRECATED => 'User Deprecated Functionality' + ); + + /** + * Process exception + * + * @param \Exception $exception + * @param array $params + */ + public function processException(\Exception $exception, array $params = array()) + { + print '<pre>'; + print $exception->getMessage() . "\n\n"; + print $exception->getTraceAsString(); + print '</pre>'; + } + + /** + * Show error as exception + * + * @param string $errorMessage + * @throws \Exception + */ + protected function _processError($errorMessage) + { + throw new \Exception($errorMessage); + } + + /** + * Custom error handler + * + * @param int $errorNo + * @param string $errorStr + * @param string $errorFile + * @param int $errorLine + * @return bool + */ + public function handler($errorNo, $errorStr, $errorFile, $errorLine) + { + if (strpos($errorStr, 'DateTimeZone::__construct') !== false) { + // there's no way to distinguish between caught system exceptions and warnings + return false; + } + $errorNo = $errorNo & error_reporting(); + if ($errorNo == 0) { + return false; + } + + // PEAR specific message handling + if (stripos($errorFile . $errorStr, 'pear') !== false) { + // ignore strict and deprecated notices + if (($errorNo == E_STRICT) || ($errorNo == E_DEPRECATED)) { + return true; + } + // ignore attempts to read system files when open_basedir is set + if ($errorNo == E_WARNING && stripos($errorStr, 'open_basedir') !== false) { + return true; + } + } + $errorMessage = isset($this->errorPhrases[$errorNo]) + ? $this->errorPhrases[$errorNo] + : "Unknown error ($errorNo)"; + $errorMessage .= ": {$errorStr} in {$errorFile} on line {$errorLine}"; + $this->_processError($errorMessage); + return true; + } +} diff --git a/lib/Magento/Error/HandlerInterface.php b/lib/Magento/Error/HandlerInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..e9292d4e3ec378667620aa985b674281f3dcac4b --- /dev/null +++ b/lib/Magento/Error/HandlerInterface.php @@ -0,0 +1,50 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Interface of Error Handler + */ +namespace Magento\Error; + +interface HandlerInterface +{ + /** + * Error handler callback method + * + * @param int $errorNo + * @param string $errorStr + * @param string $errorFile + * @param int $errorLine + * @return bool + */ + public function handler($errorNo, $errorStr, $errorFile, $errorLine); + + /** + * Process exception + * + * @param \Exception $exception + * @param array $params + */ + public function processException(\Exception $exception, array $params = array()); +} diff --git a/lib/Magento/Escaper.php b/lib/Magento/Escaper.php new file mode 100644 index 0000000000000000000000000000000000000000..3390ed98abcba8888a3093891013cf7206620d95 --- /dev/null +++ b/lib/Magento/Escaper.php @@ -0,0 +1,108 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package \Magento\Escaper + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento; +/** + * Magento escape methods + */ +class Escaper +{ + /** + * Escape html entities + * + * @param string|array $data + * @param array $allowedTags + * @return string|array + */ + public function escapeHtml($data, $allowedTags = null) + { + if (is_array($data)) { + $result = array(); + foreach ($data as $item) { + $result[] = $this->escapeHtml($item); + } + } else if(strlen($data)) { + if (is_array($allowedTags) and !empty($allowedTags)) { + $allowed = implode('|', $allowedTags); + $result = preg_replace('/<([\/\s\r\n]*)(' . $allowed . ')([\/\s\r\n]*)>/si', '##$1$2$3##', $data); + $result = htmlspecialchars($result, ENT_COMPAT, 'UTF-8', false); + $result = preg_replace('/##([\/\s\r\n]*)(' . $allowed . ')([\/\s\r\n]*)##/si', '<$1$2$3>', $result); + } else { + $result = htmlspecialchars($data, ENT_COMPAT, 'UTF-8', false); + } + } else { + $result = $data; + } + return $result; + } + + /** + * Escape html entities in url + * + * @param string $data + * @return string + */ + public function escapeUrl($data) + { + return htmlspecialchars($data); + } + + /** + * Escape quotes in java script + * + * @param string|array $data + * @param string $quote + * @return string|array + */ + public function escapeJsQuote($data, $quote = '\'') + { + if (is_array($data)) { + $result = array(); + foreach ($data as $item) { + $result[] = $this->escapeJsQuote($item, $quote); + } + } else { + $result = str_replace($quote, '\\' . $quote, $data); + } + return $result; + } + + /** + * Escape quotes inside html attributes + * Use $addSlashes = false for escaping js that inside html attribute (onClick, onSubmit etc) + * + * @param string $data + * @param bool $addSlashes + * @return string + */ + public function escapeQuote($data, $addSlashes = false) + { + if ($addSlashes === true) { + $data = addslashes($data); + } + return htmlspecialchars($data, ENT_QUOTES, null, false); + } +} diff --git a/lib/Magento/Event/Invoker/InvokerDefault.php b/lib/Magento/Event/Invoker/InvokerDefault.php index a2230ec5cc820d9c8ce7ab1a03aa35e123863d1e..baac41ef9fd3d8f4978aa27c9c6a14f94bb3aa78 100644 --- a/lib/Magento/Event/Invoker/InvokerDefault.php +++ b/lib/Magento/Event/Invoker/InvokerDefault.php @@ -25,6 +25,8 @@ */ namespace Magento\Event\Invoker; +use Zend\Stdlib\Exception\LogicException; + class InvokerDefault implements \Magento\Event\InvokerInterface { /** @@ -79,14 +81,14 @@ class InvokerDefault implements \Magento\Event\InvokerInterface * @param string $method * @param \Magento\Event\Observer $observer * @return \Magento\Event\InvokerInterface - * @throws \Magento\Core\Exception + * @throws \LogicException */ protected function _callObserverMethod($object, $method, $observer) { if (method_exists($object, $method)) { $object->$method($observer); } elseif ($this->_appState->getMode() == \Magento\App\State::MODE_DEVELOPER) { - throw new \Magento\Core\Exception('Method "' . $method . '" is not defined in "' . get_class($object) . '"'); + throw new \LogicException('Method "' . $method . '" is not defined in "' . get_class($object) . '"'); } return $this; } diff --git a/lib/Magento/Event/Manager.php b/lib/Magento/Event/Manager.php index 019f776dcd9d76b54e16f9563e0e95c1954d28e9..dc4576502c80d2b69e1855989e15831bae5667d9 100644 --- a/lib/Magento/Event/Manager.php +++ b/lib/Magento/Event/Manager.php @@ -38,47 +38,27 @@ class Manager implements ManagerInterface /** * Event invoker * - * @var \Magento\Event\InvokerInterface + * @var InvokerInterface */ protected $_invoker; /** * Event config * - * @var \Magento\Event\ConfigInterface + * @var ConfigInterface */ protected $_eventConfig; - /** - * Magento event factory - * - * @var \Magento\EventFactory - */ - protected $_eventFactory; - - /** - * Magento event observer factory - * - * @var \Magento\Event\WrapperFactory - */ - protected $wrapperFactory; - /** * @param InvokerInterface $invoker * @param ConfigInterface $eventConfig - * @param \Magento\EventFactory $eventFactory - * @param WrapperFactory $wrapperFactory */ public function __construct( - \Magento\Event\InvokerInterface $invoker, - \Magento\Event\ConfigInterface $eventConfig, - \Magento\EventFactory $eventFactory, - \Magento\Event\WrapperFactory $wrapperFactory + InvokerInterface $invoker, + ConfigInterface $eventConfig ) { $this->_invoker = $invoker; $this->_eventConfig = $eventConfig; - $this->_eventFactory = $eventFactory; - $this->wrapperFactory = $wrapperFactory; } /** @@ -94,12 +74,10 @@ class Manager implements ManagerInterface { \Magento\Profiler::start('EVENT:' . $eventName, array('group' => 'EVENT', 'name' => $eventName)); foreach ($this->_eventConfig->getObservers($eventName) as $observerConfig) { - /** @var $event \Magento\Event */ - $event = $this->_eventFactory->create(array('data' => $data)); + $event = new \Magento\Event($data); $event->setName($eventName); - /** @var $wrapper \Magento\Event\Observer */ - $wrapper = $this->wrapperFactory->create(); + $wrapper = new Observer(); $wrapper->setData(array_merge(array('event' => $event), $data)); \Magento\Profiler::start('OBSERVER:' . $observerConfig['name']); diff --git a/lib/Magento/Filesystem.php b/lib/Magento/Filesystem.php index b281d46d8e85836a747d783958b3e83f408f3b1f..9ab844fa1f6ac2a7f1566f23d496a005d61ee2f4 100644 --- a/lib/Magento/Filesystem.php +++ b/lib/Magento/Filesystem.php @@ -533,4 +533,21 @@ class Filesystem { return 0 === strpos(self::normalizePath($path), self::normalizePath($directory)); } + + /** + * Check LFI protection + * + * @throws \InvalidArgumentException + * @param string $name + * @return bool + */ + public function checkLfiProtection($name) + { + if (preg_match('#\.\.[\\\/]#', $name)) { + throw new \InvalidArgumentException( + 'Requested file may not include parent directory traversal ("../", "..\\" notation)' + ); + } + return true; + } } diff --git a/lib/Magento/Filter/AbstractFactory.php b/lib/Magento/Filter/AbstractFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..4df5b86eb860c1b1bcfad5317f4cda234f8b05ec --- /dev/null +++ b/lib/Magento/Filter/AbstractFactory.php @@ -0,0 +1,119 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Filter + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Magento filter factory abstract + */ +abstract class AbstractFactory implements FactoryInterface +{ + /** + * Set of filters + * + * @var array + */ + protected $invokableClasses = array(); + + /** + * Whether or not to share by default; default to false + * + * @var bool + */ + protected $shareByDefault = true; + + /** + * Shared instances, by default is shared + * + * @var array + */ + protected $shared = array(); + + /** + * @var \Magento\ObjectManager + */ + protected $objectManager; + + /** + * @var \Zend_Filter_Interface[] + */ + protected $sharedInstances = array(); + + /** + * @param \Magento\ObjectManager $objectManger + */ + public function __construct(\Magento\ObjectManager $objectManger) + { + $this->objectManager = $objectManger; + } + + /** + * Check is it possible to create a filter by given name + * + * @param string $alias + * @return bool + */ + public function canCreateFilter($alias) + { + return array_key_exists($alias, $this->invokableClasses); + } + + /** + * Check is shared filter + * + * @param string $class + * @return bool + */ + public function isShared($class) + { + return isset($this->shared[$class]) ? $this->shared[$class] : $this->shareByDefault; + } + + /** + * Create a filter by given name + * + * @param string $alias + * @param array $arguments + * @return \Zend_Filter_Interface + */ + public function createFilter($alias, array $arguments = array()) + { + $addToShared = !$arguments || isset($this->sharedInstances[$alias]) + xor $this->isShared($this->invokableClasses[$alias]); + + if (!isset($this->sharedInstances[$alias])) { + $filter = $this->objectManager->create($this->invokableClasses[$alias], $arguments); + } else { + $filter = $this->sharedInstances[$alias]; + } + + if ($addToShared) { + $this->sharedInstances[$alias] = $filter; + } + + return $filter; + } +} diff --git a/lib/Magento/Filter/ArrayFilter.php b/lib/Magento/Filter/ArrayFilter.php index 1844d30f0374dff23c61bb63f037e0adec1df145..c84a4047f2c6605d5f38a702703b36fddf2e49e9 100644 --- a/lib/Magento/Filter/ArrayFilter.php +++ b/lib/Magento/Filter/ArrayFilter.php @@ -24,16 +24,25 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Filter; class ArrayFilter extends \Zend_Filter { + /** + * @var array + */ protected $_columnFilters = array(); - - function addFilter(\Zend_Filter_Interface $filter, $column='') + + /** + * {@inheritdoc} + * + * @param \Zend_Filter_Interface $filter + * @param string $column + * @return null|\Zend_Filter + */ + public function addFilter(\Zend_Filter_Interface $filter, $column = '') { - if (''===$column) { + if ('' === $column) { parent::addFilter($filter); } else { if (!isset($this->_columnFilters[$column])) { @@ -42,11 +51,17 @@ class ArrayFilter extends \Zend_Filter $this->_columnFilters[$column]->addFilter($filter); } } - - function filter($array) + + /** + * {@inheritdoc} + * + * @param array $array + * @return array + */ + public function filter($array) { $out = array(); - foreach ($array as $column=>$value) { + foreach ($array as $column => $value) { $value = parent::filter($value); if (isset($this->_columnFilters[$column])) { $value = $this->_columnFilters[$column]->filter($value); diff --git a/lib/Magento/Filter/Decrypt.php b/lib/Magento/Filter/Decrypt.php new file mode 100644 index 0000000000000000000000000000000000000000..b285cef0e6a140ccafbfa0dabf8d19be20811a71 --- /dev/null +++ b/lib/Magento/Filter/Decrypt.php @@ -0,0 +1,39 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Decrypt filter + */ +class Decrypt extends \Zend_Filter_Decrypt +{ + /** + * @param \Magento\Filter\Encrypt\AdapterInterface $adapter + */ + public function __construct(\Magento\Filter\Encrypt\AdapterInterface $adapter) + { + $this->setAdapter($adapter); + } +} diff --git a/lib/Magento/Filter/Email.php b/lib/Magento/Filter/Email.php index a38485291864a2c39df2ba86b0bc02ec695389dd..3d5c63fecded7de952e93c77c9c2cbfa40b34696 100644 --- a/lib/Magento/Filter/Email.php +++ b/lib/Magento/Filter/Email.php @@ -24,13 +24,16 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Filter; class Email implements \Zend_Filter_Interface -{ +{ + /** + * @param mixed $value + * @return mixed + */ public function filter($value) { - $atIndex = 0; + return $value; } } diff --git a/lib/Magento/Filter/Encrypt.php b/lib/Magento/Filter/Encrypt.php new file mode 100644 index 0000000000000000000000000000000000000000..f0bb6a30f35ae09959aa9204104dffad766a3ab4 --- /dev/null +++ b/lib/Magento/Filter/Encrypt.php @@ -0,0 +1,39 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Encrypt filter + */ +class Encrypt extends \Zend_Filter_Encrypt +{ + /** + * @param \Magento\Filter\Encrypt\AdapterInterface $adapter + */ + public function __construct(\Magento\Filter\Encrypt\AdapterInterface $adapter) + { + $this->setAdapter($adapter); + } +} diff --git a/lib/Magento/Filter/Encrypt/AdapterInterface.php b/lib/Magento/Filter/Encrypt/AdapterInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..3121f3b25921414b6eb93c295b398e4aace21028 --- /dev/null +++ b/lib/Magento/Filter/Encrypt/AdapterInterface.php @@ -0,0 +1,33 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter\Encrypt; + +/** + * Encrypt adapter interface + */ +interface AdapterInterface extends \Zend_Filter_Encrypt_Interface +{ + +} diff --git a/lib/Magento/Filter/Encrypt/Basic.php b/lib/Magento/Filter/Encrypt/Basic.php new file mode 100644 index 0000000000000000000000000000000000000000..0c998b9fbaa9cb589531f7d3d4bd0f06f437dd8d --- /dev/null +++ b/lib/Magento/Filter/Encrypt/Basic.php @@ -0,0 +1,63 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter\Encrypt; + +class Basic implements \Zend_Filter_Encrypt_Interface +{ + /** + * @var \Magento\Encryption\EncryptorInterface + */ + protected $encryptor; + + /** + * @param \Magento\Encryption\EncryptorInterface $encryptor + */ + public function __construct(\Magento\Encryption\EncryptorInterface $encryptor) + { + $this->encryptor = $encryptor; + } + + /** + * Encrypt value + * + * @param string $value + * @return string + */ + public function encrypt($value) + { + return $this->encryptor->encrypt($value); + } + + /** + * Decrypt value + * + * @param string $value + * @return string + */ + public function decrypt($value) + { + return $this->encryptor->encrypt($value); + } +} diff --git a/lib/Magento/Filter/Factory.php b/lib/Magento/Filter/Factory.php new file mode 100644 index 0000000000000000000000000000000000000000..c3966a573b5e3c44afd2ddac5a711f8dd92ae4d2 --- /dev/null +++ b/lib/Magento/Filter/Factory.php @@ -0,0 +1,69 @@ +<?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_Filter + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Magento filter factory + */ +class Factory extends AbstractFactory +{ + /** + * Set of filters + * + * @var array + */ + protected $invokableClasses = array( + 'email' => 'Magento\Filter\Email', + 'money' => 'Magento\Filter\Money', + 'simple' => 'Magento\Filter\Template\Simple', + 'object' => 'Magento\Filter\Object', + 'sprintf' => 'Magento\Filter\Sprintf', + 'template' => 'Magento\Filter\Template', + 'arrayFilter' => 'Magento\Filter\ArrayFilter', + 'removeAccents' => 'Magento\Filter\RemoveAccents', + 'splitWords' => 'Magento\Filter\SplitWords', + 'removeTags' => 'Magento\Filter\RemoveTags', + 'stripTags' => 'Magento\Filter\StripTags', + 'truncate' => 'Magento\Filter\Truncate', + 'encrypt' => 'Magento\Filter\Encrypt', + 'decrypt' => 'Magento\Filter\Decrypt', + ); + + /** + * Shared instances, by default is shared + * + * @var array + */ + protected $shared = array( + 'Magento\Filter\Sprintf' => false, + 'Magento\Filter\Money' => false, + 'Magento\Filter\RemoveAccents' => false, + 'Magento\Filter\SplitWords' => false, + 'Magento\Filter\StripTags' => false, + 'Magento\Filter\Truncate' => false, + ); +} diff --git a/app/code/Magento/Backend/Controller/Factory.php b/lib/Magento/Filter/FactoryInterface.php similarity index 50% rename from app/code/Magento/Backend/Controller/Factory.php rename to lib/Magento/Filter/FactoryInterface.php index 18aecc8d4dbc4fe2c56d587ca0ae0563b9c8a870..a29066a4e342984dfc0bb4d8b3f8ab4e66a73663 100644 --- a/app/code/Magento/Backend/Controller/Factory.php +++ b/lib/Magento/Filter/FactoryInterface.php @@ -18,32 +18,41 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @category Magento + * @package Magento_Filter + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Filter; + /** - * Controller factory - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Magento filter factory interface */ -namespace Magento\Backend\Controller; - -class Factory extends \Magento\App\ActionFactory +interface FactoryInterface { /** - * @param string $controllerName + * Check is it possible to create a filter by given name + * + * @param string $alias + * @return bool + */ + public function canCreateFilter($alias); + + /** + * Check is shared filter + * + * @param string $class + * @return bool + */ + public function isShared($class); + + /** + * Create a filter by given name + * + * @param string $alias * @param array $arguments - * @return mixed + * @return \Zend_Filter_Interface */ - public function createController($controllerName, array $arguments = array()) - { - $context = $this->_objectManager->create('Magento\Backend\Controller\Context', $arguments); - $arguments['context'] = $context; - return $this->_objectManager->create($controllerName, $arguments); - } + public function createFilter($alias, array $arguments = array()); } diff --git a/lib/Magento/Filter/FilterManager.php b/lib/Magento/Filter/FilterManager.php new file mode 100644 index 0000000000000000000000000000000000000000..7d8e572b0312b71a90b843391b765adec45ef3d3 --- /dev/null +++ b/lib/Magento/Filter/FilterManager.php @@ -0,0 +1,144 @@ +<?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_Filter + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Magento Filter Manager + */ +class FilterManager +{ + /** + * @var \Magento\ObjectManager + */ + protected $objectManager; + + /** + * @var array + */ + protected $filterInstances = array(); + + /** + * @var FilterManager\Config + */ + protected $config; + + /** + * @var array + */ + protected $factoryInstances; + + /** + * @param \Magento\ObjectManager $objectManger + * @param FilterManager\Config $config + */ + public function __construct( + \Magento\ObjectManager $objectManger, + FilterManager\Config $config + ) { + $this->objectManager = $objectManger; + $this->config = $config; + } + + /** + * Get filter object + * + * @param string $filterAlias + * @param array $arguments + * @return \Zend_Filter_Interface + * @throws \UnexpectedValueException + */ + public function get($filterAlias, array $arguments = array()) + { + $filter = $this->createFilterInstance($filterAlias, $arguments); + if (!$filter instanceof \Zend_Filter_Interface) { + throw new \UnexpectedValueException('Filter object must implement Zend_Filter_Interface interface, ' + . get_class($filter) . ' was given.'); + } + return $filter; + } + + /** + * Create filter instance + * + * @param string $filterAlias + * @param array $arguments + * @return \Zend_Filter_Interface + * @throws \InvalidArgumentException + */ + protected function createFilterInstance($filterAlias, $arguments) + { + /** @var FactoryInterface $factory */ + foreach ($this->getFilterFactories() as $factory) { + if ($factory->canCreateFilter($filterAlias)) { + return $factory->createFilter($filterAlias, $arguments); + } + } + throw new \InvalidArgumentException('Filter was not found by given alias ' . $filterAlias); + } + + /** + * Get registered factories + * + * @return FactoryInterface[] + * @throws \UnexpectedValueException + */ + protected function getFilterFactories() + { + if (null === $this->factoryInstances) { + foreach ($this->config->getFactories() as $class) { + $factory = $this->objectManager->create($class); + if (!$factory instanceof FactoryInterface) { + throw new \UnexpectedValueException( + 'Filter factory must implement FilterFactoryInterface interface, ' + . get_class($factory) . ' was given.' + ); + } + $this->factoryInstances[] = $factory; + } + } + return $this->factoryInstances; + } + + /** + * Create filter and filer value + * + * @param string $filterAlias + * @param array $arguments + * @return mixed + */ + public function __call($filterAlias, array $arguments = array()) + { + $value = array_shift($arguments); + if (count($arguments)) { + $arguments = array_shift($arguments); + if (!is_array($arguments)) { + $arguments = array($arguments); + } + } + return $this->createFilterInstance($filterAlias, $arguments)->filter($value); + } +} diff --git a/lib/Magento/Filter/FilterManager/Config.php b/lib/Magento/Filter/FilterManager/Config.php new file mode 100644 index 0000000000000000000000000000000000000000..ceca4b3bd58526996ab8af493a64fe878eef73d8 --- /dev/null +++ b/lib/Magento/Filter/FilterManager/Config.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. + * + * @category Magento + * @package Magento_Filter + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter\FilterManager; + +/** + * Filter plugin manager config + */ +class Config implements ConfigInterface +{ + /** + * @var array + */ + protected $factories = array( + 'Magento\Filter\Factory', + 'Magento\Filter\ZendFactory' + ); + + /** + * @param array $factories + */ + public function __construct(array $factories = array()) + { + if (!empty($factories)) { + $this->factories = array_merge($factories, $this->factories); + } + } + + /** + * Get list of factories + * + * @return string[] + */ + public function getFactories() + { + return $this->factories; + } +} diff --git a/lib/Magento/Filter/FilterManager/ConfigInterface.php b/lib/Magento/Filter/FilterManager/ConfigInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..59d46a84e446c26807c76a7033b37e1ec8dc7ed1 --- /dev/null +++ b/lib/Magento/Filter/FilterManager/ConfigInterface.php @@ -0,0 +1,40 @@ +<?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_Filter + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter\FilterManager; + +/** + * Filter manager config interface + */ +interface ConfigInterface +{ + /** + * Get list of factories + * + * @return string[] + */ + public function getFactories(); +} diff --git a/lib/Magento/Filter/GridArray/Grid.php b/lib/Magento/Filter/GridArray/Grid.php index 36e0531fc2edbb5775d97fae32e13643eef97005..2c5408bca65cd03f11104d089d6f91864cc2299b 100644 --- a/lib/Magento/Filter/GridArray/Grid.php +++ b/lib/Magento/Filter/GridArray/Grid.php @@ -24,15 +24,18 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Filter\GridArray; class Grid extends \Magento\Filter\ArrayFilter { - function filter($grid) + /** + * @param array $grid + * @return array + */ + public function filter($grid) { $out = array(); - foreach ($grid as $i=>$array) { + foreach ($grid as $i => $array) { $out[$i] = parent::filter($array); } return $out; diff --git a/lib/Magento/Filter/Money.php b/lib/Magento/Filter/Money.php index d908839194ac708499b72da61020c841fe41dd35..e1deadaf7c5993e82aa44a2f7ec4f0f47b1e0995 100644 --- a/lib/Magento/Filter/Money.php +++ b/lib/Magento/Filter/Money.php @@ -24,18 +24,27 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Filter; class Money implements \Zend_Filter_Interface { - protected $_format = null; - + /** + * @var string + */ + protected $_format; + + /** + * @param string $format + */ public function __construct($format) { $this->_format = $format; } - + + /** + * @param float $value + * @return string + */ public function filter($value) { return money_format($this->_format, $value); diff --git a/lib/Magento/Filter/Object.php b/lib/Magento/Filter/Object.php index 90344f26189e68e5c413945dac9d98007ca0f5a8..9a573010f4a4187ce70197805708b13554b6ca0c 100644 --- a/lib/Magento/Filter/Object.php +++ b/lib/Magento/Filter/Object.php @@ -29,10 +29,13 @@ namespace Magento\Filter; class Object extends \Zend_Filter { + /** + * @var array + */ protected $_columnFilters = array(); /** - * @var \Magento\ObjectManager + * @var \Magento\Core\Model\EntityFactory */ protected $_entityFactory; @@ -43,10 +46,15 @@ class Object extends \Zend_Filter { $this->_entityFactory = $entityFactory; } - - function addFilter(\Zend_Filter_Interface $filter, $column='') + + /** + * @param \Zend_Filter_Interface $filter + * @param string $column + * @return null|\Zend_Filter + */ + public function addFilter(\Zend_Filter_Interface $filter, $column='') { - if (''===$column) { + if ('' === $column) { parent::addFilter($filter); } else { if (!isset($this->_columnFilters[$column])) { @@ -55,15 +63,20 @@ class Object extends \Zend_Filter $this->_columnFilters[$column]->addFilter($filter); } } - - function filter($object) + + /** + * @param mixed $object + * @return mixed + * @throws \Exception + */ + public function filter($object) { if (!$object instanceof \Magento\Object) { - throw new \Exception('Expecting an instance of \Magento\Object'); + throw new \InvalidArgumentException('Expecting an instance of \Magento\Object'); } $class = get_class($object); $out = $this->_entityFactory->create($class); - foreach ($object->getData() as $column=>$value) { + foreach ($object->getData() as $column => $value) { $value = parent::filter($value); if (isset($this->_columnFilters[$column])) { $value = $this->_columnFilters[$column]->filter($value); diff --git a/lib/Magento/Filter/Object/Grid.php b/lib/Magento/Filter/Object/Grid.php index cc9626a0d525a36a8bed8cfd4b4ac8c8ab0731d1..387b7920f25c92eade4fdcee9cb1199d5cdc4a0a 100644 --- a/lib/Magento/Filter/Object/Grid.php +++ b/lib/Magento/Filter/Object/Grid.php @@ -29,7 +29,11 @@ namespace Magento\Filter\Object; class Grid extends \Magento\Filter\Object { - function filter($grid) + /** + * @param array $grid + * @return array + */ + public function filter($grid) { $out = array(); if (is_array($grid)) { diff --git a/lib/Magento/Filter/RemoveAccents.php b/lib/Magento/Filter/RemoveAccents.php new file mode 100644 index 0000000000000000000000000000000000000000..8a5aabdac647ea88bf9e184ebb96e2273d3bcf95 --- /dev/null +++ b/lib/Magento/Filter/RemoveAccents.php @@ -0,0 +1,102 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Remove accents from string + */ +class RemoveAccents implements \Zend_Filter_Interface +{ + /** + * @var bool + */ + protected $german; + + /** + * @param bool $german + */ + public function __construct($german = false) + { + $this->german = $german; + } + + /** + * @param string $string + * @return mixed|string + */ + public function filter($string) + { + static $replacements; + + if (empty($replacements[$this->german])) { + $substitutions = array( + // single ISO-8859-1 letters + 192 => 'A', 193 => 'A', 194 => 'A', 195 => 'A', 196 => 'A', 197 => 'A', 199 => 'C', + 208 => 'D', 200 => 'E', 201 => 'E', 202 => 'E', 203 => 'E', 204 => 'I', 205 => 'I', + 206 => 'I', 207 => 'I', 209 => 'N', 210 => 'O', 211 => 'O', 212 => 'O', 213 => 'O', + 214 => 'O', 216 => 'O', 138 => 'S', 217 => 'U', 218 => 'U', 219 => 'U', 220 => 'U', + 221 => 'Y', 142 => 'Z', 224 => 'a', 225 => 'a', 226 => 'a', 227 => 'a', 228 => 'a', + 229 => 'a', 231 => 'c', 232 => 'e', 233 => 'e', 234 => 'e', 235 => 'e', 236 => 'i', + 237 => 'i', 238 => 'i', 239 => 'i', 241 => 'n', 240 => 'o', 242 => 'o', 243 => 'o', + 244 => 'o', 245 => 'o', 246 => 'o', 248 => 'o', 154 => 's', 249 => 'u', 250 => 'u', + 251 => 'u', 252 => 'u', 253 => 'y', 255 => 'y', 158 => 'z', + // HTML entities + 258 => 'A', 260 => 'A', 262 => 'C', 268 => 'C', 270 => 'D', 272 => 'D', 280 => 'E', + 282 => 'E', 286 => 'G', 304 => 'I', 313 => 'L', 317 => 'L', 321 => 'L', 323 => 'N', + 327 => 'N', 336 => 'O', 340 => 'R', 344 => 'R', 346 => 'S', 350 => 'S', 354 => 'T', + 356 => 'T', 366 => 'U', 368 => 'U', 377 => 'Z', 379 => 'Z', 259 => 'a', 261 => 'a', + 263 => 'c', 269 => 'c', 271 => 'd', 273 => 'd', 281 => 'e', 283 => 'e', 287 => 'g', + 305 => 'i', 322 => 'l', 314 => 'l', 318 => 'l', 324 => 'n', 328 => 'n', 337 => 'o', + 341 => 'r', 345 => 'r', 347 => 's', 351 => 's', 357 => 't', 355 => 't', 367 => 'u', + 369 => 'u', 378 => 'z', 380 => 'z', + // ligatures + 198 => 'Ae', 230 => 'ae', 140 => 'Oe', 156 => 'oe', 223 => 'ss', + ); + + if ($this->german) { + // umlauts + $germanReplacements = array( + 196 => 'Ae', 228 => 'ae', 214 => 'Oe', 246 => 'oe', 220 => 'Ue', 252 => 'ue' + ); + $substitutions = $germanReplacements + $substitutions; + } + + $replacements[$this->german] = array(); + foreach ($substitutions as $code => $value) { + $replacements[$this->german][$code < 256 ? chr($code) : '&#' . $code . ';'] = $value; + } + } + + // convert string from default database format (UTF-8) + // to encoding which replacement arrays made with (ISO-8859-1) + $convertedString = @iconv('UTF-8', 'ISO-8859-1//IGNORE', $string); + if ($convertedString) { + $string = $convertedString; + } + // Replace + $string = strtr($string, $replacements[$this->german]); + return $string; + } +} diff --git a/lib/Magento/Filter/RemoveTags.php b/lib/Magento/Filter/RemoveTags.php new file mode 100644 index 0000000000000000000000000000000000000000..5f14523a388d0d00cf624bee7510b60209063d1c --- /dev/null +++ b/lib/Magento/Filter/RemoveTags.php @@ -0,0 +1,59 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Remove tags from string + */ +class RemoveTags implements \Zend_Filter_Interface +{ + /** + * Convert html entities + * + * @param array $matches + * @return string + */ + protected function _convertEntities($matches) + { + return htmlentities($matches[0]); + } + + /** + * Returns the result of filtering $value + * + * @param string $value + * @return string + */ + public function filter($value) + { + $value = preg_replace_callback( + "# <(?![/a-z]) | (?<=\s)>(?![a-z]) #xi", + array($this, '_convertEntities'), + $value + ); + $value = strip_tags($value); + return htmlspecialchars_decode($value); + } +} diff --git a/lib/Magento/Filter/SplitWords.php b/lib/Magento/Filter/SplitWords.php new file mode 100644 index 0000000000000000000000000000000000000000..6195d5255303d2252c0761267b865d76a634e71b --- /dev/null +++ b/lib/Magento/Filter/SplitWords.php @@ -0,0 +1,81 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Split words + */ +class SplitWords implements \Zend_Filter_Interface +{ + /** + * @var bool + */ + protected $uniqueOnly; + + /** + * @var int + */ + protected $wordsQty; + + /** + * @var string + */ + protected $wordSeparatorRegexp; + + /** + * @param bool $uniqueOnly Unique words only + * @param int $wordsQty Limit words qty in result + * @param string $wordSeparatorRegexp + */ + public function __construct($uniqueOnly = true, $wordsQty = 0, $wordSeparatorRegexp = '\s') + { + $this->uniqueOnly = $uniqueOnly; + $this->wordsQty = $wordsQty; + $this->wordSeparatorRegexp = $wordSeparatorRegexp; + } + + /** + * Filter value + * + * @param string $str The source string + * @return array + */ + public function filter($str) + { + $result = array(); + $split = preg_split('#' . $this->wordSeparatorRegexp . '#siu', $str, null, PREG_SPLIT_NO_EMPTY); + foreach ($split as $word) { + if ($this->uniqueOnly) { + $result[$word] = $word; + } else { + $result[] = $word; + } + } + if ($this->wordsQty && count($result) > $this->wordsQty) { + $result = array_slice($result, 0, $this->wordsQty); + } + return $result; + } +} diff --git a/lib/Magento/Filter/Sprintf.php b/lib/Magento/Filter/Sprintf.php index b2836f992ff64c0637f43db090ce53f14c3b991d..03a409001b71634000a1dcdfd7c1982acff13e45 100644 --- a/lib/Magento/Filter/Sprintf.php +++ b/lib/Magento/Filter/Sprintf.php @@ -24,24 +24,48 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Filter; class Sprintf implements \Zend_Filter_Interface { - protected $_format = null; - protected $_decimals = null; - protected $_decPoint = null; - protected $_thousandsSep = null; - - public function __construct($format, $decimals=null, $decPoint='.', $thousandsSep=',') + /** + * @var string + */ + protected $_format; + + /** + * @var int + */ + protected $_decimals; + + /** + * @var string + */ + protected $_decPoint; + + /** + * @var string + */ + protected $_thousandsSep; + + /** + * @param string $format + * @param null|int $decimals + * @param string $decPoint + * @param string $thousandsSep + */ + public function __construct($format, $decimals = 0, $decPoint = '.', $thousandsSep = ',') { $this->_format = $format; $this->_decimals = $decimals; $this->_decPoint = $decPoint; $this->_thousandsSep = $thousandsSep; } - + + /** + * @param string $value + * @return mixed|string + */ public function filter($value) { if (!is_null($this->_decimals)) { diff --git a/lib/Magento/Filter/StripTags.php b/lib/Magento/Filter/StripTags.php new file mode 100644 index 0000000000000000000000000000000000000000..31767e27cca4cc0ea5be3e5720c0e6b828875395 --- /dev/null +++ b/lib/Magento/Filter/StripTags.php @@ -0,0 +1,70 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Filter for standard strip_tags() function with extra functionality for html entities + */ +class StripTags implements \Zend_Filter_Interface +{ + /** + * @var \Magento\Escaper + */ + protected $escaper; + + /** + * @var string + */ + protected $allowableTags; + + /** + * @var bool + */ + protected $escape; + + /** + * @param \Magento\Escaper $escaper + * @param null $allowableTags + * @param bool $escape + */ + public function __construct(\Magento\Escaper $escaper, $allowableTags = null, $escape = false) + { + $this->escaper = $escaper; + $this->allowableTags = $allowableTags; + $this->escape = $escape; + } + + /** + * Returns the result of filtering $value + * + * @param string $value + * @return string + */ + public function filter($value) + { + $result = strip_tags($value, $this->allowableTags); + return $this->escape ? $this->escaper->escapeHtml($result, $this->allowableTags) : $result; + } +} diff --git a/lib/Magento/Filter/Template.php b/lib/Magento/Filter/Template.php index 23a4c348f8861c285d6ca517f40f75d66f84fcfc..43e4d861df324f550ae1b6c693b60e6d4993b8a1 100644 --- a/lib/Magento/Filter/Template.php +++ b/lib/Magento/Filter/Template.php @@ -57,6 +57,21 @@ class Template implements \Zend_Filter_Interface */ protected $_includeProcessor = null; + /** + * @var \Magento\Stdlib\String + */ + protected $string; + + /** + * @param \Magento\Stdlib\String $string + * @param array $variables + */ + public function __construct(\Magento\Stdlib\String $string, $variables = array()) + { + $this->string = $string; + $this->setVariables($variables); + } + /** * Sets template variables that's can be called through {var ...} statement * @@ -257,7 +272,7 @@ class Template implements \Zend_Filter_Interface ) { // If object calling methods or getting properties if ($stackVars[$i]['type'] == 'property') { - $caller = 'get' . uc_words($stackVars[$i]['name'], ''); + $caller = 'get' . $this->string->upperCaseWords($stackVars[$i]['name'], '_', ''); $stackVars[$i]['variable'] = method_exists($stackVars[$i - 1]['variable'], $caller) ? $stackVars[$i - 1]['variable']->$caller() : $stackVars[$i - 1]['variable']->getData($stackVars[$i]['name']); diff --git a/lib/Magento/Filter/Template/Simple.php b/lib/Magento/Filter/Template/Simple.php index e7f9911837860e8c3ba3af5240d7e21148213289..2b085d71833030a5429a497c9ff66362c70e63f9 100644 --- a/lib/Magento/Filter/Template/Simple.php +++ b/lib/Magento/Filter/Template/Simple.php @@ -22,14 +22,27 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Filter\Template; class Simple extends \Magento\Object implements \Zend_Filter_Interface { + /** + * @var string + */ protected $_startTag = '{{'; + + /** + * @var string + */ protected $_endTag = '}}'; + /** + * Set tags + * + * @param string $start + * @param string $end + * @return $this + */ public function setTags($start, $end) { $this->_startTag = $start; @@ -37,6 +50,12 @@ class Simple extends \Magento\Object implements \Zend_Filter_Interface return $this; } + /** + * {@inheritdoc} + * + * @param string $value + * @return string + */ public function filter($value) { $callback = function ($matches) { diff --git a/lib/Magento/Filter/Template/Tokenizer/AbstractTokenizer.php b/lib/Magento/Filter/Template/Tokenizer/AbstractTokenizer.php index 3ab3ae9ea9a36fab0e992f0cdaa6c0932eb4bee6..866a67ecdcab89ba75b74c7bf1ea7cd0fdbbdc6d 100644 --- a/lib/Magento/Filter/Template/Tokenizer/AbstractTokenizer.php +++ b/lib/Magento/Filter/Template/Tokenizer/AbstractTokenizer.php @@ -24,65 +24,61 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Filter\Template\Tokenizer; + /** * Template constructions tokenizer - * - * @category Magento - * @package Magento_Filter - * @author Magento Core Team <core@magentocommerce.com> */ - -namespace Magento\Filter\Template\Tokenizer; - abstract class AbstractTokenizer { /** * Current index in string + * * @var int */ protected $_currentIndex; - + /** * String for tokenize */ protected $_string; - + /** - * Move current index to next char. + * Move current index to next char. * * If index out of bounds returns false * * @return boolean */ - public function next() + public function next() { if($this->_currentIndex + 1 >= strlen($this->_string)) { return false; } - + $this->_currentIndex++; - return true; + return true; } - + /** - * Move current index to previus char. + * Move current index to previus char. * * If index out of bounds returns false * * @return boolean */ - public function prev() + public function prev() { if($this->_currentIndex - 1 < 0) { return false; } - + $this->_currentIndex--; - return true; + return true; } - + /** - * Return current char + * Return current char * * @return string */ @@ -90,8 +86,8 @@ abstract class AbstractTokenizer { return $this->_string{$this->_currentIndex}; } - - + + /** * Set string for tokenize */ @@ -100,15 +96,15 @@ abstract class AbstractTokenizer $this->_string = $value; $this->reset(); } - + /** * Move char index to begin of string */ - public function reset() + public function reset() { $this->_currentIndex = 0; } - + /** * Return true if current char is white-space * @@ -117,7 +113,7 @@ abstract class AbstractTokenizer public function isWhiteSpace() { return trim($this->char()) != $this->char(); } - + abstract public function tokenize(); - + } diff --git a/lib/Magento/Filter/Template/Tokenizer/Parameter.php b/lib/Magento/Filter/Template/Tokenizer/Parameter.php index 8caad459ba911515fdb2813811143c406e36e069..e60e18c4abd032706fa0e309dec6d569e3b48619 100644 --- a/lib/Magento/Filter/Template/Tokenizer/Parameter.php +++ b/lib/Magento/Filter/Template/Tokenizer/Parameter.php @@ -24,77 +24,70 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Filter\Template\Tokenizer; + /** * Template constructions parameters tokenizer - * - * @category Magento - * @package Magento_Filter - * @author Magento Core Team <core@magentocommerce.com> */ - -namespace Magento\Filter\Template\Tokenizer; - class Parameter extends \Magento\Filter\Template\Tokenizer\AbstractTokenizer { - + /** * Tokenize string and return getted parameters * * @return array */ - public function tokenize() + public function tokenize() { $parameters = array(); $parameterName = ''; - while($this->next()) { - if($this->isWhiteSpace()) { + while ($this->next()) { + if ($this->isWhiteSpace()) { continue; - } else if($this->char()!='=') { + } elseif($this->char() != '=') { $parameterName .= $this->char(); } else { $parameters[$parameterName] = $this->getValue(); $parameterName = ''; } - - } + } return $parameters; } - + /** - * Get string value in parameters througth tokenize - * + * Get string value in parameters through tokenize + * * @return string */ - public function getValue() { + public function getValue() + { $this->next(); $value = ''; - if($this->isWhiteSpace()) { + if ($this->isWhiteSpace()) { return $value; } $quoteStart = $this->char() == "'" || $this->char() == '"'; - - - if($quoteStart) { + + + if ($quoteStart) { $breakSymbol = $this->char(); - } else { + } else { $breakSymbol = false; $value .= $this->char(); } - + while ($this->next()) { if (!$breakSymbol && $this->isWhiteSpace()) { break; - } else if ($breakSymbol && $this->char() == $breakSymbol) { + } elseif ($breakSymbol && $this->char() == $breakSymbol) { break; - } else if ($this->char() == '\\') { + } elseif ($this->char() == '\\') { $this->next(); $value .= $this->char(); } else { $value .= $this->char(); - } + } } - return $value; } - } diff --git a/lib/Magento/Filter/Template/Tokenizer/Variable.php b/lib/Magento/Filter/Template/Tokenizer/Variable.php index b849d60329b416cb4c3ee82548b08ca1a4fe989e..e598f84e3a9c9de97ff1e6b0080c73fff45082f5 100644 --- a/lib/Magento/Filter/Template/Tokenizer/Variable.php +++ b/lib/Magento/Filter/Template/Tokenizer/Variable.php @@ -24,19 +24,13 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Filter\Template\Tokenizer; + /** * Template constructions variables tokenizer - * - * @category Magento - * @package Magento_Filter - * @author Magento Core Team <core@magentocommerce.com> */ - -namespace Magento\Filter\Template\Tokenizer; - class Variable extends \Magento\Filter\Template\Tokenizer\AbstractTokenizer { - /** * Tokenize string and return getted variable stack path * @@ -48,40 +42,40 @@ class Variable extends \Magento\Filter\Template\Tokenizer\AbstractTokenizer $parameterName = ''; $variableSet = false; do { - if($this->isWhiteSpace()) { + if ($this->isWhiteSpace()) { // Ignore white spaces continue; - } else if($this->char()!='.' && $this->char()!='(') { + } elseif ($this->char() != '.' && $this->char() != '(') { // Property or method name $parameterName .= $this->char(); - } else if($this->char()=='(') { + } elseif ($this->char() == '(') { // Method declaration $methodArgs = $this->getMethodArgs(); - $actions[] = array('type'=>'method', - 'name'=>$parameterName, - 'args'=>$methodArgs); + $actions[] = array('type' => 'method', + 'name' => $parameterName, + 'args' => $methodArgs); $parameterName = ''; - } else if($parameterName!='') { + } elseif ($parameterName != '') { // Property or variable declaration - if($variableSet) { - $actions[] = array('type'=>'property', - 'name'=>$parameterName); + if ($variableSet) { + $actions[] = array('type' => 'property', + 'name' => $parameterName); } else { $variableSet = true; - $actions[] = array('type'=>'variable', - 'name'=>$parameterName); + $actions[] = array('type' => 'variable', + 'name' => $parameterName); } $parameterName = ''; } } while ($this->next()); - if($parameterName != '' ) { - if($variableSet) { - $actions[] = array('type'=>'property', - 'name'=>$parameterName); + if ($parameterName != '') { + if ($variableSet) { + $actions[] = array('type' => 'property', + 'name' => $parameterName); } else { - $actions[] = array('type'=>'variable', - 'name'=>$parameterName); + $actions[] = array('type' => 'variable', + 'name' => $parameterName); } } @@ -93,15 +87,15 @@ class Variable extends \Magento\Filter\Template\Tokenizer\AbstractTokenizer * * @return string */ - public function getString() { - + public function getString() + { $value = ''; - if($this->isWhiteSpace()) { + if ($this->isWhiteSpace()) { return $value; } $qouteStart = $this->isQuote(); - if($qouteStart) { + if ($qouteStart) { $breakSymbol = $this->char(); } else { $breakSymbol = false; @@ -109,20 +103,18 @@ class Variable extends \Magento\Filter\Template\Tokenizer\AbstractTokenizer } while ($this->next()) { - if (!$breakSymbol && ($this->isWhiteSpace() || $this->char() == ',' || $this->char() == ')') ) { + if (!$breakSymbol && ($this->isWhiteSpace() || $this->char() == ',' || $this->char() == ')')) { $this->prev(); break; - } else if ($breakSymbol && $this->char() == $breakSymbol) { + } elseif ($breakSymbol && $this->char() == $breakSymbol) { break; - } else if ($this->char() == '\\') { + } elseif ($this->char() == '\\') { $this->next(); $value .= $this->char(); } else { $value .= $this->char(); - } } - return $value; } @@ -131,38 +123,39 @@ class Variable extends \Magento\Filter\Template\Tokenizer\AbstractTokenizer * * @return boolean */ - public function isNumeric() { + public function isNumeric() + { return $this->char() >= '0' && $this->char() <= '9'; } /** - * Return true if current char is qoute or apostroph + * Return true if current char is quote or apostrophe * * @return boolean */ - public function isQuote() { + public function isQuote() + { return $this->char() == '"' || $this->char() == "'"; } /** - * Return array of arguments for method. + * Return array of arguments for method * * @return array */ - public function getMethodArgs() { + public function getMethodArgs() + { $value = array(); - $numberStr = ''; - while($this->next() && $this->char() != ')') { - if($this->isWhiteSpace() || $this->char() == ',') { + while ($this->next() && $this->char() != ')') { + if ($this->isWhiteSpace() || $this->char() == ',') { continue; - } else if($this->isNumeric()) { + } elseif($this->isNumeric()) { $value[] = $this->getNumber(); } else { $value[] = $this->getString(); } } - return $value; } @@ -171,17 +164,16 @@ class Variable extends \Magento\Filter\Template\Tokenizer\AbstractTokenizer * * @return float */ - public function getNumber() { + public function getNumber() + { $value = $this->char(); - while( ($this->isNumeric() || $this->char()=='.') && $this->next() ) { - $value.= $this->char(); + while (($this->isNumeric() || $this->char() == '.') && $this->next()) { + $value .= $this->char(); } - if(!$this->isNumeric()) { + if (!$this->isNumeric()) { $this->prev(); } - return floatval($value); } - } diff --git a/lib/Magento/Filter/Truncate.php b/lib/Magento/Filter/Truncate.php new file mode 100644 index 0000000000000000000000000000000000000000..9717c061e5fb3fb79cfe0dc24b9f61a400df0a7b --- /dev/null +++ b/lib/Magento/Filter/Truncate.php @@ -0,0 +1,115 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Truncate filter + * + * Truncate a string to a certain length if necessary, appending the $etc string. + * $remainder will contain the string that has been replaced with $etc. + */ +class Truncate implements \Zend_Filter_Interface +{ + /** + * @var int + */ + protected $length; + + /** + * @var string + */ + protected $etc; + + /** + * @var string + */ + protected $remainder; + + /** + * @var bool + */ + protected $breakWords; + + /** + * @var \Magento\Stdlib\String + */ + protected $string; + + /** + * @param \Magento\Stdlib\String $string + * @param int $length + * @param string $etc + * @param string &$remainder + * @param bool $breakWords + */ + public function __construct( + \Magento\Stdlib\String $string, + $length = 80, + $etc = '...', + &$remainder = '', + $breakWords = true + ) { + $this->string = $string; + $this->length = $length; + $this->etc = $etc; + $this->remainder = &$remainder; + $this->breakWords = $breakWords; + } + + /** + * Filter value + * + * @param string $string + * @return string + */ + public function filter($string) + { + $length = $this->length; + $this->remainder = ''; + if (0 == $length) { + return ''; + } + + $originalLength = $this->string->strlen($string); + if ($originalLength > $length) { + $length -= $this->string->strlen($this->etc); + if ($length <= 0) { + return ''; + } + $preparedString = $string; + $preparedLength = $length; + if (!$this->breakWords) { + $preparedString = preg_replace( + '/\s+?(\S+)?$/u', '', $this->string->substr($string, 0, $length + 1) + ); + $preparedLength = $this->string->strlen($preparedString); + } + $this->remainder = $this->string->substr($string, $preparedLength, $originalLength); + return $this->string->substr($preparedString, 0, $length) . $this->etc; + } + + return $string; + } +} diff --git a/lib/Magento/Filter/ZendFactory.php b/lib/Magento/Filter/ZendFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..f2c86f7d4e78e5ca32a3eba52feef5806fdb258f --- /dev/null +++ b/lib/Magento/Filter/ZendFactory.php @@ -0,0 +1,102 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Filter + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Filter; + +/** + * Zend filter factory + */ +class ZendFactory extends AbstractFactory +{ + /** + * Set of filters + * + * @var array + */ + protected $invokableClasses = array( + 'stripTags' => 'Zend_Filter_StripTags', + 'stripNewlines' => 'Zend_Filter_StripNewlines', + 'stringTrim' => 'Zend_Filter_StringTrim', + 'stringToUpper' => 'Zend_Filter_StringToUpper', + 'stringToLower' => 'Zend_Filter_StringToLower', + 'realPath' => 'Zend_Filter_RealPath', + 'pregReplace' => 'Zend_Filter_PregReplace', + 'null' => 'Zend_Filter_Null', + 'normalizedToLocalized' => 'Zend_Filter_NormalizedToLocalized', + 'localizedToNormalized' => 'Zend_Filter_LocalizedToNormalized', + 'int' => 'Zend_Filter_Int', + 'inflector' => 'Zend_Filter_Inflector', + 'htmlEntities' => 'Zend_Filter_HtmlEntities', + 'zendEncrypt' => 'Zend_Filter_Encrypt', + 'zendDecrypt' => 'Zend_Filter_Decrypt', + 'dir' => 'Zend_Filter_Dir', + 'digits' => 'Zend_Filter_Digits', + 'zendDecompress' => 'Zend_Filter_Decompress', + 'zendCompress' => 'Zend_Filter_Compress', + 'callback' => 'Zend_Filter_Callback', + 'boolean' => 'Zend_Filter_Boolean', + 'baseName' => 'Zend_Filter_BaseName', + 'alpha' => 'Zend_Filter_Alpha', + 'alnum' => 'Zend_Filter_Alnum', + 'underscoreToSeparator' => 'Zend_Filter_Word_UnderscoreToSeparator', + 'underscoreToDash' => 'Zend_Filter_Word_UnderscoreToDash', + 'underscoreToCamelCase' => 'Zend_Filter_Word_UnderscoreToCamelCase', + 'separatorToSeparator' => 'Zend_Filter_Word_SeparatorToSeparator', + 'separatorToDash' => 'Zend_Filter_Word_SeparatorToDash', + 'separatorToCamelCase' => 'Zend_Filter_Word_SeparatorToCamelCase', + 'dashToUnderscore' => 'Zend_Filter_Word_DashToUnderscore', + 'dashToSeparator' => 'Zend_Filter_Word_DashToSeparator', + 'dashToCamelCase' => 'Zend_Filter_Word_DashToCamelCase', + 'camelCaseToUnderscore' => 'Zend_Filter_Word_CamelCaseToUnderscore', + 'camelCaseToSeparator' => 'Zend_Filter_Word_CamelCaseToSeparator', + 'camelCaseToDash' => 'Zend_Filter_Word_CamelCaseToDash', + 'fileUpperCase' => 'Zend_Filter_File_UpperCase', + 'fileRename' => 'Zend_Filter_File_Rename', + 'lowerCase' => 'Zend_Filter_File_LowerCase', + 'fileEncrypt' => 'Zend_Filter_File_Encrypt', + 'fileDecrypt' => 'Zend_Filter_File_Decrypt', + ); + + /** + * Whether or not to share by default; default to false + * + * @var bool + */ + protected $shareByDefault = false; + + /** + * Shared instances, by default is shared + * + * @var array + */ + protected $shared = array( + 'Zend_Filter_StripNewlines' => true, + 'Zend_Filter_Int' => true, + 'Zend_Filter_Dir' => true, + 'Zend_Filter_Digits' => true, + 'Zend_Filter_BaseName' => true, + ); +} diff --git a/lib/Magento/HTTP/Authentication.php b/lib/Magento/HTTP/Authentication.php new file mode 100644 index 0000000000000000000000000000000000000000..aeddb9be1e465280fcc0b78c169d44991adf31bf --- /dev/null +++ b/lib/Magento/HTTP/Authentication.php @@ -0,0 +1,111 @@ +<?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_Connect + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\HTTP; + +/** + * Library for working with HTTP authentication + */ +class Authentication +{ + /** + * Request object + * + * @var \Magento\App\RequestInterface + */ + protected $request; + + /** + * Response object + * + * @var \Magento\App\ResponseInterface + */ + protected $response; + + /** + * @param \Magento\App\RequestInterface $httpRequest + * @param \Magento\App\ResponseInterface $httpResponse + */ + public function __construct( + \Magento\App\RequestInterface $httpRequest, + \Magento\App\ResponseInterface $httpResponse + ) { + $this->request = $httpRequest; + $this->response = $httpResponse; + } + + /** + * Extract "login" and "password" credentials from HTTP-request + * + * Returns plain array with 2 items: login and password respectively + * + * @return array + */ + public function getCredentials() + { + $server = $this->request->getServer(); + $user = ''; + $pass = ''; + + if (empty($server['HTTP_AUTHORIZATION'])) { + foreach ($server as $k => $v) { + if (substr($k, -18) === 'HTTP_AUTHORIZATION' && !empty($v)) { + $server['HTTP_AUTHORIZATION'] = $v; + break; + } + } + } + + if (isset($server['PHP_AUTH_USER']) && isset($server['PHP_AUTH_PW'])) { + $user = $server['PHP_AUTH_USER']; + $pass = $server['PHP_AUTH_PW']; + } elseif (!empty($server['HTTP_AUTHORIZATION'])) { + /** + * IIS Note: for HTTP authentication to work with IIS, + * the PHP directive cgi.rfc2616_headers must be set to 0 (the default value). + */ + $auth = $server['HTTP_AUTHORIZATION']; + list($user, $pass) = explode(':', base64_decode(substr($auth, strpos($auth, " ") + 1))); + } elseif (!empty($server['Authorization'])) { + $auth = $server['Authorization']; + list($user, $pass) = explode(':', base64_decode(substr($auth, strpos($auth, " ") + 1))); + } + + return array($user, $pass); + } + + /** + * Set "auth failed" headers to the specified response object + * + * @param string $realm + */ + public function setAuthenticationFailed($realm) + { + $this->response->setHeader('HTTP/1.1', '401 Unauthorized') + ->setHeader('WWW-Authenticate', 'Basic realm="' . $realm . '"') + ->setBody('<h1>401 Unauthorized</h1>'); + } +} diff --git a/lib/Magento/HTTP/Header.php b/lib/Magento/HTTP/Header.php new file mode 100644 index 0000000000000000000000000000000000000000..ec6df3c07016e4e5120eb69c21f76a33f1c784ca --- /dev/null +++ b/lib/Magento/HTTP/Header.php @@ -0,0 +1,145 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Connect + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\HTTP; + +/** + * Library for working with HTTP headers + */ +class Header +{ + /** + * Request object + * + * @var \Magento\App\RequestInterface + */ + protected $_request; + + /** + * @var \Magento\Stdlib\String + */ + protected $_converter; + + /** + * @param \Magento\App\RequestInterface $httpRequest + * @param \Magento\Stdlib\String $converter + */ + public function __construct( + \Magento\App\RequestInterface $httpRequest, + \Magento\Stdlib\String $converter + ) { + $this->_request = $httpRequest; + $this->_converter = $converter; + } + + /** + * Retrieve HTTP HOST + * + * @param boolean $clean clean non UTF-8 characters + * @return string + */ + public function getHttpHost($clean = true) + { + return $this->_getHttpCleanValue('HTTP_HOST', $clean); + } + + /** + * Retrieve HTTP USER AGENT + * + * @param boolean $clean clean non UTF-8 characters + * @return string + */ + public function getHttpUserAgent($clean = true) + { + return $this->_getHttpCleanValue('HTTP_USER_AGENT', $clean); + } + + /** + * Retrieve HTTP ACCEPT LANGUAGE + * + * @param boolean $clean clean non UTF-8 characters + * @return string + */ + public function getHttpAcceptLanguage($clean = true) + { + return $this->_getHttpCleanValue('HTTP_ACCEPT_LANGUAGE', $clean); + } + + /** + * Retrieve HTTP ACCEPT CHARSET + * + * @param boolean $clean clean non UTF-8 characters + * @return string + */ + public function getHttpAcceptCharset($clean = true) + { + return $this->_getHttpCleanValue('HTTP_ACCEPT_CHARSET', $clean); + } + + /** + * Retrieve HTTP REFERER + * + * @param boolean $clean clean non UTF-8 characters + * @return string + */ + public function getHttpReferer($clean = true) + { + return $this->_getHttpCleanValue('HTTP_REFERER', $clean); + } + + /** + * Returns the REQUEST_URI taking into account + * platform differences between Apache and IIS + * + * @param boolean $clean clean non UTF-8 characters + * @return string + */ + public function getRequestUri($clean = false) + { + $uri = $this->_request->getRequestUri(); + if ($clean) { + $uri = $this->_converter->cleanString($uri); + } + return $uri; + } + + /** + * Retrieve HTTP "clean" value + * + * @param string $var + * @param boolean $clean clean non UTF-8 characters + * @return string + */ + protected function _getHttpCleanValue($var, $clean = true) + { + $value = $this->_request->getServer($var, ''); + if ($clean) { + $value = $this->_converter->cleanString($value); + } + + return $value; + } +} diff --git a/lib/Magento/HTTP/PhpEnvironment/RemoteAddress.php b/lib/Magento/HTTP/PhpEnvironment/RemoteAddress.php new file mode 100644 index 0000000000000000000000000000000000000000..8831f7c16ec30fac35ac8b5bcc7c0f8e843bdf31 --- /dev/null +++ b/lib/Magento/HTTP/PhpEnvironment/RemoteAddress.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. + * + * @category Magento + * @package Magento_Connect + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\HTTP\PhpEnvironment; + +/** + * Library for working with client ip address + */ +class RemoteAddress +{ + /** + * Request object + * + * @var \Magento\App\RequestInterface + */ + protected $request; + + /** + * Remote address cache + * + * @var string + */ + protected $remoteAddress; + + /** + * @var array + */ + protected $alternativeHeaders; + + /** + * @param \Magento\App\RequestInterface $httpRequest + * @param array $alternativeHeaders + * @throws \InvalidArgumentException + */ + public function __construct( + \Magento\App\RequestInterface $httpRequest, + $alternativeHeaders = array() + ) { + $this->request = $httpRequest; + + if (!is_array($alternativeHeaders)) { + throw new \InvalidArgumentException(sprintf( + 'Invalid value of type "%s" given while array is expected as alternative headers', + gettype($alternativeHeaders) + )); + } + + $this->alternativeHeaders = $alternativeHeaders; + } + + /** + * Retrieve Client Remote Address + * + * @param bool $ipToLong converting IP to long format + * @return string IPv4|long + */ + public function getRemoteAddress($ipToLong = false) + { + if (is_null($this->remoteAddress)) { + foreach ($this->alternativeHeaders as $var) { + if ($this->request->getServer($var, false)) { + $this->remoteAddress = $this->request->getServer($var); + break; + } + } + + if (!$this->remoteAddress) { + $this->remoteAddress = $this->request->getServer('REMOTE_ADDR'); + } + } + + if (!$this->remoteAddress) { + return false; + } + + return $ipToLong ? ip2long($this->remoteAddress) : $this->remoteAddress; + } +} diff --git a/lib/Magento/HTTP/PhpEnvironment/ServerAddress.php b/lib/Magento/HTTP/PhpEnvironment/ServerAddress.php new file mode 100644 index 0000000000000000000000000000000000000000..7a16bd9256eb358df487032ed842ac574e436f97 --- /dev/null +++ b/lib/Magento/HTTP/PhpEnvironment/ServerAddress.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. + * + * @category Magento + * @package Magento_Connect + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\HTTP\PhpEnvironment; + +/** + * Library for working with server ip address + */ +class ServerAddress +{ + /** + * Request object + * + * @var \Magento\App\RequestInterface + */ + protected $request; + + public function __construct( + \Magento\App\RequestInterface $httpRequest + ) { + $this->request = $httpRequest; + } + + /** + * Retrieve Server IP address + * + * @param bool $ipToLong converting IP to long format + * @return string IPv4|long + */ + public function getServerAddress($ipToLong = false) + { + $address = $this->request->getServer('SERVER_ADDR'); + if (!$address) { + return false; + } + return $ipToLong ? ip2long($address) : $address; + } +} diff --git a/app/code/Magento/Core/Model/Logger.php b/lib/Magento/Logger.php similarity index 77% rename from app/code/Magento/Core/Model/Logger.php rename to lib/Magento/Logger.php index bc5bc45b052e386f5c8416734218c53d7c876408..160a5e456269d6d71fd4ae624366cc30811a15c5 100644 --- a/app/code/Magento/Core/Model/Logger.php +++ b/lib/Magento/Logger.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +25,7 @@ /** * Logger model */ -namespace Magento\Core\Model; +namespace Magento; class Logger { @@ -53,17 +51,21 @@ class Logger */ protected $_fileSystem; + /** * @param \Magento\App\Dir $dirs * @param \Magento\Io\File $fileSystem * @param string $defaultFile */ - public function __construct(\Magento\App\Dir $dirs, \Magento\Io\File $fileSystem, $defaultFile = '') - { + public function __construct( + \Magento\App\Dir $dirs, + \Magento\Io\File $fileSystem, + $defaultFile = '' + ) { $this->_dirs = $dirs; $this->_fileSystem = $fileSystem; - $this->addStreamLog(\Magento\Core\Model\Logger::LOGGER_SYSTEM, $defaultFile) - ->addStreamLog(\Magento\Core\Model\Logger::LOGGER_EXCEPTION, $defaultFile); + $this->addStreamLog(self::LOGGER_SYSTEM, $defaultFile) + ->addStreamLog(self::LOGGER_EXCEPTION, $defaultFile); } /** @@ -74,7 +76,7 @@ class Logger * @param string $loggerKey * @param string $fileOrWrapper * @param string $writerClass - * @return \Magento\Core\Model\Logger + * @return \Magento\Logger * @link http://php.net/wrappers */ public function addStreamLog($loggerKey, $fileOrWrapper = '', $writerClass = '') @@ -98,32 +100,14 @@ class Logger } /** - * Reset all loggers and initialize them according to store configuration + * Unset all declared loggers * - * @param \Magento\Core\Model\Store $store - * @param \Magento\Core\Model\ConfigInterface $config + * @return $this */ - public function initForStore(\Magento\Core\Model\Store $store, \Magento\Core\Model\ConfigInterface $config) + public function unsetLoggers() { $this->_loggers = array(); - if ($store->getConfig('dev/log/active')) { - $writer = (string)$config->getNode('global/log/core/writer_model'); - $this->addStreamLog(self::LOGGER_SYSTEM, $store->getConfig('dev/log/file'), $writer); - $this->addStreamLog(self::LOGGER_EXCEPTION, $store->getConfig('dev/log/exception_file'), $writer); - } - } - - /** - * Add a logger if store configuration allows - * - * @param string $loggerKey - * @param \Magento\Core\Model\Store $store - */ - public function addStoreLog($loggerKey, \Magento\Core\Model\Store $store) - { - if ($store->getConfig('dev/log/active')) { - $this->addStreamLog($loggerKey); - } + return $this; } /** diff --git a/lib/Magento/Math/Division.php b/lib/Magento/Math/Division.php new file mode 100644 index 0000000000000000000000000000000000000000..e0141a8fc9d77f00e24c5d7e41e8806a0df810dd --- /dev/null +++ b/lib/Magento/Math/Division.php @@ -0,0 +1,54 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Math; + +/** + * Division library + */ +class Division +{ + /** + * Const for correct dividing decimal values + */ + const DIVIDE_EPSILON = 10000; + + /** + * Returns the floating point remainder (modulo) of the division of the arguments + * + * @param float|int $dividend + * @param float|int $divisor + * @return float|int + */ + public function getExactDivision($dividend, $divisor) + { + $epsilon = $divisor / self::DIVIDE_EPSILON; + + $remainder = fmod($dividend, $divisor); + if (abs($remainder - $divisor) < $epsilon || abs($remainder) < $epsilon) { + $remainder = 0; + } + + return $remainder; + } +} diff --git a/lib/Magento/Math/Random.php b/lib/Magento/Math/Random.php new file mode 100644 index 0000000000000000000000000000000000000000..dde477fa140e01b3c9fadd57faa935dea4be712f --- /dev/null +++ b/lib/Magento/Math/Random.php @@ -0,0 +1,84 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Math; + +/** + * Random data generator + */ +class Random +{ + const CHARS_LOWERS = 'abcdefghijklmnopqrstuvwxyz'; + const CHARS_UPPERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + const CHARS_DIGITS = '0123456789'; + const CHARS_SPECIALS = '!$*+-.=?@^_|~'; + const CHARS_PASSWORD_LOWERS = 'abcdefghjkmnpqrstuvwxyz'; + const CHARS_PASSWORD_UPPERS = 'ABCDEFGHJKLMNPQRSTUVWXYZ'; + const CHARS_PASSWORD_DIGITS = '23456789'; + const CHARS_PASSWORD_SPECIALS = '!$*-.=?@_'; + + /** + * Permission level to deny access + */ + const RULE_PERM_DENY = 0; + + /** + * Permission level to inherit access from parent role + */ + const RULE_PERM_INHERIT = 1; + + /** + * Permission level to allow access + */ + const RULE_PERM_ALLOW = 2; + + /** + * Get random string + * + * @param int $length + * @param null|string $chars + * @return string + */ + public function getRandomString($length, $chars = null) + { + if (is_null($chars)) { + $chars = self::CHARS_LOWERS . self::CHARS_UPPERS . self::CHARS_DIGITS; + } + mt_srand(10000000 * (double)microtime()); + for ($i = 0, $string = '', $lc = strlen($chars)-1; $i < $length; $i++) { + $string .= $chars[mt_rand(0, $lc)]; + } + return $string; + } + + /** + * Generate a hash from unique ID + * + * @param string $prefix + * @return string + */ + public function getUniqueHash($prefix = '') + { + return $prefix . md5(uniqid(microtime() . mt_rand(), true)); + } +} diff --git a/lib/Magento/App/Module/Declaration/Converter/Dom.php b/lib/Magento/Module/Declaration/Converter/Dom.php similarity index 97% rename from lib/Magento/App/Module/Declaration/Converter/Dom.php rename to lib/Magento/Module/Declaration/Converter/Dom.php index 7625dd3b2a05416eaf9d6f73d168057aed8ff845..1a06b031cbe1b1dd06fa425d3ee253ac4cd86cd2 100644 --- a/lib/Magento/App/Module/Declaration/Converter/Dom.php +++ b/lib/Magento/Module/Declaration/Converter/Dom.php @@ -1,5 +1,7 @@ <?php /** + * Module declaration xml converter. Converts declaration DOM Document to internal array representation. + * * Magento * * NOTICE OF LICENSE @@ -21,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module\Declaration\Converter; +namespace Magento\Module\Declaration\Converter; class Dom implements \Magento\Config\ConverterInterface { diff --git a/lib/Magento/App/Module/Declaration/FileResolver.php b/lib/Magento/Module/Declaration/FileResolver.php similarity index 94% rename from lib/Magento/App/Module/Declaration/FileResolver.php rename to lib/Magento/Module/Declaration/FileResolver.php index aba33599fb8e09b003c938bca9bf2819ac80057c..33514c2ff17cd701e817e33cc0df0adca1d3bf85 100644 --- a/lib/Magento/App/Module/Declaration/FileResolver.php +++ b/lib/Magento/Module/Declaration/FileResolver.php @@ -1,5 +1,7 @@ <?php /** + * Module declaration file resolver. Reads list of module declaration files from module /etc directories. + * * Magento * * NOTICE OF LICENSE @@ -21,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module\Declaration; +namespace Magento\Module\Declaration; class FileResolver implements \Magento\Config\FileResolverInterface { diff --git a/lib/Magento/App/Module/Declaration/Reader/Filesystem.php b/lib/Magento/Module/Declaration/Reader/Filesystem.php similarity index 93% rename from lib/Magento/App/Module/Declaration/Reader/Filesystem.php rename to lib/Magento/Module/Declaration/Reader/Filesystem.php index dd21f43b16d5ca0fb6fdb5e4c041c86bbd4047b7..2de54646d2cb3c10e344dcb258ff2e0df996b4bd 100644 --- a/lib/Magento/App/Module/Declaration/Reader/Filesystem.php +++ b/lib/Magento/Module/Declaration/Reader/Filesystem.php @@ -1,5 +1,7 @@ <?php /** + * Module declaration reader. Reads module.xml declaration files from module /etc directories. + * * Magento * * NOTICE OF LICENSE @@ -21,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module\Declaration\Reader; +namespace Magento\Module\Declaration\Reader; class Filesystem extends \Magento\Config\Reader\Filesystem { @@ -43,9 +45,9 @@ class Filesystem extends \Magento\Config\Reader\Filesystem ); /** - * @param \Magento\App\Module\Declaration\FileResolver $fileResolver - * @param \Magento\App\Module\Declaration\Converter\Dom $converter - * @param \Magento\App\Module\Declaration\SchemaLocator $schemaLocator + * @param \Magento\Module\Declaration\FileResolver $fileResolver + * @param \Magento\Module\Declaration\Converter\Dom $converter + * @param \Magento\Module\Declaration\SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName * @param array $idAttributes @@ -53,9 +55,9 @@ class Filesystem extends \Magento\Config\Reader\Filesystem * @param array $allowedModules */ public function __construct( - \Magento\App\Module\Declaration\FileResolver $fileResolver, - \Magento\App\Module\Declaration\Converter\Dom $converter, - \Magento\App\Module\Declaration\SchemaLocator $schemaLocator, + \Magento\Module\Declaration\FileResolver $fileResolver, + \Magento\Module\Declaration\Converter\Dom $converter, + \Magento\Module\Declaration\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, $fileName = 'module.xml', $idAttributes = array(), @@ -183,6 +185,7 @@ class Filesystem extends \Magento\Config\Reader\Filesystem * @param array $modules * @return array * @SuppressWarnings(PHPMD.ShortVariable) + * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ protected function _sortModules(array $modules) { @@ -191,7 +194,7 @@ class Filesystem extends \Magento\Config\Reader\Filesystem * (in order not to add extra information about dependencies to module config) */ $moduleDependencyMap = array(); - foreach (array_keys($modules) as $moduleName) { + foreach ($modules as $moduleName => $value) { $moduleDependencyMap[] = array( 'moduleName' => $moduleName, 'dependencies' => $this->_getExtendedModuleDependencies($moduleName, $modules), diff --git a/lib/Magento/App/Module/Declaration/SchemaLocator.php b/lib/Magento/Module/Declaration/SchemaLocator.php similarity index 92% rename from lib/Magento/App/Module/Declaration/SchemaLocator.php rename to lib/Magento/Module/Declaration/SchemaLocator.php index c61020159d1ec74cb761ad076744051755e612db..b7ec4d5d6f1cbe04769df6929fc120864bb77081 100644 --- a/lib/Magento/App/Module/Declaration/SchemaLocator.php +++ b/lib/Magento/Module/Declaration/SchemaLocator.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module\Declaration; +namespace Magento\Module\Declaration; class SchemaLocator implements \Magento\Config\SchemaLocatorInterface { @@ -34,7 +34,7 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface */ public function getSchema() { - return realpath(__DIR__ . '/../../etc/module.xsd'); + return realpath(__DIR__ . '/../etc/module.xsd'); } /** diff --git a/lib/Magento/App/Module/Dir.php b/lib/Magento/Module/Dir.php similarity index 87% rename from lib/Magento/App/Module/Dir.php rename to lib/Magento/Module/Dir.php index ebe1b15d5b5f5b69cf90f49517ffc8addba75ab0..336892f5b958670f0316959784c920ba90fb8198 100644 --- a/lib/Magento/App/Module/Dir.php +++ b/lib/Magento/Module/Dir.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module; +namespace Magento\Module; class Dir { @@ -34,12 +34,19 @@ class Dir */ protected $_applicationDirs; + /** + * @var \Magento\Stdlib\String + */ + protected $_string; + /** * @param \Magento\App\Dir $applicationDirs + * @param \Magento\Stdlib\String $string */ - public function __construct(\Magento\App\Dir $applicationDirs) + public function __construct(\Magento\App\Dir $applicationDirs, \Magento\Stdlib\String $string) { $this->_applicationDirs = $applicationDirs; + $this->_string = $string; } /** @@ -54,7 +61,7 @@ class Dir { $result = $this->_applicationDirs->getDir(\Magento\App\Dir::MODULES) . DIRECTORY_SEPARATOR - . uc_words($moduleName, DIRECTORY_SEPARATOR); + . $this->_string->upperCaseWords($moduleName, '_', DIRECTORY_SEPARATOR); if ($type) { if (!in_array($type, array('etc', 'sql', 'data', 'i18n', 'view'))) { throw new \InvalidArgumentException("Directory type '$type' is not recognized."); diff --git a/app/code/Magento/Core/Model/Config/Modules/Reader.php b/lib/Magento/Module/Dir/Reader.php similarity index 53% rename from app/code/Magento/Core/Model/Config/Modules/Reader.php rename to lib/Magento/Module/Dir/Reader.php index 494bc763bbfdfe3cd7c5902339f669448bdea7b5..2744a76f88fd66a85d9d51e827f9c978675003fc 100644 --- a/app/code/Magento/Core/Model/Config/Modules/Reader.php +++ b/lib/Magento/Module/Dir/Reader.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Modules; +namespace Magento\Module\Dir; class Reader { @@ -37,82 +37,29 @@ class Reader /** * Directory registry * - * @var \Magento\App\Module\Dir + * @var \Magento\Module\Dir */ protected $_moduleDirs; /** * Modules configuration provider * - * @var \Magento\App\ModuleListInterface + * @var \Magento\Module\ModuleListInterface */ protected $_modulesList; /** - * Base config factory - * - * @var \Magento\Core\Model\Config\BaseFactory - */ - protected $_prototypeFactory; - - /** - * @param \Magento\App\Module\Dir $moduleDirs - * @param \Magento\Core\Model\Config\BaseFactory $prototypeFactory - * @param \Magento\App\ModuleListInterface $moduleList + * @param \Magento\Module\Dir $moduleDirs + * @param \Magento\Module\ModuleListInterface $moduleList */ public function __construct( - \Magento\App\Module\Dir $moduleDirs, - \Magento\Core\Model\Config\BaseFactory $prototypeFactory, - \Magento\App\ModuleListInterface $moduleList + \Magento\Module\Dir $moduleDirs, + \Magento\Module\ModuleListInterface $moduleList ) { $this->_moduleDirs = $moduleDirs; - $this->_prototypeFactory = $prototypeFactory; $this->_modulesList = $moduleList; } - /** - * Load configuration from single file - * - * @param string $configFile - * @param string $moduleName - * @param \Magento\Core\Model\Config\Base $mergeToObject - * @param \Magento\Core\Model\Config\Base $mergeModel - */ - public function _loadFileConfig($configFile, $moduleName, $mergeToObject, $mergeModel) - { - $configFilePath = $this->getModuleDir('etc', $moduleName) . DS . $configFile; - if ($mergeModel->loadFile($configFilePath)) { - $mergeToObject->extend($mergeModel, true); - } - } - - /** - * Iterate all active modules "etc" folders and combine data from - * specified xml file name to one object - * - * @param string $fileName - * @param \Magento\Core\Model\Config\Base|null $mergeToObject - * @param \Magento\Core\Model\Config\Base|null $mergeModel - * @return \Magento\Core\Model\Config\Base|null - */ - public function loadModulesConfiguration($fileName, $mergeToObject = null, $mergeModel = null) - { - $mergeToObject = null === $mergeToObject ? $this->_prototypeFactory->create('<config/>') : $mergeToObject; - $mergeModel = null === $mergeModel ? $mergeModel = $this->_prototypeFactory->create('<config/>'): $mergeModel; - - /** @var $module \Magento\Core\Model\Config\Element */ - foreach (array_keys($this->_modulesList->getModules()) as $moduleName) { - if (!is_array($fileName)) { - $fileName = array($fileName); - } - foreach ($fileName as $configFile) { - $this->_loadFileConfig($configFile, $moduleName, $mergeToObject, $mergeModel); - } - - } - return $mergeToObject; - } - /** * Go through all modules and find configuration files of active modules * diff --git a/lib/Magento/App/Module/Dir/ReverseResolver.php b/lib/Magento/Module/Dir/ReverseResolver.php similarity index 85% rename from lib/Magento/App/Module/Dir/ReverseResolver.php rename to lib/Magento/Module/Dir/ReverseResolver.php index cff0b9c4053ed9119343905934aa9f0fa9842909..7c159bd58036411877d651551707f4d22ad591ca 100644 --- a/lib/Magento/App/Module/Dir/ReverseResolver.php +++ b/lib/Magento/Module/Dir/ReverseResolver.php @@ -23,27 +23,27 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module\Dir; +namespace Magento\Module\Dir; class ReverseResolver { /** - * @var \Magento\App\ModuleListInterface + * @var \Magento\Module\ModuleListInterface */ protected $_moduleList; /** - * @var \Magento\App\Module\Dir + * @var \Magento\Module\Dir */ protected $_moduleDirs; /** - * @param \Magento\App\ModuleListInterface $moduleList - * @param \Magento\App\Module\Dir $moduleDirs + * @param \Magento\Module\ModuleListInterface $moduleList + * @param \Magento\Module\Dir $moduleDirs */ public function __construct( - \Magento\App\ModuleListInterface $moduleList, - \Magento\App\Module\Dir $moduleDirs + \Magento\Module\ModuleListInterface $moduleList, + \Magento\Module\Dir $moduleDirs ) { $this->_moduleList = $moduleList; $this->_moduleDirs = $moduleDirs; diff --git a/app/code/Magento/Core/App/FrontController/Plugin/Install.php b/lib/Magento/Module/FrontController/Plugin/Install.php similarity index 86% rename from app/code/Magento/Core/App/FrontController/Plugin/Install.php rename to lib/Magento/Module/FrontController/Plugin/Install.php index 37012d76f08c51cfdb9f6e972e641df80389572b..ad4393c987091364e28cd8c8044bdc5a73d1fdbf 100644 --- a/app/code/Magento/Core/App/FrontController/Plugin/Install.php +++ b/lib/Magento/Module/FrontController/Plugin/Install.php @@ -1,5 +1,7 @@ <?php /** + * Application installation plugin. Should be used b applications that require module install/upgrade. + * * Magento * * NOTICE OF LICENSE @@ -21,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\App\FrontController\Plugin; +namespace Magento\Module\FrontController\Plugin; class Install { @@ -36,19 +38,19 @@ class Install protected $_cache; /** - * @var \Magento\App\UpdaterInterface + * @var \Magento\Module\UpdaterInterface */ protected $_updater; /** * @param \Magento\App\State $appState * @param \Magento\Cache\FrontendInterface $cache - * @param \Magento\App\UpdaterInterface $dbUpdater + * @param \Magento\Module\UpdaterInterface $dbUpdater */ public function __construct( \Magento\App\State $appState, \Magento\Cache\FrontendInterface $cache, - \Magento\App\UpdaterInterface $dbUpdater + \Magento\Module\UpdaterInterface $dbUpdater ) { $this->_appState = $appState; $this->_cache = $cache; diff --git a/lib/Magento/App/ModuleList.php b/lib/Magento/Module/ModuleList.php similarity index 88% rename from lib/Magento/App/ModuleList.php rename to lib/Magento/Module/ModuleList.php index 20ffd25d552c8402f761bdeb912305d34e647ff1..60bfa19549c576bf68dea80115c1ad5e7be0d1fa 100644 --- a/lib/Magento/App/ModuleList.php +++ b/lib/Magento/Module/ModuleList.php @@ -1,5 +1,7 @@ <?php /** + * List of application active application modules. + * * Magento * * NOTICE OF LICENSE @@ -21,9 +23,9 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App; +namespace Magento\Module; -class ModuleList implements \Magento\App\ModuleListInterface +class ModuleList implements \Magento\Module\ModuleListInterface { /** * Configuration data @@ -40,12 +42,12 @@ class ModuleList implements \Magento\App\ModuleListInterface protected $_scope = 'global'; /** - * @param \Magento\App\Module\Declaration\Reader\Filesystem $reader + * @param \Magento\Module\Declaration\Reader\Filesystem $reader * @param \Magento\Config\CacheInterface $cache * @param string $cacheId */ public function __construct( - Module\Declaration\Reader\Filesystem $reader, + Declaration\Reader\Filesystem $reader, \Magento\Config\CacheInterface $cache, $cacheId = 'modules_declaration_cache' ) { diff --git a/lib/Magento/App/ModuleListInterface.php b/lib/Magento/Module/ModuleListInterface.php similarity index 94% rename from lib/Magento/App/ModuleListInterface.php rename to lib/Magento/Module/ModuleListInterface.php index 9d22d6adbcaf6420526895db8d61bfe7495145a3..ac5956e2eaf652a8d32c749901d63b7c9cbd2228 100644 --- a/lib/Magento/App/ModuleListInterface.php +++ b/lib/Magento/Module/ModuleListInterface.php @@ -1,5 +1,7 @@ <?php /** + * List of active application modules. + * * Magento * * NOTICE OF LICENSE @@ -21,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App; +namespace Magento\Module; interface ModuleListInterface { diff --git a/lib/Magento/App/Module/ResourceResolver.php b/lib/Magento/Module/ResourceResolver.php similarity index 88% rename from lib/Magento/App/Module/ResourceResolver.php rename to lib/Magento/Module/ResourceResolver.php index ca42738dd951d54330d5f9bdcd99ecb61e0fda35..22d656c815b29e2cecfb68bdfe8c777f03f53801 100644 --- a/lib/Magento/App/Module/ResourceResolver.php +++ b/lib/Magento/Module/ResourceResolver.php @@ -23,12 +23,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module; +namespace Magento\Module; -class ResourceResolver implements \Magento\App\Module\ResourceResolverInterface +class ResourceResolver implements \Magento\Module\ResourceResolverInterface { /** - * @var \Magento\Core\Model\Config\Modules\Reader + * @var \Magento\Module\Dir\Reader */ protected $_moduleReader; @@ -40,9 +40,9 @@ class ResourceResolver implements \Magento\App\Module\ResourceResolverInterface protected $_moduleResources = array(); /** - * @param \Magento\Core\Model\Config\Modules\Reader $moduleReader + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Core\Model\Config\Modules\Reader $moduleReader) + public function __construct(Dir\Reader $moduleReader) { $this->_moduleReader = $moduleReader; } diff --git a/lib/Magento/App/Module/ResourceResolverInterface.php b/lib/Magento/Module/ResourceResolverInterface.php similarity index 97% rename from lib/Magento/App/Module/ResourceResolverInterface.php rename to lib/Magento/Module/ResourceResolverInterface.php index 35f85a0b3f9acc862083fe9f3070cae960c213a4..49dc8350ef4880efc5dca222d10abf88914c0e60 100644 --- a/lib/Magento/App/Module/ResourceResolverInterface.php +++ b/lib/Magento/Module/ResourceResolverInterface.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Module; +namespace Magento\Module; interface ResourceResolverInterface { diff --git a/lib/Magento/App/Updater.php b/lib/Magento/Module/Updater.php similarity index 83% rename from lib/Magento/App/Updater.php rename to lib/Magento/Module/Updater.php index 01fcf8a629ed1deb64edf10497992a910fbaf073..4c8a3603d98503dd46f1e28d9cd4c48a1a5ec7ae 100644 --- a/lib/Magento/App/Updater.php +++ b/lib/Magento/Module/Updater.php @@ -1,5 +1,7 @@ <?php /** + * Application module updater. Used to install/upgrade module schemas. + * * Magento * * NOTICE OF LICENSE @@ -22,14 +24,16 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App; +namespace Magento\Module; + +use Magento\App\State; -class Updater implements \Magento\App\UpdaterInterface +class Updater implements \Magento\Module\UpdaterInterface { /** * Setup model factory * - * @var \Magento\App\Updater\SetupFactory + * @var \Magento\Module\Updater\SetupFactory */ protected $_factory; @@ -62,12 +66,12 @@ class Updater implements \Magento\App\UpdaterInterface protected $_resourceList; /** - * @var \Magento\App\ModuleListInterface + * @var \Magento\Module\ModuleListInterface */ protected $_moduleList; /** - * @var \Magento\App\Module\ResourceResolverInterface + * @var \Magento\Module\ResourceResolverInterface */ protected $_resourceResolver; @@ -79,22 +83,22 @@ class Updater implements \Magento\App\UpdaterInterface /** * @param Updater\SetupFactory $setupFactory * @param State $appState - * @param ModuleListInterface $moduleList - * @param Module\ResourceResolverInterface $resourceResolver + * @param \Magento\Module\ModuleListInterface $moduleList + * @param \Magento\Module\ResourceResolverInterface $resourceResolver * @param bool $skipModuleUpdate */ public function __construct( - \Magento\App\Updater\SetupFactory $setupFactory, + \Magento\Module\Updater\SetupFactory $setupFactory, \Magento\App\State $appState, - \Magento\App\ModuleListInterface $moduleList, - \Magento\App\Module\ResourceResolverInterface $resourceResolver, + \Magento\Module\ModuleListInterface $moduleList, + \Magento\Module\ResourceResolverInterface $resourceResolver, $skipModuleUpdate = false ) { $this->_appState = $appState; $this->_moduleList = $moduleList; $this->_resourceResolver = $resourceResolver; $this->_setupFactory = $setupFactory; - $this->_skipModuleUpdate = (bool)$skipModuleUpdate; + $this->_skipModuleUpdate = $skipModuleUpdate; } /** @@ -135,7 +139,7 @@ class Updater implements \Magento\App\UpdaterInterface } } - /** @var $setup \Magento\App\Updater\SetupInterface*/ + /** @var $setup \Magento\Module\Updater\SetupInterface*/ foreach ($afterApplyUpdates as $setup) { $setup->afterApplyAllUpdates(); } diff --git a/lib/Magento/App/Updater/SetupFactory.php b/lib/Magento/Module/Updater/SetupFactory.php similarity index 86% rename from lib/Magento/App/Updater/SetupFactory.php rename to lib/Magento/Module/Updater/SetupFactory.php index 3ee75f5409c477daaa3b745c9d593fa5182750ac..c8286b5bfdee53423ad20a9acee274757eff074a 100644 --- a/lib/Magento/App/Updater/SetupFactory.php +++ b/lib/Magento/Module/Updater/SetupFactory.php @@ -1,5 +1,7 @@ <?php /** + * Module setup factory. Creates setups used during application install/upgrade. + * * Magento * * NOTICE OF LICENSE @@ -21,12 +23,13 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Updater; +namespace Magento\Module\Updater; +use Magento\Module\Updater\SetupInterface; use \Magento\ObjectManager; class SetupFactory { - const INSTANCE_TYPE = 'Magento\App\Updater\SetupInterface'; + const INSTANCE_TYPE = 'Magento\Module\Updater\SetupInterface'; /** * @var ObjectManager @@ -58,10 +61,10 @@ class SetupFactory { $className = isset($this->_resourceTypes[$resourceName]) ? $this->_resourceTypes[$resourceName] - : 'Magento\App\Updater\SetupInterface'; + : 'Magento\Module\Updater\SetupInterface'; if (false == (is_subclass_of($className, self::INSTANCE_TYPE)) && $className !== self::INSTANCE_TYPE) { - throw new \LogicException($className . ' is not a \Magento\App\Updater\SetupInterface'); + throw new \LogicException($className . ' is not a \Magento\Module\Updater\SetupInterface'); } return $this->_objectManager->create($className, array( diff --git a/lib/Magento/App/Updater/SetupInterface.php b/lib/Magento/Module/Updater/SetupInterface.php similarity index 90% rename from lib/Magento/App/Updater/SetupInterface.php rename to lib/Magento/Module/Updater/SetupInterface.php index cfa2d93739a0dbd6ae0b0f13ca68eacdbb31916c..e97d027be159f896c7cef231409762f9b01efb72 100644 --- a/lib/Magento/App/Updater/SetupInterface.php +++ b/lib/Magento/Module/Updater/SetupInterface.php @@ -1,5 +1,7 @@ <?php /** + * Module setup. Used to install/upgrade module schema. + * * Magento * * NOTICE OF LICENSE @@ -21,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App\Updater; +namespace Magento\Module\Updater; interface SetupInterface { @@ -40,7 +42,7 @@ interface SetupInterface /** * Apply module resource install, upgrade and data scripts * - * @return \Magento\App\Updater\SetupInterface + * @return \Magento\Module\Updater\SetupInterface */ public function applyUpdates(); @@ -55,7 +57,7 @@ interface SetupInterface /** * Run each time after applying of all updates, * - * @return \Magento\App\Updater\SetupInterface + * @return \Magento\Module\Updater\SetupInterface */ public function afterApplyAllUpdates(); diff --git a/lib/Magento/App/UpdaterInterface.php b/lib/Magento/Module/UpdaterInterface.php similarity index 97% rename from lib/Magento/App/UpdaterInterface.php rename to lib/Magento/Module/UpdaterInterface.php index edd9c9441c606824fe84ac0cd061d30924696f50..a3ead5b74df137f016853ce3457e2a2e3fff5e81 100644 --- a/lib/Magento/App/UpdaterInterface.php +++ b/lib/Magento/Module/UpdaterInterface.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App; +namespace Magento\Module; interface UpdaterInterface { diff --git a/lib/Magento/App/etc/module.xsd b/lib/Magento/Module/etc/module.xsd old mode 100755 new mode 100644 similarity index 100% rename from lib/Magento/App/etc/module.xsd rename to lib/Magento/Module/etc/module.xsd diff --git a/lib/Magento/ObjectManager.php b/lib/Magento/ObjectManager.php index cb9ece5ec7dd30d63b23ba6aab4ef999d5a2fa72..3b736d01ad4c96cedf2b974b994def54cd10f086 100644 --- a/lib/Magento/ObjectManager.php +++ b/lib/Magento/ObjectManager.php @@ -28,6 +28,13 @@ namespace Magento; interface ObjectManager { + /** + * Set factory + * + * @param ObjectManager\Factory $factory + */ + public function setFactory(ObjectManager\Factory $factory); + /** * Create new object instance * diff --git a/lib/Magento/ObjectManager/Config.php b/lib/Magento/ObjectManager/Config.php index 1cee480664612a4c0683ae4d3130b2f80a0b33cc..2ef59bc9059ed59c3f0b159af622e4f83a90de49 100644 --- a/lib/Magento/ObjectManager/Config.php +++ b/lib/Magento/ObjectManager/Config.php @@ -30,14 +30,14 @@ interface Config * * @param \Magento\ObjectManager\Relations $relations */ - public function setRelations(\Magento\ObjectManager\Relations $relations); + public function setRelations(Relations $relations); /** * Set configuration cache instance * * @param \Magento\ObjectManager\ConfigCache $cache */ - public function setCache(\Magento\ObjectManager\ConfigCache $cache); + public function setCache(ConfigCache $cache); /** * Retrieve list of arguments per type diff --git a/lib/Magento/ObjectManager/Config/Config.php b/lib/Magento/ObjectManager/Config/Config.php index a2dd5ba0d56488c4dca5fa71bccd21798f50c30c..43743952b954e0feed9fa98eddcddc44e4ca6d0d 100644 --- a/lib/Magento/ObjectManager/Config/Config.php +++ b/lib/Magento/ObjectManager/Config/Config.php @@ -246,7 +246,7 @@ class Config implements \Magento\ObjectManager\Config * * @param array $configuration */ - public function _mergeConfiguration(array $configuration) + protected function _mergeConfiguration(array $configuration) { foreach ($configuration as $key => $curConfig) { switch ($key) { diff --git a/app/code/Magento/Core/Model/ObjectManager/DefinitionFactory.php b/lib/Magento/ObjectManager/DefinitionFactory.php similarity index 50% rename from app/code/Magento/Core/Model/ObjectManager/DefinitionFactory.php rename to lib/Magento/ObjectManager/DefinitionFactory.php index a24fe3d0e1093c78a5da5d9caef05191ee40e6d7..c38113d8706643b39ec41d1cbaa18e83ad837fc6 100644 --- a/app/code/Magento/Core/Model/ObjectManager/DefinitionFactory.php +++ b/lib/Magento/ObjectManager/DefinitionFactory.php @@ -24,7 +24,7 @@ * @license {@license_link} * */ -namespace Magento\Core\Model\ObjectManager; +namespace Magento\ObjectManager; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -32,55 +32,56 @@ namespace Magento\Core\Model\ObjectManager; class DefinitionFactory { /** - * Format of definitions + * Directory containig compiled class metadata * * @var string */ - protected $_definitionFormat; + protected $_definitionDir; /** - * @var \Magento\Core\Model\Config\Primary + * Class generation dir + * + * @var string */ - protected $_config; + protected $_generationDir; /** - * @param \Magento\Core\Model\Config\Primary $config + * Format of definitions + * + * @var string */ - public function __construct(\Magento\Core\Model\Config\Primary $config) - { - $this->_config = $config; - $this->_definitionFormat = $config->getDefinitionFormat(); - } + protected $_definitionFormat; /** - * Get definition model name + * List of defintion models * - * @param string $format - * @return string + * @var array */ - protected function _getDefinitionModel($format) - { - switch ($format) { - case 'igbinary': - return 'Magento\ObjectManager\Definition\Compiled\Binary'; + protected $_definitionClasses = array( + 'igbinary' => 'Magento\ObjectManager\Definition\Compiled\Binary', + 'serialized' => 'Magento\ObjectManager\Definition\Compiled\Serialized' + ); - case 'serialized': - default: - return 'Magento\ObjectManager\Definition\Compiled\Serialized'; - } + /** + * @param $definitionDir + * @param $generationDir + * @param $definitionFormat + */ + public function __construct($definitionDir, $generationDir, $definitionFormat) + { + $this->_definitionDir = $definitionDir; + $this->_generationDir = $generationDir; + $this->_definitionFormat = $definitionFormat; } /** - * Create object manager definition reader based on configuration - * - * @return \Magento\ObjectManager\Definition + * @param $definitions + * @return \Magento\ObjectManager\Definition\Runtime */ - public function createClassDefinition() + public function createClassDefinition($definitions) { - \Magento\Profiler::start('di_definitions_create'); - $definitions = $this->_config->getParam('definitions', false); - if (!$definitions) { // check whether definitions were provided as application init param - $path = $this->_config->getDefinitionPath() . DIRECTORY_SEPARATOR . 'definitions.php'; + if (!$definitions) { + $path = $this->_definitionDir . DIRECTORY_SEPARATOR . 'definitions.php'; if (is_readable($path)) { $definitions = file_get_contents($path); } @@ -89,30 +90,28 @@ class DefinitionFactory if (is_string($definitions)) { $definitions = $this->_unpack($definitions); } - $definitionModel = $this->_getDefinitionModel($this->_definitionFormat); - $output = new $definitionModel($definitions); + $definitionModel = $this->_definitionClasses[$this->_definitionFormat]; + $result = new $definitionModel($definitions); } else { - $genDir = $this->_config->getDirectories()->getDir(\Magento\App\Dir::GENERATION); $autoloader = new \Magento\Autoload\IncludePath(); - $generatorIo = new \Magento\Code\Generator\Io(new \Magento\Io\File(), $autoloader, $genDir); - $generator = new \Magento\Code\Generator\ClassGenerator( - new \Magento\Code\Generator(null, $autoloader, $generatorIo) - ); - $definition = new \Magento\ObjectManager\Definition\Runtime(); - $output = new \Magento\Code\Generator\DefinitionDecorator($definition, $generator); + $generatorIo = new \Magento\Code\Generator\Io(new \Magento\Io\File(), $autoloader, $this->_generationDir); + $generator = new \Magento\Code\Generator(null, $autoloader, $generatorIo); + $autoloader = new \Magento\Code\Generator\Autoloader($generator); + spl_autoload_register(array($autoloader, 'load')); + + $result = new \Magento\ObjectManager\Definition\Runtime(); } - \Magento\Profiler::stop('di_definitions_create'); - return $output; + return $result; } /** - * Retrieve list of plugin definitions + * Create plugin definitions * * @return \Magento\Interception\Definition */ public function createPluginDefinition() { - $path = $this->_config->getDefinitionPath() . DIRECTORY_SEPARATOR . 'plugins.php'; + $path = $this->_definitionDir . DIRECTORY_SEPARATOR . 'plugins.php'; if (is_readable($path)) { return new \Magento\Interception\Definition\Compiled($this->_unpack(file_get_contents($path))); } else { @@ -121,15 +120,13 @@ class DefinitionFactory } /** - * Retreive class relations list - * - * @return \Magento\Core\Model\ObjectManager\Relations|\Magento\ObjectManager\Relations\Runtime + * @return \Magento\ObjectManager\Relations */ public function createRelations() { - $path = $this->_config->getDefinitionPath() . DIRECTORY_SEPARATOR . 'relations.php'; + $path = $this->_definitionDir . DIRECTORY_SEPARATOR . 'relations.php'; if (is_readable($path)) { - return new \Magento\Core\Model\ObjectManager\Relations($this->_unpack(file_get_contents($path))); + return new \Magento\ObjectManager\Relations\Compiled($this->_unpack(file_get_contents($path))); } else { return new \Magento\ObjectManager\Relations\Runtime(); } diff --git a/app/code/Magento/Core/Model/ObjectManager/DynamicConfigInterface.php b/lib/Magento/ObjectManager/DynamicConfigInterface.php similarity index 96% rename from app/code/Magento/Core/Model/ObjectManager/DynamicConfigInterface.php rename to lib/Magento/ObjectManager/DynamicConfigInterface.php index ae2a0984d4cff8043fc423b688aaccfceddf6f0c..6fb5051874dcfc09d3b39ee044990c3f98af2b6f 100644 --- a/app/code/Magento/Core/Model/ObjectManager/DynamicConfigInterface.php +++ b/lib/Magento/ObjectManager/DynamicConfigInterface.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\ObjectManager; +namespace Magento\ObjectManager; interface DynamicConfigInterface { diff --git a/lib/Magento/ObjectManager/Factory/Factory.php b/lib/Magento/ObjectManager/Factory/Factory.php index 8f83d638cd85698e4dbb5d608c7a5b881f979e8d..b43943c92d893e937c3126f9f9ca7f02e750673d 100644 --- a/lib/Magento/ObjectManager/Factory/Factory.php +++ b/lib/Magento/ObjectManager/Factory/Factory.php @@ -70,7 +70,7 @@ class Factory implements \Magento\ObjectManager\Factory ) { $this->_objectManager = $objectManager; $this->_config = $config; - $this->_definitions = $definitions ?: new \Magento\ObjectManager\Definition\Runtime(); + $this->_definitions = $definitions ? : new \Magento\ObjectManager\Definition\Runtime(); $this->_globalArguments = $globalArguments; } @@ -96,7 +96,10 @@ class Factory implements \Magento\ObjectManager\Factory $argument = null; if (array_key_exists($paramName, $arguments)) { $argument = $arguments[$paramName]; - } else if ($paramRequired) { + } elseif (array_key_exists('options', $arguments) && array_key_exists($paramName, $arguments['options'])) { + // The parameter name doesn't exist in the arguments, but it is contained in the 'options' argument. + $argument = $arguments['options'][$paramName]; + } elseif ($paramRequired) { if ($paramType) { $argument = array('instance' => $paramType); } else { @@ -123,14 +126,13 @@ class Factory implements \Magento\ObjectManager\Factory ); } $this->_creationStack[$requestedType] = 1; - $isShared = (!isset($argument['shared']) && $this->_config->isShared($argumentType)) || (isset($argument['shared']) && $argument['shared']); $argument = $isShared ? $this->_objectManager->get($argumentType) : $this->_objectManager->create($argumentType); unset($this->_creationStack[$requestedType]); - } else if (is_array($argument) && isset($argument['argument'])) { + } elseif (is_array($argument) && isset($argument['argument'])) { $argKey = $argument['argument']; $argument = isset($this->_globalArguments[$argKey]) ? $this->_globalArguments[$argKey] : $paramDefault; } @@ -164,36 +166,31 @@ class Factory implements \Magento\ObjectManager\Factory { $type = $this->_config->getInstanceType($requestedType); $parameters = $this->_definitions->getParameters($type); + if (!isset($this->_instances[$type])) { + $this->_instances[$type] = 0; + } + $this->_instances[$type]++; if ($parameters == null) { return new $type(); } $args = $this->_resolveArguments($requestedType, $parameters, $arguments); - - switch(count($args)) { + switch (count($args)) { case 1: return new $type($args[0]); - case 2: return new $type($args[0], $args[1]); - case 3: return new $type($args[0], $args[1], $args[2]); - case 4: return new $type($args[0], $args[1], $args[2], $args[3]); - case 5: return new $type($args[0], $args[1], $args[2], $args[3], $args[4]); - case 6: return new $type($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); - case 7: return new $type($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6]); - case 8: return new $type($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7]); - default: $reflection = new \ReflectionClass($type); return $reflection->newInstanceArgs($args); diff --git a/lib/Magento/ObjectManager/ObjectManager.php b/lib/Magento/ObjectManager/ObjectManager.php index c7b0e3189fe581483a77386a6613216e75b44a6c..ee97dea833c8db8fb5cda29ae3fc81e596c4f67a 100644 --- a/lib/Magento/ObjectManager/ObjectManager.php +++ b/lib/Magento/ObjectManager/ObjectManager.php @@ -45,22 +45,34 @@ class ObjectManager implements \Magento\ObjectManager protected $_sharedInstances = array(); /** - * @param \Magento\ObjectManager\Factory $factory - * @param \Magento\ObjectManager\Config $config + * @var Config\Config + */ + protected $_config; + + /** + * @param Factory $factory + * @param Config $config * @param array $sharedInstances */ - public function __construct( - \Magento\ObjectManager\Factory $factory = null, - \Magento\ObjectManager\Config $config = null, - array $sharedInstances = array() - ) { - $this->_config = $config ?: new \Magento\ObjectManager\Config\Config(); - $this->_factory = $factory ?: new \Magento\ObjectManager\Factory\Factory($this->_config, $this); + public function __construct(Factory $factory = null, Config $config = null, array $sharedInstances = array()) + { + $this->_config = $config ?: new Config\Config(); + $this->_factory = $factory ?: new Factory\Factory($this->_config, $this); $this->_factory->setObjectManager($this); $this->_sharedInstances = $sharedInstances; $this->_sharedInstances['Magento\ObjectManager'] = $this; } + /** + * Set creation factory + * + * @param Factory $factory + */ + public function setFactory(Factory $factory) + { + $this->_factory = $factory; + } + /** * Create new object instance * diff --git a/app/code/Magento/Core/Model/ObjectManager/Relations.php b/lib/Magento/ObjectManager/Relations/Compiled.php similarity index 93% rename from app/code/Magento/Core/Model/ObjectManager/Relations.php rename to lib/Magento/ObjectManager/Relations/Compiled.php index cb8ee2d07ace5b54fdcc07f97144be0bb80d2057..9e5f22032d56784322fe65dcbaf6c6056edd16ce 100644 --- a/app/code/Magento/Core/Model/ObjectManager/Relations.php +++ b/lib/Magento/ObjectManager/Relations/Compiled.php @@ -23,9 +23,9 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\ObjectManager; +namespace Magento\ObjectManager\Relations; -class Relations implements \Magento\ObjectManager\Relations +class Compiled implements \Magento\ObjectManager\Relations { /** * List of class relations diff --git a/lib/Magento/Outbound/Authentication/Factory.php b/lib/Magento/Outbound/Authentication/Factory.php index 3e07c5c5f53b400d51f7090dbbde07a1ac5f0014..d26e3628013759c429d41827326d5302a58f771e 100644 --- a/lib/Magento/Outbound/Authentication/Factory.php +++ b/lib/Magento/Outbound/Authentication/Factory.php @@ -30,7 +30,7 @@ namespace Magento\Outbound\Authentication; class Factory { - /** @var \Magento\Core\Model\ObjectManager */ + /** @var \Magento\App\ObjectManager */ private $_objectManager; /** diff --git a/lib/Magento/Stdlib/ArrayUtils.php b/lib/Magento/Stdlib/ArrayUtils.php new file mode 100644 index 0000000000000000000000000000000000000000..bebda10afae745ce590629e5583ced071a2a0af7 --- /dev/null +++ b/lib/Magento/Stdlib/ArrayUtils.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. + * + * @category Magento + * @package \Magento\Stdlib + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Stdlib; + +/** + * Class ArrayUtils + * + * @package Magento\Stdlib + */ +class ArrayUtils +{ + /** + * Sorts array with multibyte string keys + * + * @param array $sort + * @param string $locale + * @return array|bool + */ + public function ksortMultibyte(array &$sort, $locale) + { + if (empty($sort)) { + return false; + } + $oldLocale = setlocale(LC_COLLATE, "0"); + // use fallback locale if $localeCode is not available + + if (strpos($locale, '.UTF8') === false) { + $locale .= '.UTF8'; + } + + setlocale(LC_COLLATE, $locale, 'C.UTF-8', 'en_US.utf8'); + ksort($sort, SORT_LOCALE_STRING); + setlocale(LC_COLLATE, $oldLocale); + + return $sort; + } +} diff --git a/lib/Magento/Date.php b/lib/Magento/Stdlib/DateTime.php similarity index 75% rename from lib/Magento/Date.php rename to lib/Magento/Stdlib/DateTime.php index 12cb0993e78293a9e13c54f4bab07e27fa8ed5fd..c4edaf799865da51cf2ab975a3790aaf11201659 100644 --- a/lib/Magento/Date.php +++ b/lib/Magento/Stdlib/DateTime.php @@ -19,22 +19,18 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Date + * @package \Magento\Stdlib * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Stdlib; + /** * Converter of date formats * Internal dates - * - * @category Magento - * @package Magento_Date - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento; - -class Date +class DateTime { /**#@+ * Date format, used as default. Compatible with \Zend_Date @@ -46,29 +42,14 @@ class Date const DATE_PHP_FORMAT = 'Y-m-d'; /**#@-*/ - /** - * Convert value by dictionary - * - * @param string $value - * @param array $dictionary - * @return string - */ - protected static function _convert($value, $dictionary) - { - foreach ($dictionary as $search => $replace) { - $value = preg_replace('/(^|[^%])' . $search . '/', '$1' . $replace, $value); - } - return $value; - } - /** * Convert date to UNIX timestamp * Returns current UNIX timestamp if date is true * - * @param \Zend_Date|string|bool $date + * @param \Zend_Date|bool $date * @return int */ - public static function toTimestamp($date) + public function toTimestamp($date) { if ($date instanceof \Zend_Date) { return $date->getTimestamp(); @@ -87,7 +68,7 @@ class Date * @param boolean $withoutTime day only flag * @return string */ - public static function now($withoutTime = false) + public function now($withoutTime = false) { $format = $withoutTime ? self::DATE_PHP_FORMAT : self::DATETIME_PHP_FORMAT; return date($format); @@ -96,14 +77,14 @@ class Date /** * Format date to internal format * - * @param string|Zend_Date|bool|null $date + * @param string|\Zend_Date|bool|null $date * @param boolean $includeTime * @return string|null */ - public static function formatDate($date, $includeTime = true) + public function formatDate($date, $includeTime = true) { if ($date === true) { - return self::now(!$includeTime); + return $this->now(!$includeTime); } if ($date instanceof \Zend_Date) { @@ -119,10 +100,21 @@ class Date } if (!is_numeric($date)) { - $date = self::toTimestamp($date); + $date = $this->toTimestamp($date); } $format = $includeTime ? self::DATETIME_PHP_FORMAT : self::DATE_PHP_FORMAT; return date($format, $date); } + + /** + * Check whether sql date is empty + * + * @param string $date + * @return boolean + */ + public function isEmptyDate($date) + { + return preg_replace('#[ 0:-]#', '', $date) === ''; + } } diff --git a/lib/Magento/Stdlib/String.php b/lib/Magento/Stdlib/String.php new file mode 100644 index 0000000000000000000000000000000000000000..8f8a38ac8cc37d27d71b37e093c165c04aaf83f4 --- /dev/null +++ b/lib/Magento/Stdlib/String.php @@ -0,0 +1,234 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package \Magento\Stdlib + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Stdlib; + +/** + * Magento methods to work with string + */ +class String +{ + /** + * Default charset + */ + const ICONV_CHARSET = 'UTF-8'; + + /** + * Capitalize first letters and convert separators if needed + * + * @param string $str + * @param string $sourceSeparator + * @param string $destinationSeparator + * @return string + */ + public function upperCaseWords($str, $sourceSeparator = '_', $destinationSeparator = '_') + { + return str_replace(' ', $destinationSeparator, ucwords(str_replace($sourceSeparator, ' ', $str))); + } + + /** + * Split string and appending $insert string after $needle + * + * @param string $str + * @param integer $length + * @param string $needle + * @param string $insert + * @return string + */ + public function splitInjection($str, $length = 50, $needle = '-', $insert = ' ') + { + $str = $this->split($str, $length); + $newStr = ''; + foreach ($str as $part) { + if ($this->strlen($part) >= $length) { + $lastDelimiter = $this->strpos($this->strrev($part), $needle); + $tmpNewStr = $this->substr($this->strrev($part), 0, $lastDelimiter) + . $insert . $this->substr($this->strrev($part), $lastDelimiter); + $newStr .= $this->strrev($tmpNewStr); + } else { + $newStr .= $part; + } + } + return $newStr; + } + + /** + * Binary-safe variant of strSplit() + * + option not to break words + * + option to trim spaces (between each word) + * + option to set character(s) (pcre pattern) to be considered as words separator + * + * @param string $value + * @param int $length + * @param bool $keepWords + * @param bool $trim + * @param string $wordSeparatorRegex + * @return array + */ + public function split($value, $length = 1, $keepWords = false, $trim = false, $wordSeparatorRegex = '\s') + { + $result = array(); + $strLen = $this->strlen($value); + if (!$strLen || !is_int($length) || $length <= 0) { + return $result; + } + if ($trim) { + $value = trim(preg_replace('/\s{2,}/siu', ' ', $value)); + } + // do a usual str_split, but safe for our encoding + if (!$keepWords || $length < 2) { + for ($offset = 0; $offset < $strLen; $offset += $length) { + $result[] = $this->substr($value, $offset, $length); + } + } else { + // split smartly, keeping words + $split = preg_split('/(' . $wordSeparatorRegex . '+)/siu', $value, null, PREG_SPLIT_DELIM_CAPTURE); + $index = 0; + $space = ''; + $spaceLen = 0; + foreach ($split as $key => $part) { + if ($trim) { + // ignore spaces (even keys) + if ($key % 2) { + continue; + } + $space = ' '; + $spaceLen = 1; + } + if (empty($result[$index])) { + $currentLength = 0; + $result[$index] = ''; + $space = ''; + $spaceLen = 0; + } else { + $currentLength = $this->strlen($result[$index]); + } + $partLength = $this->strlen($part); + // add part to current last element + if (($currentLength + $spaceLen + $partLength) <= $length) { + $result[$index] .= $space . $part; + } elseif ($partLength <= $length) { + // add part to new element + $index++; + $result[$index] = $part; + } else { + // break too long part recursively + foreach ($this->split($part, $length, false, $trim, $wordSeparatorRegex) as $subPart) { + $index++; + $result[$index] = $subPart; + } + } + } + } + // remove last element, if empty + $count = count($result); + if ($count) { + if ($result[$count - 1] === '') { + unset($result[$count - 1]); + } + } + // remove first element, if empty + if (isset($result[0]) && $result[0] === '') { + array_shift($result); + } + return $result; + } + + /** + * Retrieve string length using default charset + * + * @param string $string + * @return int + */ + public function strlen($string) + { + return iconv_strlen($string, self::ICONV_CHARSET); + } + + /** + * Clean non UTF-8 characters + * + * @param string $string + * @return string + */ + public function cleanString($string) + { + if ('"libiconv"' == ICONV_IMPL) { + return iconv(self::ICONV_CHARSET, self::ICONV_CHARSET . '//IGNORE', $string); + } else { + return $string; + } + } + + /** + * Pass through to iconv_substr() + * + * @param string $string + * @param int $offset + * @param int $length + * @return string + */ + public function substr($string, $offset, $length = null) + { + $string = $this->cleanString($string); + if (is_null($length)) { + $length = $this->strlen($string) - $offset; + } + return iconv_substr($string, $offset, $length, self::ICONV_CHARSET); + } + + /** + * Binary-safe strrev() + * + * @param string $str + * @return string + */ + public function strrev($str) + { + $result = ''; + $strLen = $this->strlen($str); + if (!$strLen) { + return $result; + } + for ($i = $strLen - 1; $i >= 0; $i--) { + $result .= $this->substr($str, $i, 1); + } + return $result; + } + + /** + * Find position of first occurrence of a string + * + * @param string $haystack + * @param string $needle + * @param int $offset + * @return int|bool + */ + public function strpos($haystack, $needle, $offset = null) + { + return iconv_strpos($haystack, $needle, $offset, self::ICONV_CHARSET); + } +} diff --git a/lib/Magento/UrlInterface.php b/lib/Magento/UrlInterface.php index 6110c1043881c11794af8ffc2e671773951d90c4..5c2bcd94cf8b4ed2e12fd783e349d885b3c1f799 100644 --- a/lib/Magento/UrlInterface.php +++ b/lib/Magento/UrlInterface.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -136,21 +134,6 @@ interface UrlInterface */ public function isSecure(); - /** - * Set store entity - * - * @param mixed $params - * @return \Magento\UrlInterface - */ - public function setStore($params); - - /** - * Get current store for the url instance - * - * @return \Magento\Core\Model\Store - */ - public function getStore(); - /** * Retrieve Base URL * diff --git a/lib/Magento/View/Context.php b/lib/Magento/View/Context.php index 911ce27216fd171ebd8c594320f894ac3675c9ab..23cce2d4ab3e4ff7cd72539179da196c1de25319 100644 --- a/lib/Magento/View/Context.php +++ b/lib/Magento/View/Context.php @@ -34,12 +34,12 @@ use Magento\Core\Model\Store\Config as StoreConfig; use Magento\Core\Model\Factory\Helper as FactoryHelper; use Magento\Core\Model\View\Url as ViewUrl; use Magento\View\ConfigInterface as ViewConfig; -use Magento\Core\Model\Logger; +use Magento\Logger; use Magento\Core\Model\App; use Magento\App\State as AppState; use Magento\Core\Model\Session\AbstractSession; -use Magento\Core\Model\CacheInterface as Cache; +use Magento\App\CacheInterface as Cache; use Magento\Core\Model\Cache\StateInterface as CacheState; use Magento\UrlInterface; use Magento\Event\ManagerInterface; @@ -74,7 +74,7 @@ class Context protected $translator; /** - * @var \Magento\Core\Model\CacheInterface + * @var \Magento\App\CacheInterface */ protected $cache; @@ -108,6 +108,11 @@ class Context */ protected $viewUrl; + /** + * @var \Magento\View\LayoutInterface + */ + protected $layout; + /** * View config model * @@ -121,7 +126,7 @@ class Context protected $cacheState; /** - * @var \Magento\Core\Model\Logger + * @var \Magento\Logger */ protected $logger; @@ -193,7 +198,7 @@ class Context } /** - * @return \Magento\Core\Model\CacheInterface + * @return \Magento\App\CacheInterface */ public function getCache() { @@ -305,7 +310,7 @@ class Context } /** - * @return \Magento\Core\Model\Logger + * @return \Magento\Logger */ public function getLogger() { diff --git a/lib/Magento/View/DesignInterface.php b/lib/Magento/View/DesignInterface.php index b5be26f55ffe473e1d54733335188d77aa0b21ea..bf2fc4ab2916bd6cf7ff99837b936427964f1c2b 100644 --- a/lib/Magento/View/DesignInterface.php +++ b/lib/Magento/View/DesignInterface.php @@ -39,6 +39,7 @@ interface DesignInterface /** * Set package area * + * @deprecated * @param string $area * @return DesignInterface */ @@ -47,6 +48,7 @@ interface DesignInterface /** * Retrieve package area * + * @deprecated * @return string */ public function getArea(); diff --git a/lib/Magento/View/Layout/File/Source/Decorator/ModuleDependency.php b/lib/Magento/View/Layout/File/Source/Decorator/ModuleDependency.php index fc0f1c686ae9422b6dfdf3627b984f2fda664119..690938812001263e7590d94dfe8c61785aaf4b34 100644 --- a/lib/Magento/View/Layout/File/Source/Decorator/ModuleDependency.php +++ b/lib/Magento/View/Layout/File/Source/Decorator/ModuleDependency.php @@ -28,7 +28,7 @@ namespace Magento\View\Layout\File\Source\Decorator; use Magento\View\Layout\File\SourceInterface; use Magento\View\Layout\File; -use Magento\App\ModuleListInterface; +use Magento\Module\ModuleListInterface; use Magento\View\Design\ThemeInterface; class ModuleDependency implements SourceInterface diff --git a/pub/cron.php b/pub/cron.php index 93925197fa082dc3c659dcf49ab58167f8dc020e..c48a244271b12c84a57afb281ae068f55c4fbf15 100644 --- a/pub/cron.php +++ b/pub/cron.php @@ -35,9 +35,8 @@ try { \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', \Magento\Core\Model\Store::CUSTOM_ENTRY_POINT_PARAM => true ); - $config = new \Magento\Core\Model\Config\Primary(BP, $params); - $entryPoint = new \Magento\Core\Model\EntryPoint\Cron($config); - $entryPoint->processRequest(); + $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); + $entryPoint->run('Magento\App\Cron'); } catch (\Exception $e) { print $e->getMessage() . "\n\n"; print $e->getTraceAsString(); diff --git a/pub/get.php b/pub/get.php index e38e5587ded7d9eea7e275e84a023204f76bd68d..79fb37af3637ed3b954993c322c2adf5a51905e6 100644 --- a/pub/get.php +++ b/pub/get.php @@ -80,8 +80,12 @@ if (empty($mediaDirectory)) { $params[\Magento\Core\Model\App::PARAM_CACHE_OPTIONS]['frontend_options']['disable_save'] = true; } -$config = new \Magento\Core\Model\Config\Primary(dirname(__DIR__), $params); -$entryPoint = new \Magento\Core\Model\EntryPoint\Media( - $config, $request, $isAllowed, __DIR__, $mediaDirectory, $configCacheFile, $relativeFilename -); -$entryPoint->processRequest(); +$entryPoint = new \Magento\App\EntryPoint\EntryPoint(dirname(__DIR__), $params); +$entryPoint->run('Magento\Core\App\Media', array( + 'request' => $request, + 'workingDirectory' => __DIR__, + 'mediaDirectory' => $mediaDirectory, + 'configCacheFile' => $configCacheFile, + 'isAllowed' => $isAllowed, + 'relativeFileName' => $relativeFilename, +)); diff --git a/pub/index.php b/pub/index.php index 459fa5dc8f6bf76cadb363f1762eabaf460b1b9c..0e136bc5e001dd3142e7e0189d7c67ab466e8940 100644 --- a/pub/index.php +++ b/pub/index.php @@ -26,7 +26,8 @@ require __DIR__ . '/../app/bootstrap.php'; \Magento\Profiler::start('magento'); $params = $_SERVER; -$params[\Magento\Core\Model\App::PARAM_APP_URIS][\Magento\App\Dir::PUB] = ''; -$entryPoint = new \Magento\Core\Model\EntryPoint\Http(new \Magento\Core\Model\Config\Primary(BP, $params)); -$entryPoint->processRequest(); +$params[\Magento\App\Dir::PARAM_APP_URIS][\Magento\App\Dir::PUB] = ''; +$entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); +$result = $entryPoint->run('Magento\App\Http'); \Magento\Profiler::stop('magento'); +return $result; diff --git a/pub/lib/mage/item-table.js b/pub/lib/mage/item-table.js index ab8e83c15b31fab17fadb87a55308b61c212ca89..d51145c24f9bd8bfa3c56e92e9681b3748d2608a 100644 --- a/pub/lib/mage/item-table.js +++ b/pub/lib/mage/item-table.js @@ -125,7 +125,7 @@ e.stopPropagation(); // remove the deletable item - e.target.remove(); + $(e.target).remove(); if (this.options.keepLastRow) { // determine if there is only one element remaining, in which case, disable the delete mechanism on it diff --git a/pub/lib/mage/validation.js b/pub/lib/mage/validation.js index 0fc6ef11973fb01e655247da5590f0952bd265de..72571905ea64c25befa1fd80dfbe8e24557e46e2 100644 --- a/pub/lib/mage/validation.js +++ b/pub/lib/mage/validation.js @@ -936,7 +936,7 @@ */ function(value, element, params) { if (value && params && creditCartTypes[value]) { - return creditCartTypes[value][0].test($(params).val()); + return creditCartTypes[value][0].test($(params).val().replace(/\s+/g, '')); } return false; }, 'Card type does not match credit card number.'